From 84bb4a99a04c7818cbeb257975f017f06ca4a1ac Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Wed, 13 Dec 2023 17:56:15 +0800 Subject: [PATCH] update --- sensor_to_server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sensor_to_server.py b/sensor_to_server.py index 28139f7..8408bfb 100755 --- a/sensor_to_server.py +++ b/sensor_to_server.py @@ -164,9 +164,12 @@ def get_data(): # print('返回的数据2进制:', return_data) # 二进制转换为16进制:010304010802307b79 return_data_hex = str(return_data.hex()) - print('返回的数据转换为16进制:', return_data_hex) + # print('返回的数据转换为16进制:', return_data_hex) # print("当前风向为:", int(return_data_hex[10:14], 16) ) #单位mm - winddirection_data = int(return_data_hex[6:10], 16) / 10 + if subscribe_topic == 'lihai_lot_walnutpi_dev_6': + winddirection_data = int(return_data_hex[10:14], 16) + else: + winddirection_data = int(return_data_hex[6:10], 16) / 10 time.sleep(5) # print('{"name":"%d","name1":"%d"}', 123,456) # data = [{'ngvhgv': airtemp_data}, {'nvjgvjvj':airhumi_data}]