本帖最后由 southward 于 2021-6-16 20:40 编辑
sensor:
- platform: xiaomi_miio_raw
name: reshuiqi
host: 192.168.51.162
token:
# Optional and device specific config parameters
sensor_property: "power"
sensor_unit: "watt"
switch:
- platform: template
switches:
reshuiqi_switch:
unique_id: reshuiqi_switch
value_template: "{{ state_attr('sensor.reshuiqi_props_2'),'on' }}"
turn_on:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.reshuiqi_props_2
method: set_properties
params:
- did: on
siid: 2
piid: 1
value: True
turn_off:
service: xiaomi_miio_raw.sensor_raw_command
data:
entity_id: sensor.reshuiqi_props_2
method: set_properties
params:
- did: on
siid: 2
piid: 1
value: False
用python miio命令行能够正常开关和获取开关状态,但是lovalace里面打开后直接显示为关闭状态,获取不到开关当前状态,无法关闭开关
猜测可能是没有正确获取到开关状态导致
已经用大佬的miot插件正常接入,想折腾学习一下,希望各位大佬指点指点
|