Home-AssistantConfig/config/automation/master_bath_accents.yaml

43 lines
1.5 KiB
YAML
Executable File

#####################################################################################
### When we get out of bed at night, turn on the accent lights in the bathroom
## and then turn off the lights when we are back in bed.
## Also turn on the lights sunset comes. (but only if we are home)
### connected to [Etekcity Outlets](https://amzn.to/2efNoBP)
## [433Mhz Transmitter and receiver](https://amzn.to/2dceNY2)
#####################################################################################
- alias: Bedtime Accent Light
id: 08fe7b86-7610-420a-8f4c-7adb86618900
trigger:
- platform: state
entity_id:
- binary_sensor.sleepnumber_carlo_carlo_is_in_bed
- binary_sensor.sleepnumber_carlo_stacey_is_in_bed
to: 'off'
- platform: state
entity_id: sun.sun
to: 'below_horizon'
from: 'above_horizon'
- platform: state
entity_id: group.family
from: 'not_home'
to: 'home'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: group.family
state: 'home'
action:
- service: switch.turn_on
entity_id: switch.master_bathroom_accent_1
- wait_template: >-
{{ not is_state('binary_sensor.sleepnumber_carlo_stacey_is_in_bed', 'off') or is_state('person.stacey', 'not_home')}}
- wait_template: >-
{{ not is_state('binary_sensor.sleepnumber_carlo_carlo_is_in_bed', 'off') or is_state('person.carlo', 'not_home') }}
- service: switch.turn_off
entity_id: group.master_bathroom_accents