diff --git a/examples/mqtt.py b/examples/mqtt.py index e98566b..aaa130a 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -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