add values

This commit is contained in:
Robert Borzutzki 2022-10-19 10:48:51 +02:00
parent b61e9c9044
commit b2506c6b23

View File

@ -66,13 +66,19 @@ def on_connect(client, userdata, flags, rc):
print("Failed to connect, return code %d\n", rc)
def on_message(client, userdata, msg):
drawblack.text((150, 0), '99', font = font10, fill = 0)
drawblack.text((150, 15), '99', font = font10, fill = 0)
drawblack.text((150, 30), '99', font = font10, fill = 0)
drawblack.text((150, 45), '99', font = font10, fill = 0)
drawblack.text((150, 60), '99', font = font10, fill = 0)
if msg.topic == "openWB/pv/W":
line = 0
elif msg.topic == "openWB/global/WHouseConsumption":
line = 15
elif msg.topic == "openWB/evu/W":
line = 30
elif msg.topic == "openWB/housebattery/%Soc":
line = 45
elif msg.topic == "openWB/housebattery/W":
line = 60
drawblack.text((150, line), {msg.payload.decode()}, font = font10, fill = 0)
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
print(f"`{msg.topic}`: `{msg.payload.decode()}`")
#print(f"`{msg.topic}`: `{msg.payload.decode()}`")
Connected = False #global variable for the state of the connection