- 积分
- 499
- 金钱
- 402
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 499
- 金钱
- 402
- HASS币
- 0
|
发表于 2018-9-6 19:58:03
|
显示全部楼层
将两个自动化合并成一个。两个人体感应各自开关都将触发自动化,其中哪一个状态ON都会开灯,两个状态同时为OFF时关灯
- alias: Turn off light 3 minutes after last movement
initial_state: true
trigger:
- platform: state
entity_id:
- binary_sensor.motion_sensor_xxxxx
- binary_sensor.motion_sensor_yyyyy
action:
- service: script.turn_on
data_template:
entity_id: >
{% if is_state('binary_sensor.motion_sensor_xxxxx', 'on') or is_state('binary_sensor.motion_sensor_yyyyy', 'on') %}
switch.toilet_light
{% endif %}
- service: script.turn_off
data_template:
entity_id: >
{% if is_state('binary_sensor.motion_sensor_xxxxx', 'off') and is_state('binary_sensor.motion_sensor_yyyyy', 'off') %}
switch.toilet_light
{% endif %} |
|