This commit is contained in:
xyj 2023-12-07 18:28:24 +08:00
parent a2b5268c69
commit 5f4b7fc91a
7 changed files with 8 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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()