Files
fresh-home/automations/people/bedtime_something_open.yaml
T
2025-07-26 21:35:14 -04:00

43 lines
1.3 KiB
YAML

alias: 'Bedtime something open'
id: automation_bedtime_something_open
mode: restart
trigger:
- platform: state
entity_id: input_boolean.clint_is_awake
to: 'off'
condition:
condition: and
conditions:
# We're both in bed
- condition: state
entity_id: input_boolean.clint_is_awake
state: 'off'
- condition: state
entity_id: binary_sensor.something_open
state: 'on'
- condition: state
entity_id: binary_sensor.impending_rain
state: 'on'
action:
- service: media_player.turn_on
data_template:
entity_id: media_player.master_bedroom_clock
- service: media_player.volume_set
data_template:
volume_level: 0.30
entity_id: media_player.master_bedroom_clock
- action: tts.speak
target:
entity_id: tts.google_translate_en_com
data:
media_player_entity_id: media_player.master_bedroom_clock
message: >-
The following are open:
{{ dict((states|selectattr('entity_id', 'in', state_attr('group.my_exterior_windows', 'entity_id') + state_attr('group.my_exterior_doors', 'entity_id'))|list)|groupby('state'))['on']|map(attribute='name')|list|join(', ') }}
- delay: '00:01:00'
- service: media_player.turn_off
data:
entity_id: media_player.master_bedroom_clock