我原来客厅有个人体存在传感器,每次人离开超过4分钟后会自动关灯,对应的自动化脚本如下。由于客厅比较大而且有拐角,人体存在传感器无法完全覆盖到,有时会出现人还在,但传感器显示无人导致灯被关闭的尴尬情景。
为此我又增加了一个人体存在传感器(假定为binary_sensor.dced838exxxx_occupancy),要实现两个人体传感器均无人超过4分钟后关闭客厅灯,如果用一个自动化来实现要怎么写。
alias: 客厅无人自动关灯
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.dced838e6f31_occupancy
from: "on"
to: "off"
for:
hours: 0
minutes: 4
seconds: 0
condition: []
action:
- service: switch.turn_off
data: {}
target:
device_id:
- 9e8629eadcd9d3164b3afe8bee29afa5
mode: single
|