str to int

This commit is contained in:
Robert Borzutzki 2022-10-19 21:07:55 +02:00
parent 31da7421a2
commit f017c91f34

View File

@ -63,25 +63,25 @@ def on_message(client, userdata, msg):
global value_houseBatteryLoadUnload
if msg.topic == "openWB/pv/W":
value_pvProduction = ""+msg.payload.decode()
value_pvProduction = int(msg.payload.decode())
elif msg.topic == "openWB/global/WHouseConsumption":
value_wHouseConsumption = ""+msg.payload.decode()
value_wHouseConsumption = int(msg.payload.decode())
elif msg.topic == "openWB/evu/W":
value_energyImportExport = ""+msg.payload.decode()
value_energyImportExport = int(msg.payload.decode())
elif msg.topic == "openWB/housebattery/%Soc":
value_houseBatterySoC = ""+msg.payload.decode()
value_houseBatterySoC = int(msg.payload.decode())
elif msg.topic == "openWB/housebattery/W":
value_houseBatteryLoadUnload = ""+msg.payload.decode()
value_houseBatteryLoadUnload = int(msg.payload.decode())
client = mqtt_client.Client(client_id, protocol=paho.MQTTv31)
client.username_pw_set(username, password=pw)
client.on_connect = on_connect
value_pvProduction = ""
value_wHouseConsumption = ""
value_energyImportExport = ""
value_houseBatterySoC = ""
value_houseBatteryLoadUnload = ""
value_pvProduction = 0
value_wHouseConsumption = 0
value_energyImportExport = 0
value_houseBatterySoC = 0
value_houseBatteryLoadUnload = 0
client.on_message = on_message