一直都是不知道hassio 是如何传东西到HomeKit的
本来显示个天气什么的就算了
今天设置DC1插排后出现了如图所示情况。
例如开关1和DC1_s1其实是同一个功能的开关。但是显示了两个,设置的代码如下。
我看见最后一个是 hide 好像是隐藏那个按钮的,但是好像这个功能没有生效,如果有大神希望帮忙解释一下!!!
谢谢!!!‘
switch:
- platform: phicomm_dc1m
name: dc1
hidden: true
ip: "192.168.2.153"
ports: {'1':'dc1_s1','2':'dc1_s2','3':'dc1_s3'}
- platform: template
switches:
dc1_template:
friendly_name: 总开关
value_template: "{{ is_state('switch.dc1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1
dc1_s1_template:
friendly_name: 插口1
value_template: "{{ is_state('switch.dc1_s1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s1
dc1_s2_template:
friendly_name: 插口2
value_template: "{{ is_state('switch.dc1_s2', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s2
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s2
dc1_s3_template:
friendly_name: 插口3
value_template: "{{ is_state('switch.dc1_s3', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s3
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s3
sensor:
- platform: template
sensors:
dc1_v:
friendly_name: 当前电压
value_template: "{{ states.switch.dc1.attributes.v }}"
unit_of_measurement: V
dc1_p:
friendly_name: 当前功率
value_template: "{{ states.switch.dc1.attributes.p }}"
unit_of_measurement: W
# dc1_totale:
# friendly_name: 累计用电
# value_template: "{{ states.switch.dc1.attributes.totalelect }}"
# unit_of_measurement: 度
group:
dc1:
name: DC1
view: no
entities:
- sensor.dc1_v
- sensor.dc1_p
#- sensor.dc1_totale
- switch.dc1_template
- switch.dc1_s1_template
- switch.dc1_s2_template
- switch.dc1_s3_template
homeassistant:
customize:
# Add an entry for each entity that you want to overwrite.
switch.dc1:
hidden: true
switch.dc1_s1:
hidden: true
switch.dc1_s2:
hidden: true
switch.dc1_s3:
hidden: true
复制代码