diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-11-04 20:28:52 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-11-04 20:28:52 -0300 |
| commit | 48ffb49e0913dc7a94c3bdfb0c0cf69e4b8f0235 (patch) | |
| tree | 2475eff80375727bb10ccc62ca8b0f391927bd18 /mqtt_client/main.py | |
| parent | e3b41c5c24488a48b552fb7aeffe250574b9c8a8 (diff) | |
enviando mensagens
Diffstat (limited to 'mqtt_client/main.py')
| -rw-r--r-- | mqtt_client/main.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mqtt_client/main.py b/mqtt_client/main.py index 0ba9f10..6df96c7 100644 --- a/mqtt_client/main.py +++ b/mqtt_client/main.py @@ -40,6 +40,8 @@ def on_connect(client, userdata, flags, reason_code, properties): def on_message(client, userdata, msg): payload = json.loads(msg.payload) topic = msg.topic.split('/')[-1] + print(f"GOT MESSAGE {payload}") + if topic.isnumeric(): stationId = int(topic) else: @@ -80,7 +82,7 @@ except KeyError: mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, protocol=MQTTProtocolVersion.MQTTv5) mqttc.on_connect = on_connect mqttc.on_message = on_message -mqttc.username_pw_set(user_name, user_pass) +#mqttc.username_pw_set(user_name, user_pass) connected = False |
