fix
This commit is contained in:
parent
d485016a39
commit
201f835aa7
@ -94,16 +94,7 @@ 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
|
||||
value_pvProduction = ""
|
||||
value_wHouseConsumption = ""
|
||||
value_energyImportExport = ""
|
||||
value_houseBatterySoC = ""
|
||||
value_houseBatteryLoadUnload = ""
|
||||
|
||||
|
||||
if msg.topic == "openWB/pv/W":
|
||||
value_pvProduction = ""+msg.payload.decode()
|
||||
@ -133,6 +124,18 @@ def on_message(client, userdata, msg):
|
||||
client = mqtt_client.Client(client_id, protocol=paho.MQTTv31)
|
||||
client.username_pw_set(username, password=pw)
|
||||
client.on_connect = on_connect
|
||||
|
||||
global value_pvProduction
|
||||
global value_wHouseConsumption
|
||||
global value_energyImportExport
|
||||
global value_houseBatterySoC
|
||||
global value_houseBatteryLoadUnload
|
||||
value_pvProduction = ""
|
||||
value_wHouseConsumption = ""
|
||||
value_energyImportExport = ""
|
||||
value_houseBatterySoC = ""
|
||||
value_houseBatteryLoadUnload = ""
|
||||
|
||||
client.on_message = on_message
|
||||
|
||||
client.connect(broker, port=port)
|
||||
|
Loading…
Reference in New Issue
Block a user