|
@@ -58,13 +58,13 @@ class Client(mqtt.Client):
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
-
|
|
|
- c1 = Client(host='192.168.131.23', port=41883)
|
|
|
+
|
|
|
+ c1 = Client(host='127.0.0.1', port=41883)
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ def m1(_, __, p3):
|
|
|
+ print(f"#message.payload: {json.loads(p3.payload)}")
|
|
|
+ c1.start_subscribe_loop(decorate_method=m1, subscribe_topic='bg/log')
|
|
|
|
|
|
|
|
|
|
|
@@ -79,11 +79,11 @@ if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
- while True:
|
|
|
- data = {
|
|
|
- 'address': "192.168.131.180",
|
|
|
- 'state': 2,
|
|
|
- 'direction': 22,
|
|
|
- }
|
|
|
- c1.publish_message('hs/vehicle/state', json.dumps(data))
|
|
|
- time.sleep(3)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|