Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Bathroom Lights
- description: ''
- trigger:
- - platform: template
- value_template: >-
- {{ states.binary_sensor.bathroom_motion_1.state == 'on' or
- states.binary_sensor.bathroom_motion_2.state == 'on' }}
- id: Occupied
- - platform: template
- value_template: >-
- {{ states.binary_sensor.bathroom_motion_1_occupancy.state == 'off' and
- states.binary_sensor.bathroom_motion_2_occupancy.state == 'off' }}
- id: Unoccupied
- - type: opened
- platform: device
- device_id: cf384d7c10de3db58ce79ae585476390
- entity_id: binary_sensor.bathroom_door
- domain: binary_sensor
- id: Door Opened
- - type: not_opened
- platform: device
- device_id: cf384d7c10de3db58ce79ae585476390
- entity_id: binary_sensor.bathroom_door
- domain: binary_sensor
- id: Door Closed
- condition: []
- action:
- - choose:
- - conditions:
- - condition: trigger
- id: Occupied
- sequence:
- - service: switch.turn_on
- target:
- area_id: bathroom
- - conditions:
- - condition: trigger
- id: Door Opened
- sequence:
- - service: switch.turn_on
- target:
- area_id: bathroom
- - conditions:
- - condition: trigger
- id: Unoccupied
- sequence:
- - service: switch.turn_off
- target:
- area_id: bathroom
- - conditions:
- - condition: trigger
- id: Door Closed
- sequence:
- - wait_for_trigger:
- - platform: template
- value_template: >-
- {{ states.binary_sensor.bathroom_motion_1.state == 'off' and
- states.binary_sensor.bathroom_motion_2.state == 'off' }}
- timeout: '00:02:00'
- continue_on_timeout: false
- - service: switch.turn_off
- target:
- area_id: bathroom
- default: []
- mode: single
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement