1
0
ansible-home-assistant/roles/automations/files/bathroom-lights.yaml

67 lines
1.8 KiB
YAML

- id: button_lights_on
alias: '[Bathroom] Lights On'
trigger:
- platform: state
entity_id: binary_sensor.bathroom_motion_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.bathroom_door_open_close
to: 'on'
action:
- service: script.bathroom_lights_on
mode: single
- id: bathroom_lights_off
alias: '[Bathroom] Lights Off'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.bathroom_motion_occupancy
for: '0:05:00'
from: 'on'
to: 'off'
- platform: state
entity_id: binary_sensor.bathroom_shower_sensor_motion
for: '0:02:00'
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.bathroom_motion_occupancy
for: '0:05:00'
state: 'off'
- condition: state
entity_id: binary_sensor.bathroom_shower_sensor_motion
for: '0:02:00'
state: 'off'
action:
- service: script.bathroom_lights_off
- id: button_bathroom_on_off
alias: '[Bathroom] Button On/Off'
mode: single
trigger:
- device_id: 36bf09a72c8115dd3afd832e83cf38ea
domain: zha
platform: device
type: remote_button_alt_short_press
subtype: button_1
- device_id: 36bf09a72c8115dd3afd832e83cf38ea
domain: zha
platform: device
type: remote_button_alt_short_press
subtype: button_2
action:
- choose:
- conditions:
- condition: state
entity_id: light.bathroom_lights
state: 'on'
sequence:
- service: automation.turn_on
target:
entity_id:
- automation.bathroom_shower_motion_off
- automation.bathroom_lights_off
- service: script.bathroom_lights_toggle