Spaces:
Sleeping
Sleeping
debug mqtt
Browse files- mqtt_manager.py +8 -4
mqtt_manager.py
CHANGED
|
@@ -45,7 +45,7 @@ def mqtt_listener():
|
|
| 45 |
|
| 46 |
client = mqtt.Client()
|
| 47 |
client.connect(mqtt_broker, mqtt_port)
|
| 48 |
-
|
| 49 |
|
| 50 |
# اشترك في كل الردود
|
| 51 |
for tl_id in state.singlas_state.keys():
|
|
@@ -73,9 +73,13 @@ def mqtt_publisher_loop(tl_id):
|
|
| 73 |
last_state = current_state
|
| 74 |
|
| 75 |
'''
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
time.sleep(.01)
|
| 81 |
|
|
|
|
| 45 |
|
| 46 |
client = mqtt.Client()
|
| 47 |
client.connect(mqtt_broker, mqtt_port)
|
| 48 |
+
|
| 49 |
|
| 50 |
# اشترك في كل الردود
|
| 51 |
for tl_id in state.singlas_state.keys():
|
|
|
|
| 73 |
last_state = current_state
|
| 74 |
|
| 75 |
'''
|
| 76 |
+
print(current_state)
|
| 77 |
+
if current_state != last_state:
|
| 78 |
+
if current_state != state.status_free:
|
| 79 |
+
topic = topic_msg(tl_id)
|
| 80 |
+
pub_client.publish(topic, current_state)
|
| 81 |
+
last_state = current_state
|
| 82 |
+
|
| 83 |
|
| 84 |
time.sleep(.01)
|
| 85 |
|