diff --git a/bash/modify_device_name.sh b/bash/modify_device_name.sh new file mode 100644 index 0000000..3f6b7d5 --- /dev/null +++ b/bash/modify_device_name.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm /home/pi/device_name +cp ../conf/tmp/device_name /home/pi \ No newline at end of file diff --git a/conf/device/device.conf b/conf/device/device.conf index 27e0530..5cf1490 100644 --- a/conf/device/device.conf +++ b/conf/device/device.conf @@ -1,47 +1,48 @@ # 设备1 -[lot_mqtt_device1] +# 编号 +[lihai_lot_walnutpi_dev_1] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device1 +subscribe_topic=lihai_lot_walnutpi_dev_1 # 发布消息的主题 publish_topic=device1 username=demo password=123456 #################################### -[lot_mqtt_device2] +[lihai_lot_walnutpi_dev_2] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device2 +subscribe_topic=lihai_lot_walnutpi_dev_2 # 发布消息的主题 publish_topic=device2 username=demo password=123456 #################################### -[lot_mqtt_device3] +[lihai_lot_walnutpi_dev_3] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device3 +subscribe_topic=lihai_lot_walnutpi_dev_3 # 发布消息的主题 publish_topic=device3 username=demo password=123456 #################################### -[lot_mqtt_device4] +[lihai_lot_walnutpi_dev_4] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device4 +subscribe_topic=lihai_lot_walnutpi_dev_4 # 发布消息的主题 publish_topic=device4 username=demo password=123456 #################################### -[lot_mqtt_device5] +[lihai_lot_walnutpi_dev_5] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device5 +subscribe_topic=lihai_lot_walnutpi_dev_5 # 发布消息的主题 publish_topic=device5 username=demo password=123456 #################################### -[lot_mqtt_device6] +[lihai_lot_walnutpi_dev_6] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=lot_mqtt_device6 +subscribe_topic=lihai_lot_walnutpi_dev_6 # 发布消息的主题 publish_topic=device6 username=demo diff --git a/conf/tmp/device_name b/conf/tmp/device_name new file mode 100644 index 0000000..cb0d5b6 --- /dev/null +++ b/conf/tmp/device_name @@ -0,0 +1 @@ +lihai_lot_walnutpi_dev_1 \ No newline at end of file diff --git a/sensor_to_server.py b/sensor_to_server.py index b511b5b..846aa14 100755 --- a/sensor_to_server.py +++ b/sensor_to_server.py @@ -233,7 +233,7 @@ def on_connect(client, userdata, flags, rc): if __name__ == '__main__': - print(broker, port, subscribe_topic, publish_topic, username, password) + # print(broker, port, subscribe_topic, publish_topic, username, password) # 千万不要指定client_id 不然死翘翘!!! client = mqtt.Client() client.username_pw_set(username, password)