Skip to content

Commit

Permalink
Bug topic direct panel subscription (#27)
Browse files Browse the repository at this point in the history
* Dev (#22)

* ensure mqtt message has no empty payload (#21)

* forgot to subscripe topics

* proper parameters

* support multiple panels properly
  • Loading branch information
reinhard-brandstaedter authored Sep 21, 2023
1 parent dd9d1ba commit a8f7fb8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/solarflow-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def on_inverter_update(msg):
inverter_values.pop(0)
inverter_values.append(float(msg))

def on_direct_panel(client,msg):
def on_direct_panel(msg):
global direct_panel_values
global direct_panel_power
payload = json.loads(msg.payload.decode())
Expand Down Expand Up @@ -219,7 +219,7 @@ def on_message(client, userdata, msg):
if msg.topic == topic_acinput:
on_inverter_update(msg.payload.decode())
if msg.topic in topics_direct_panel:
on_direct_panel(msg.payload.decode())
on_direct_panel(msg)
if msg.topic == topic_solarflow_solarinput:
on_solarflow_solarinput(msg.payload.decode())
if msg.topic == topic_solarflow_electriclevel:
Expand Down Expand Up @@ -258,6 +258,9 @@ def connect_mqtt() -> mqtt_client:
def subscribe(client: mqtt_client):
for th in topics_house:
client.subscribe(th)

for dp in topics_direct_panel:
client.subscribe(dp)

client.subscribe(topic_acinput)
client.subscribe(topic_solarflow_solarinput)
Expand Down

0 comments on commit a8f7fb8

Please sign in to comment.