From e2239580fbdf1ccc691feaff7c437a413955fb0f Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Thu, 25 Jan 2024 16:59:52 +0800 Subject: [PATCH] update --- MQTT.py | 1 - conf/device/device.conf | 6 +++--- conf/device/device_name_write.sh | 6 ++++++ conf/tmp/device_name | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 conf/device/device_name_write.sh delete mode 100644 conf/tmp/device_name diff --git a/MQTT.py b/MQTT.py index dd27273..b232d8d 100644 --- a/MQTT.py +++ b/MQTT.py @@ -30,7 +30,6 @@ class MQTTClient: def on_connect(self, client, userdata, flags, rc): if rc == 0: - print("连接成功") self.client.subscribe(self.topic) client.publish(info_topic, payload=publish_payload(code=200, msg='成功订阅' + self.topic), qos=0) diff --git a/conf/device/device.conf b/conf/device/device.conf index ba28b3b..03070cb 100644 --- a/conf/device/device.conf +++ b/conf/device/device.conf @@ -1,7 +1,7 @@ # 编号 -[xumu_d001] +[xumu_user1] # 订阅的控制主题,必须和系统设置的相同 -subscribe_topic=xumu_d001 -info_topic=info_xumu_d001 +subscribe_topic=xumu_user1 +info_topic=info_xumu_user1 username=lihai_lot_land_1 password=lihai_lot_land_1 \ No newline at end of file diff --git a/conf/device/device_name_write.sh b/conf/device/device_name_write.sh new file mode 100644 index 0000000..e8335ee --- /dev/null +++ b/conf/device/device_name_write.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +# shellcheck disable=SC2164 +cd /home/pi +device=xumu_user1 +echo $device | tee device_name \ No newline at end of file diff --git a/conf/tmp/device_name b/conf/tmp/device_name deleted file mode 100644 index c5f9fd6..0000000 --- a/conf/tmp/device_name +++ /dev/null @@ -1 +0,0 @@ -xumu_d001 \ No newline at end of file