This commit is contained in:
xyj 2023-12-07 09:27:37 +08:00
parent 28cdd733bc
commit 24be9201aa
2 changed files with 184 additions and 177 deletions

View File

@ -13,6 +13,7 @@ def on_connect(client, userdata, flags, rc):
# Message receiving callback
def on_message(client, userdata, msg):
try:
data = json.loads(msg.payload.decode('utf-8'))["msg"]
if data == "push_stream":
# 启动推流视频
@ -38,6 +39,8 @@ def on_message(client, userdata, msg):
else:
# 错误类型
client.publish('success', payload='No Such Type', qos=0)
except Exception as e:
pass
times = 120

View File

@ -35,6 +35,7 @@ def t():
windspeed_send = bytes.fromhex(windspeed_send)
winddirection_send = bytes.fromhex(winddirection_send)
while True:
try:
# if ser.is_open:
ser.write(temp_send)
time.sleep(1)
@ -187,6 +188,9 @@ def t():
t2 = LOT_DATA(**data)
client.publish('demo', payload=json.dumps(data, ensure_ascii=False), qos=0)
add(t2)
except Exception as e:
print(e)
pass
def on_connect(client, userdata, flags, rc):