Created
August 31, 2020 05:26
-
-
Save xbmcnut/9c78b0fadb64743fa8b4bcfbb8d82d3b to your computer and use it in GitHub Desktop.
WIP. Code that speaks which smoke sensor went off and which door to exit. Needs modifying to account for new loop feature added in 0.113.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
automation: | |
- alias: Announce Fire Alarms | |
trigger: | |
platform: state | |
entity_id: | |
# Upstairs | |
- binary_sensor.smoke_sensor_landing | |
- binary_sensor.smoke_sensor_lounge | |
# Downstairs south | |
- binary_sensor.smoke_sensor_davids_bedroom | |
- binary_sensor.smoke_sensor_gaming_lounge | |
# Downstairs north | |
- binary_sensor.smoke_sensor_entry_foyer | |
- binary_sensor.smoke_sensor_master_bedroom | |
to: 'on' | |
condition: | |
condition: and | |
conditions: | |
- condition: state | |
entity_id: alarm_control_panel.home_alarm | |
state: 'disarmed' | |
action: | |
- service: script.turn_on | |
entity_id: script.alarm_light_flash_red | |
- service: script.tts_fire_notification | |
data_template: | |
message: > | |
"The {{ trigger.from_state.attributes.friendly_name | |
}} detector has activated. Exit via the {% | |
set doors = { | |
('binary_sensor.smoke_sensor_lounge', | |
'binary_sensor.smoke_sensor_landing', | |
'binary_sensor.smoke_sensor_gaming_lounge' | |
'binary_sensor.smoke_sensor_davids_bedroom'): 'front', | |
('binary_sensor.smoke_sensor_master_bedroom', | |
'binary_sensor.smoke_sensor_entry_foyer'): 'pool'} -%} | |
{% for detectors in doors if trigger.entity_id in detectors -%} | |
{{ doors[detectors] }} | |
{%- endfor %} door" | |
- delay: '00:00:15' | |
- service: script.tts_fire_notification | |
data_template: | |
message: > | |
"The {{ trigger.from_state.attributes.friendly_name | |
}} detector has activated. Exit via the {% | |
set doors = { | |
('binary_sensor.smoke_sensor_lounge', | |
'binary_sensor.smoke_sensor_landing', | |
'binary_sensor.smoke_sensor_gaming_lounge' | |
'binary_sensor.smoke_sensor_davids_bedroom'): 'front', | |
('binary_sensor.smoke_sensor_master_bedroom', | |
'binary_sensor.smoke_sensor_entry_foyer'): 'pool'} -%} | |
{% for detectors in doors if trigger.entity_id in detectors -%} | |
{{ doors[detectors] }} | |
{%- endfor %} door" | |
- delay: '00:00:15' | |
- service: script.tts_fire_notification | |
data_template: | |
message: > | |
"The {{ trigger.from_state.attributes.friendly_name | |
}} detector has activated. Exit via the {% | |
set doors = { | |
('binary_sensor.smoke_sensor_lounge', | |
'binary_sensor.smoke_sensor_landing', | |
'binary_sensor.smoke_sensor_gaming_lounge' | |
'binary_sensor.smoke_sensor_davids_bedroom'): 'front', | |
('binary_sensor.smoke_sensor_master_bedroom', | |
'binary_sensor.smoke_sensor_entry_foyer'): 'pool'} -%} | |
{% for detectors in doors if trigger.entity_id in detectors -%} | |
{{ doors[detectors] }} | |
{%- endfor %} door" | |
- alias: Notify Fire Alarms | |
initial_state: true | |
trigger: | |
platform: state | |
entity_id: | |
# Upstairs | |
- binary_sensor.smoke_sensor_landing #Landing Smoke | |
- binary_sensor.smoke_sensor_lounge #Lounge Smoke | |
# Downstairs south | |
- binary_sensor.smoke_sensor_davids_bedroom #David's Bedroom Smoke | |
- binary_sensor.smoke_sensor_gaming_lounge #Rumpus Smoke | |
# Downstairs north | |
- binary_sensor.smoke_sensor_entry_foyer #Entry Foyer Smoke | |
- binary_sensor.smoke_sensor_master_bedroom #Master Bedroom Smoke | |
to: 'on' | |
action: | |
- service: notify.hass_synochat | |
data_template: | |
message: "The {{ trigger.from_state.attributes.friendly_name }} Detector activated at {{states('sensor.time')}}" | |
- service: notify.clickatell_pete | |
data_template: | |
message: "The {{ trigger.from_state.attributes.friendly_name }} Detector activated at {{states('sensor.time')}}" | |
- service: notify.clickatell_ali | |
data_template: | |
message: "The {{ trigger.from_state.attributes.friendly_name }} Detector activated at {{states('sensor.time')}}" | |
script: | |
tts_fire_notification: | |
alias: 'Fire notifications on Google Homes' | |
sequence: | |
# Put some appropriate condition here that allows | |
# the message to continue to be repeated | |
# - condition: ... | |
- service: media_player.volume_set | |
data: | |
entity_id: | |
- media_player.kitchen_home | |
# - media_player.gaming_room_home | |
- media_player.ensuite_speaker | |
- media_player.bathroom_speaker | |
- media_player.ali_office_mini | |
- media_player.lounge_home | |
volume_level: '0.90' | |
- service: tts.google_say | |
entity_id: | |
- media_player.kitchen_home | |
# - media_player.gaming_room_home | |
- media_player.ensuite_speaker | |
- media_player.bathroom_speaker | |
- media_player.ali_office_mini | |
- media_player.lounge_home | |
data_template: | |
message: "{{ message }}" | |
cache: false | |
- delay: 00:00:10 | |
- service: media_player.volume_set | |
data: | |
entity_id: | |
- media_player.kitchen_home | |
# - media_player.gaming_room_home | |
- media_player.ensuite_speaker | |
- media_player.bathroom_speaker | |
- media_player.ali_office_mini | |
- media_player.lounge_home | |
volume_level: '0.50' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment