Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config #60

Merged
merged 42 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ec25277
configuration via config file
reinhard-brandstaedter Oct 5, 2023
7d0e89d
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
507568c
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
85ffaad
remove x-build specifics
reinhard-brandstaedter Oct 5, 2023
11bd7cf
split pip installs
reinhard-brandstaedter Oct 5, 2023
6ef9510
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
b11f42d
add dev libs for x-build
reinhard-brandstaedter Oct 5, 2023
7fa3462
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
69a8cc7
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
fabae8f
x-build deps
reinhard-brandstaedter Oct 5, 2023
52cd615
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
a4ff75b
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
6ef2683
add gcc for x-build
reinhard-brandstaedter Oct 5, 2023
d5e7291
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
afff514
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
f00157d
add musl dev
reinhard-brandstaedter Oct 5, 2023
cdde7fa
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
5c265e2
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
ff67ba6
add rust
reinhard-brandstaedter Oct 5, 2023
31dc94c
add rust
reinhard-brandstaedter Oct 5, 2023
a8839eb
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 5, 2023
e61366e
Merge branch 'dev' into config
reinhard-brandstaedter Oct 5, 2023
864339c
add cargo
reinhard-brandstaedter Oct 6, 2023
52a8836
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
0c5b507
Merge branch 'dev' into config
reinhard-brandstaedter Oct 6, 2023
9fa4ea7
add openssl
reinhard-brandstaedter Oct 6, 2023
70bc20e
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
7dad541
Merge branch 'dev' into config
reinhard-brandstaedter Oct 6, 2023
fcf45d9
openssl-dev
reinhard-brandstaedter Oct 6, 2023
5463936
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
1a1e64f
Merge branch 'dev' into config
reinhard-brandstaedter Oct 6, 2023
ce577cf
make image slimmer
reinhard-brandstaedter Oct 6, 2023
2e1f9a7
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
64cecb8
make image slimmer
reinhard-brandstaedter Oct 6, 2023
0851f6f
Merge branch 'dev' into config
reinhard-brandstaedter Oct 6, 2023
4a43412
default value bug
reinhard-brandstaedter Oct 6, 2023
1385f5e
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
34b5f4e
config for direct panel
reinhard-brandstaedter Oct 6, 2023
782cacf
parallel builds
reinhard-brandstaedter Oct 6, 2023
0aadbe8
Merge branch 'dev' into config
reinhard-brandstaedter Oct 6, 2023
3592eee
parallel install option not working anymor
reinhard-brandstaedter Oct 6, 2023
8b481b8
Merge branch 'config' of /~https://github.com/reinhard-brandstaedter/so…
reinhard-brandstaedter Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/solarflow-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def load_config():

# The minimum state of charge of the battery to start discharging also throughout the day
DAY_DISCHARGE_SOC = config.getint('control', 'day_discharge_soc', fallback=50) \
or int(os.environ.get('DAY_DISCHARGE_SOC',50))
or int(os.environ.get('DAY_DISCHARGE_SOC',50))

CHARGE_THROUGH_THRESHOLD = config.getint('control', 'charge_through_threshold', fallback=60) \
or int(os.environ.get('CHARGE_THROUGH_THRESHOLD',60))

# if we produce more than what we need we can feed that much to the grid
OVERAGE_LIMIT = config.getint('control', 'overage_limit', fallback=15) \
Expand Down Expand Up @@ -95,6 +98,7 @@ def load_config():
or os.environ.get('TOPIC_DIRECT_PANEL',None)
topics_direct_panel = [ t.strip() for t in topic_direct_panel.split(',') ] if topic_direct_panel else []


# topics for telemetry read from Solarflow Hub
topic_solarflow_solarinput = config.get('mqtt_telemetry_topics', 'topic_solarflow_solarinput', fallback="solarflow-hub/telemetry/solarInputPower")
topic_solarflow_electriclevel = config.get('mqtt_telemetry_topics', 'topic_solarflow_electriclevel', fallback="solarflow-hub/telemetry/electricLevel")
Expand Down Expand Up @@ -428,7 +432,7 @@ def limitHomeInput(client: mqtt_client):
path += "1"
limit = min(demand,MAX_DISCHARGE_LEVEL) # in the morning keep using battery, in the evening start using battery
td = timedelta(minutes = 5)
if charge_through or (now > sunset and now < sunset + td and packSoc < DAY_DISCHARGE_SOC): # charge through mode, do not discharge when battery is low at sunset
if charge_through or (now > sunset and now < sunset + td and packSoc < CHARGE_THROUGH_THRESHOLD): # charge through mode, do not discharge when battery is low at sunset
charge_through = True
limit = 0
else:
Expand Down