Skip to content

Commit

Permalink
Online Hubs reporting to new mqtt topics (#35)
Browse files Browse the repository at this point in the history
* have online hubs report to new mqtt topics (support multiple hubs)
  • Loading branch information
reinhard-brandstaedter authored Nov 12, 2023
1 parent 02fa3d1 commit 9608ec3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/solarflow-status.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def on_zendure_message(client, userdata, msg):
if "properties/report" in msg.topic and "properties" in payload:
properties = payload["properties"]
for prop, val in properties.items():
local_client.publish(f'solarflow-hub/telemetry/{prop}',val)
local_client.publish(f'solarflow-hub/{device_details["deviceKey"]}/telemetry/{prop}',val)

if "outputHomePower" in properties:
socketio.emit('updateSensorData', {'metric': 'outputHome', 'value': properties["outputHomePower"], 'date': round(time.time()*1000)})
Expand Down Expand Up @@ -112,7 +112,7 @@ def on_zendure_message(client, userdata, msg):
for pack in packdata:
sn = pack.pop('sn')
for prop, val in pack.items():
local_client.publish(f'solarflow-hub/telemetry/batteries/{sn}/{prop}',val)
local_client.publish(f'solarflow-hub/{device_details["deviceKey"]}/telemetry/batteries/{sn}/{prop}',val)

if "socLevel" in pack:
socketio.emit('updateSensorData', {'metric': 'socLevel', 'value': pack["socLevel"], 'date': sn})
Expand Down

0 comments on commit 9608ec3

Please sign in to comment.