This commit is contained in:
xyj 2023-12-07 18:58:36 +08:00
parent 44eb888d51
commit 00a58c9e7e
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import json
import subprocess
import time
import paho.mqtt.client as mqtt
@ -69,9 +70,13 @@ times = 120
def exec_shutdown():
pass
import os
if __name__ == '__main__':
device_name = os.environ.get('device_name')
p = subprocess.Popen(['cat /home/pi/device_name'], shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
out, err = p.communicate()
device_name = out.decode('utf-8')
while True:
try:
client = mqtt.Client(client_id='s')