This commit is contained in:
xyj 2023-12-07 18:54:45 +08:00
parent e1b856c3a7
commit 44eb888d51
1 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ def on_message(client, userdata, msg):
# print("验证通过") # print("验证通过")
import os import os
# device_name = os.environ['device_name'] # device_name = os.environ['device_name']
# client.publish('error', payload=device_name, qos=0) client.publish('error', payload=device_name, qos=0)
# client.publish('success', payload='验证通过', qos=0) # client.publish('success', payload='验证通过', qos=0)
try: try:
origin_data = json.loads(msg.payload.decode('utf-8')) origin_data = json.loads(msg.payload.decode('utf-8'))
@ -69,8 +69,9 @@ times = 120
def exec_shutdown(): def exec_shutdown():
pass pass
import os
if __name__ == '__main__': if __name__ == '__main__':
device_name = os.environ.get('device_name')
while True: while True:
try: try:
client = mqtt.Client(client_id='s') client = mqtt.Client(client_id='s')