update
This commit is contained in:
parent
44eb888d51
commit
00a58c9e7e
7
MQTT.py
7
MQTT.py
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue