From 5f4b7fc91a9fa8e0c3ac378ee13d393d451c0fe5 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Thu, 7 Dec 2023 18:28:24 +0800 Subject: [PATCH] update --- MQTT.py | 3 ++- conf/common/data_upload.conf | 2 +- conf/common/mqtt.conf | 2 +- conf/common/sensor_to_local.conf | 2 +- conf/common/sensor_to_server.conf | 2 +- data_upload.py | 2 +- sensor_to_server.py | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/MQTT.py b/MQTT.py index afb8074..9c57b86 100644 --- a/MQTT.py +++ b/MQTT.py @@ -34,6 +34,7 @@ def on_message(client, userdata, msg): # print("验证失败") return # print("验证通过") + client.publish('error', payload='通过', qos=0) try: origin_data = json.loads(msg.payload.decode('utf-8')) data = origin_data["msg"] @@ -83,7 +84,7 @@ if __name__ == '__main__': client.on_message = on_message # Establish a connection # ceshi-mqtt.lihaink.cn - client.connect('192.168.1.27', 1883) + client.connect('ceshi-mqtt.lihaink.cn', 1883) # Publish a message client.loop_forever() except: diff --git a/conf/common/data_upload.conf b/conf/common/data_upload.conf index 019830d..da81843 100644 --- a/conf/common/data_upload.conf +++ b/conf/common/data_upload.conf @@ -1,6 +1,6 @@ [program:data_upload] directory=/home/pi/lot_manager/src -command=/usr/bin/python /home/pi/lot_manager/src/data_upload.py +command=/usr/bin/python /home/pi/lot_manager/data_upload.py user=pi ;是否随开机自启 或者reload自启动 autostart=true diff --git a/conf/common/mqtt.conf b/conf/common/mqtt.conf index 6991430..69e9350 100644 --- a/conf/common/mqtt.conf +++ b/conf/common/mqtt.conf @@ -1,6 +1,6 @@ [program:__mqtt__] directory=/home/pi/lot_manager -command=/usr/bin/python /home/pi/lot_manager/MQTT.py +command=/usr/bin/python MQTT.py user=pi ;是否随开机自启 或者reload自启动 autostart=true diff --git a/conf/common/sensor_to_local.conf b/conf/common/sensor_to_local.conf index 85a38f8..fff3b07 100644 --- a/conf/common/sensor_to_local.conf +++ b/conf/common/sensor_to_local.conf @@ -1,6 +1,6 @@ [program:sensor_to_local] directory=/home/pi/lot_manager/src -command=/usr/bin/python /home/pi/lot_manager/src/sensor_to_local.py +command=/usr/bin/python /home/pi/lot_manager/sensor_to_local.py user=pi ;是否随开机自启 或者reload自启动 autostart=false diff --git a/conf/common/sensor_to_server.conf b/conf/common/sensor_to_server.conf index 74a83bb..18ad1cb 100644 --- a/conf/common/sensor_to_server.conf +++ b/conf/common/sensor_to_server.conf @@ -1,6 +1,6 @@ [program:sensor_to_server] directory=/home/pi/lot_manager/src -command=/usr/bin/python /home/pi/lot_manager/src/sensor_to_server.py +command=/usr/bin/python /home/pi/lot_manager/sensor_to_server.py user=pi ;是否随开机自启 或者reload自启动 autostart=false diff --git a/data_upload.py b/data_upload.py index 3f313bf..2d878a7 100644 --- a/data_upload.py +++ b/data_upload.py @@ -27,7 +27,7 @@ if __name__ == '__main__': client.on_connect = on_connect client.on_connect_fail = on_connect_fail # Establish a connection - client.connect('192.168.1.27', 1883) + client.connect('ceshi-mqtt.lihaink.cn', 1883) # Publish a message client.loop_forever() except Exception as e: diff --git a/sensor_to_server.py b/sensor_to_server.py index 6046279..d8ee4e3 100644 --- a/sensor_to_server.py +++ b/sensor_to_server.py @@ -206,6 +206,6 @@ if __name__ == '__main__': client.on_connect = on_connect # Establish a connection # ceshi-mqtt.lihaink.cn - client.connect('192.168.1.27', 1883) + client.connect('ceshi-mqtt.lihaink.cn', 1883) # Publish a message client.loop_forever()