本帖最后由 jyz_0501 于 2018-10-22 11:44 编辑
我的配置如下:
cover:
- platform: template
covers:
gd_north_temp:
friendly_name: '北门'
value_template: "{% if not is_state('binary_sensor.door_window_sensor_158d000200b315_2', 'off') %}open{% else %}closed{% endif %}"
open_cover:
service: script.turn_on
entity_id: script.garage_north_open
close_cover:
service: script.turn_on
entity_id: script.garage_north_close
stop_cover:
service: cover.stop_cover
entity_id: cover.garage_north
icon_template: "{% if not is_state('binary_sensor.door_window_sensor_158d000200b315_2', 'off') %}mdi:garage-open{% else %}mdi:garage{% endif %}"
group:
NorthGD:
name: 卷帘门北门
view: no
entities:
- cover.garage_north
- cover.gd_north_temp
- binary_sensor.door_window_sensor_158d000200b315_2
- script.garage_north_open
- script.garage_north_close
homeassistant:
customize:
cover.gd_north_temp:
# homebridge_name: 北门
# homebridge_hidden: true
device_class: garage
本来想用template 做状态同步呢,但是还是有点不同步,有时候用siri喊 关闭车库北门的时候,在家庭应用中,明明车库门是关着的,还是会执行一次关闭脚本,这样导致了家庭中的配件一直显示“正在关闭”而不是“已关上”,或者不执行关闭脚本。
所以我想是否在script.turn_on 这个服务这里加一个判断,如果门磁传感器状态为off,就不执行,如果状态为on,才会执行。
|