本帖最后由 tty228 于 2022-4-9 20:07 编辑
我这里是衣柜门都装着门窗传感器
需要最后一扇门关掉之后再关灯
重点设置是
“重启模式”
等待模板为真
{{states("binary_sensor.0x158d0007103a08_contact") in ('unknown', 'off')}}
关灯
alias: 3.自动开关 - 衣帽间灯 - 重启模式
description: 避免门窗从未打开时,状态为未知
trigger:
- type: opened
platform: device
device_id: 9f233e1d535096916e0a9b611d07b7ac
entity_id: binary_sensor.0x158d0007e05065_contact
domain: binary_sensor
- type: opened
platform: device
device_id: a90af068255cf1f34ddae96ca471d3da
entity_id: binary_sensor.0x158d0007e30a60_contact
domain: binary_sensor
- type: opened
platform: device
device_id: 3a31e5b22124e5c5ce03354b8823d1cb
entity_id: binary_sensor.0x158d0007e58c1d_contact
domain: binary_sensor
- type: opened
platform: device
device_id: 77b6a06d6cb72572ea36b971a7031522
entity_id: binary_sensor.0x158d0007103a08_contact
domain: binary_sensor
- type: opened
platform: device
device_id: ab0867319b330e2efde6d918d33c51d4
entity_id: binary_sensor.0x158d00079add06_contact
domain: binary_sensor
condition: []
action:
- type: turn_on
device_id: 007ed758f958b8aaaedf4429b5d949db
entity_id: switch.0x158d0006f0ba4c_channel_2
domain: switch
- wait_template: '{{states("binary_sensor.0x158d0007103a08_contact") in (''unknown'', ''off'')}}'
- wait_template: '{{states("binary_sensor.0x158d00079add06_contact") in (''unknown'', ''off'')}}'
- wait_template: '{{states("binary_sensor.0x158d0007e30a60_contact") in (''unknown'', ''off'')}}'
- wait_template: '{{states("binary_sensor.0x158d0007e05065_contact") in (''unknown'', ''off'')}}'
- wait_template: '{{states("binary_sensor.0x158d0007e58c1d_contact") in (''unknown'', ''off'')}}'
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- type: turn_off
device_id: 007ed758f958b8aaaedf4429b5d949db
entity_id: switch.0x158d0006f0ba4c_channel_2
domain: switch
mode: restart
还可以这样
|