This commit is contained in:
Robert Borzutzki 2022-10-19 16:46:39 +02:00
parent 7a682d1cc4
commit aef8260f34

View File

@ -17,7 +17,25 @@ import paho.mqtt.client as paho
logging.basicConfig(level=logging.DEBUG)
Connected = False
Connected = False #global variable for the state of the connection
broker = "192.168.99.224"
port = 1883
topic_wHouseConsumption = "openWB/global/WHouseConsumption"
topic_pvProduction = "openWB/pv/W"
topic_energyImportExport = "openWB/evu/W"
topic_houseBatterySoC = "openWB/housebattery/%Soc"
topic_houseBatteryLoadUnload = "openWB/housebattery/W"
username = "mqtt-user"
pw = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP"
client_id = "solarmonitor"
value_pvProduction = 0
value_wHouseConsumption = 0
value_energyImportExport = 0
value_houseBatterySoC = 0
value_houseBatteryLoadUnload = 0
try:
logging.info("epd2in13bc Demo")
@ -93,26 +111,6 @@ def on_message(client, userdata, msg):
epd.DisplayPartial(epd.getbuffer(HBlackimage))
#print(f"`{msg.topic}`: `{msg.payload.decode()}`")
Connected = False #global variable for the state of the connection
broker = "192.168.99.224"
port = 1883
topic_wHouseConsumption = "openWB/global/WHouseConsumption"
topic_pvProduction = "openWB/pv/W"
topic_energyImportExport = "openWB/evu/W"
topic_houseBatterySoC = "openWB/housebattery/%Soc"
topic_houseBatteryLoadUnload = "openWB/housebattery/W"
value_pvProduction = 0
value_wHouseConsumption = 0
value_energyImportExport = 0
value_houseBatterySoC = 0
value_houseBatteryLoadUnload = 0
username = "mqtt-user"
pw = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP"
client_id = "solarmonitor"
client = mqtt_client.Client(client_id, protocol=paho.MQTTv31)
client.username_pw_set(username, password=pw)
client.on_connect = on_connect