本帖最后由 aktifin 于 2020-12-31 21:39 编辑
首先感谢syssi大神和27hh版主的插件,暂时将米家纯净加湿器通过xiaomi_miot_raw曲线接入了HASS,syssi大神的插件版估计也快了
插件地址:https://bbs.hassbian.com/thread-11749-1-1.html
代码如下:
switch:
- platform: xiaomi_miot_raw
name: Mi Smart Evaporative Humidifer
host: 192.168.xxx.xxx
token: xxxxxx
turn_on_command: 'set_properties'
turn_on_parameters: '{"did":"yourdid","siid":2,"piid":1,"value":true}'
turn_off_command: 'set_properties'
turn_off_parameters: '{"did":"yourdid","siid":2,"piid":1,"value":false}'
state_property:
did: SwitchStatus
siid: 2
piid: 1
state_property_getter: 'get_properties'
state_on_value: True
state_off_value: False
sensor:
- platform: xiaomi_miot_raw
name: Mi Smart Evaporative Humidifer
host: 192.168.xxx.xxx
token: xxxxxxx
# Optional and device specific config parameters
sensor_property: 'humidity'
sensor_unit: '%'
default_properties_getter: 'get_properties'
default_properties:
- did: humidity
siid: 3
piid: 1
- did: temperature
siid: 3
piid: 7
- did: status
siid: 2
piid: 2
- did: fan
siid: 2
piid: 5
- platform: template
sensors:
jsqhumidity:
friendly_name: '加湿器湿度'
unique_id: xxxxx-humidity
icon_template: mdi:water-percent
value_template: "{{ state_attr('sensor.mi_smart_evaporative_humidifer','humidity') }}%"
jsqtemp:
friendly_name: '加湿器温度'
icon_template: mdi:temperature-celsius
unique_id: xxxxx-temp
value_template: "{{ state_attr('sensor.mi_smart_evaporative_humidifer','temperature') }}°C"
jsqstatus:
friendly_name: '加湿器状态'
unique_id: xxxxx-status
icon_template: >-
{% if state_attr('sensor.mi_smart_evaporative_humidifer','status') == 0 %}mdi:check
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','status') == 1 %}mdi:water-off
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','status') == 2 %}mdi:alert
{% endif %}
value_template: >
{% if state_attr('sensor.mi_smart_evaporative_humidifer','status') == 0 %}正常
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','status') == 1 %}缺水
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','status') == 2 %}机体分离
{% endif %}
jsqfan:
friendly_name: '加湿器风速'
unique_id: xxxxx-fan
icon_template: >-
{% if state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 1 %}mdi:speedometer-slow
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 2 %}mdi:speedometer
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 3 %}mdi:speedometer-medium
{% endif %}
value_template: >
{% if state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 1 %}1级
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 2 %}2级
{% elif state_attr('sensor.mi_smart_evaporative_humidifer','fan') == 3 %}恒湿
{% endif %}
lovelace卡片:
type: glance
entities:
- entity: switch.mi_smart_evaporative_humidifer
tap_action:
action: toggle
- entity: sensor.jsqstatus
- entity: sensor.jsqfan
- entity: sensor.jsqhumidity
- entity: sensor.jsqtemp
title: 加湿器
columns: 5
state_color: true
|