u
This commit is contained in:
parent
514679a801
commit
db57939ad4
@ -19,16 +19,14 @@ logging.basicConfig(level=logging.DEBUG)
|
||||
Connected = False
|
||||
|
||||
|
||||
def on_connect(client, userdata, flags, rc):
|
||||
if rc == 0:
|
||||
print("Connected to MQTT Broker!")
|
||||
|
||||
def connect_mqtt() -> mqtt_client:
|
||||
def on_connect(client, userdata, flags, rc):
|
||||
if rc == 0:
|
||||
print("Connected to MQTT Broker!")
|
||||
|
||||
global Connected #Use global variable
|
||||
Connected = True #Signal connection
|
||||
else:
|
||||
print("Failed to connect, return code %d\n", rc)
|
||||
global Connected #Use global variable
|
||||
Connected = True #Signal connection
|
||||
else:
|
||||
print("Failed to connect, return code %d\n", rc)
|
||||
|
||||
def on_message(client, userdata, msg):
|
||||
print(f"Received `{msg.payload.decode()}` from `{msg.topic}` topic")
|
||||
|
Loading…
Reference in New Issue
Block a user