|
发表于 2022-6-17 11:18:41
|
显示全部楼层
感谢,参考这个我把型号是 DYD-G25A3 的德业除湿机接上了,很方便
switch:
platform: mqtt
name: deye
unique_id: deye_switch
state_topic: ff753**************/8d52bc*********21/be062***********09/status/hex
command_topic: ff75***********/8d52***********/b**********009/command/hex
state_on: "8" #开机
state_off: "0" #关机或待机
value_template: "{{ value_json.data[4:5] }}"
payload_on: "\x08\x02\x01\x30\x3c\x00\x00\x00\x00\x00" #(这是G25A3的控制码,开机,高风,湿度3C=60)
payload_off: "\x08\x02\x00\x30\x3c\x00\x00\x00\x00\x00" #(这是G25A3的控制码,关机)
sensor:
- platform: mqtt
name: deye_target_humidity
state_topic: 'ff7534c***************/8d52bc78f385*************/be062f9cb*********/status/hex'
device_class: humidity
unit_of_measurement: '%'
value_template: "{{value_json.data[10:12]|int(0,16)}}"
- platform: mqtt
name: deye_humidity
state_topic: 'ff7534c***************/8d52bc78f385*************/be062f9cb*********/status/hex' device_class: humidity
unit_of_measurement: '%'
value_template: "{{value_json.data[32:34]|int(0,16)}}"
- platform: mqtt
name: deye_temperature
state_topic: 'ff7534c***************/8d52bc78f385*************/be062f9cb*********/status/hex'
device_class: temperature
unit_of_measurement: °C
value_template: "{{value_json.data[30:32]|int(0,16) - 40 }}"
- platform: mqtt
name: deye_fan
state_topic: 'ff7534c***************/8d52bc78f385*************/be062f9cb*********/status/hex'
value_template: >-
{% if value_json.data[8:9] == '1'%}
低
{% else%}
高
{% endif %}
- platform: mqtt
name: deye_waterfull
state_topic: 'ff7534c***************/8d52bc78f385*************/be062f9cb*********/status/hex'
value_template: >-
{% if value_json.data[4:5] == '4'%}
水满
{% else%}
正常
{% endif %}
homeassistant:
customize:
switch.deye:
friendly_name: 除湿
sensor.deye_target_humidity:
friendly_name: 设置湿度
sensor.deye_humidity:
friendly_name: 湿度
sensor.deye_temperature:
friendly_name: 温度
sensor.deye_fan:
friendly_name: 风速
sensor.deye_waterfull:
friendly_name: 水满
|
|