def mqtt_pub_air_con(data):
# {'node_select': 2, 'wind_speed': 2, 'temp_setting': 28, 'wind_directtion': 1, 'switch': 1, 'working_model': 1}
node_addr = bitstring.pack('uint:13',data['node_select']).bin
wind_direct = bitstring.pack('uint:2',data['wind_directtion']).bin
wind_speed = bitstring.pack('uint:2',data['wind_speed']).bin
on_off = bitstring.pack('uint:2',data['switch']).bin
work_mode = bitstring.pack('uint:3',data['working_model']).bin
temp = bitstring.pack('uint:5',data['temp_setting']).bin
str_bin = return_str_bin(node_addr, wind_direct, wind_speed, on_off, work_mode, temp)
str_bytes = return_air_con_mqtt_str_bytes_to_send(str_bin)
transmitMQTT(str_bytes)
评论列表
文章目录