Files
fresh-home/automations/people/bedtime_something_open.yaml
T
2025-11-14 16:46:44 -05:00

36 lines
1.1 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:
- action: media_player.volume_set
data_template:
volume_level: 0.30
entity_id: media_player.ma_home_assistant_voice_097b44_media_player
- action: tts.speak
target:
entity_id: tts.google_translate_en_com
data:
media_player_entity_id: media_player.ma_home_assistant_voice_097b44_media_player
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(', ') }}