add start and stop mqtt loop
This commit is contained in:
parent
2ab134d58a
commit
a12cec5377
@ -57,8 +57,10 @@ def subscribe(client: mqtt_client, topic):
|
|||||||
def on_message(client, userdata, msg):
|
def on_message(client, userdata, msg):
|
||||||
print(f"Received `{msg.payload.decode()}` from `{msg.topic}` topic")
|
print(f"Received `{msg.payload.decode()}` from `{msg.topic}` topic")
|
||||||
|
|
||||||
|
client.loop_start()
|
||||||
client.subscribe(topic)
|
client.subscribe(topic)
|
||||||
client.on_message = on_message
|
client.on_message = on_message
|
||||||
|
client.loop_stop()
|
||||||
|
|
||||||
def monitor(charge_point_power):
|
def monitor(charge_point_power):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user