This commit is contained in:
Robert Borzutzki 2022-10-19 17:38:02 +02:00
parent da13c44700
commit f57141f4eb

View File

@ -31,17 +31,17 @@ username = "mqtt-user"
pw = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP"
client_id = "solarmonitor"
global value_pvProduction
global value_wHouseConsumption
global value_energyImportExport
global value_houseBatterySoC
global value_houseBatteryLoadUnload
# global value_pvProduction
# global value_wHouseConsumption
# global value_energyImportExport
# global value_houseBatterySoC
# global value_houseBatteryLoadUnload
value_pvProduction = "0"
value_wHouseConsumption = "0"
value_energyImportExport = "0"
value_houseBatterySoC = "0"
value_houseBatteryLoadUnload = "0"
# value_pvProduction = "0"
# value_wHouseConsumption = "0"
# value_energyImportExport = "0"
# value_houseBatterySoC = "0"
# value_houseBatteryLoadUnload = "0"
try:
logging.info("epd2in13bc Demo")
@ -94,6 +94,12 @@ def on_connect(client, userdata, flags, rc):
print("Failed to connect, return code %d\n", rc)
def on_message(client, userdata, msg):
global value_pvProduction
global value_wHouseConsumption
global value_energyImportExport
global value_houseBatterySoC
global value_houseBatteryLoadUnload
if msg.topic == "openWB/pv/W":
value_pvProduction = ""+msg.payload.decode()
line = 0
@ -104,10 +110,10 @@ def on_message(client, userdata, msg):
value_energyImportExport = ""+msg.payload.decode()
line = 30
elif msg.topic == "openWB/housebattery/%Soc":
topic_houseBatterySoC = ""+msg.payload.decode()
value_houseBatterySoC = ""+msg.payload.decode()
line = 45
elif msg.topic == "openWB/housebattery/W":
topic_houseBatteryLoadUnload = ""+msg.payload.decode()
value_houseBatteryLoadUnload = ""+msg.payload.decode()
line = 60
print(line)