mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-10 02:50:12 -04:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -2,19 +2,19 @@ alias: House alert
|
||||
sequence:
|
||||
- action: media_player.turn_on
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
- action: media_player.volume_set
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
volume_level: 0.5
|
||||
- action: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
media_content_id: http://192.168.1.11:8123/local/audio/alarms/Alarm_Clock.mp3
|
||||
media_content_type: music
|
||||
- delay: "00:00:10"
|
||||
# Wait for it to stop playing (5 second audio clip)
|
||||
- wait_template: "{{ is_state('media_player.master_bedroom_clock','idle') }}"
|
||||
- wait_template: "{{ is_state('media_player.bedroom_hub','idle') }}"
|
||||
timeout: "00:00:06"
|
||||
continue_on_timeout: "true"
|
||||
# Send an audio alert
|
||||
@@ -22,15 +22,15 @@ sequence:
|
||||
target:
|
||||
entity_id: tts.google_translate_en_com
|
||||
data:
|
||||
media_player_entity_id: media_player.master_bedroom_clock
|
||||
media_player_entity_id: media_player.bedroom_hub
|
||||
message: >-
|
||||
{{ (expand('binary_sensor.exterior_doors') | selectattr('state', 'eq', 'off')) | map(attribute='name') | list }}
|
||||
- delay: "00:00:02"
|
||||
# Wait for it to stop playing (2 minute timeout)
|
||||
- wait_template: "{{ is_state('media_player.master_bedroom_clock','idle') }}"
|
||||
- wait_template: "{{ is_state('media_player.bedroom_hub','idle') }}"
|
||||
timeout: "00:02:00"
|
||||
continue_on_timeout: "true"
|
||||
# Turn off the media players
|
||||
- action: media_player.turn_off
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
|
||||
Reference in New Issue
Block a user