I am having trouble understanding how to just read certain alerts. I only want to know if my county is under a Tornado warning/watch and severe thunderstorm warning. Can i have a sensor only detect these 3 items and base notifications off that?
in addition to the examples posted above by both firstof9 and myself there are examples you can use at the github repo to modify as necessary for your needs.
2 Likes
Thank you for this. Do you mind showing me your house announcement script? I was going to do something simple with my google mini but I would like to see what is possible first.
Sure it’s pretty big but here you go:
##################################################################################################
# standard house annoucements
#
# EXAMPLE:
# play annoucement
# - service: script.house_announcement
# data:
# this_message: 'The garage door is open.'
# volume: 0.6
##################################################################################################
house_announcement:
alias: House Announcement
mode: queued
trace:
stored_traces: 20
variables:
# Available TTS: tts.piper, tts.google_cloud_say
service: tts.speak # formerally using tts.google_say
speakers: media_player.master_bedroom_home, media_player.living_room_home # default speakers to play messages on
speakers_workhrs: media_player.living_room_home
sequence:
# check if silent mode selected
- condition: template
value_template: "{% if is_state('input_boolean.night_mode','off') or priority is defined %}true{%else%}false{%endif%}"
- choose:
# Play targeted messages
- conditions:
- "{{ target is defined }}"
# - condition: template
# value_template: "{% if target is defined and 'media_player' in target %} true {% else %} false {% endif %}"
sequence:
# set the volume
- service: media_player.volume_set
data:
entity_id: "{{target}}"
volume_level: "{{volume}}"
- if:
- alias: "Speak"
condition: template
value_template: "{% if service == 'tts.speak' %}true{% else %}false{% endif %}"
then:
# play the message on google home
- service: "{{service}}"
target:
entity_id: tts.piper
data:
media_player_entity_id: "{{target}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
else:
# play the message on google home
- service: "{{service}}"
data:
entity_id: "{{target}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
# Play priority messages as they're important
- conditions:
- condition: time
after: "22:00:00"
before: "07:00:00"
- condition: template
value_template: "{{ priority }}"
sequence:
# set the volume
- service: media_player.volume_set
data:
entity_id: "{{speakers}}"
volume_level: 0.7
- if:
- alias: "Speak"
condition: template
value_template: "{% if service == 'tts.speak' %}true{% else %}false{% endif %}"
then:
# play the message on google home
- service: "{{service}}"
target:
entity_id: tts.piper
data:
media_player_entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
else:
# play the message on google home
- service: "{{service}}"
data:
entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
# Brpadcast to workday sepakers only
- conditions:
- condition: state
entity_id: binary_sensor.workday_sensor
state: "on"
- condition: time
before: "17:00:00"
after: "07:00:00"
sequence:
# wait until announcement devices have finished playing
- wait_template: "{{ (is_state('media_player.living_room_home','idle') or is_state('media_player.living_room_home','off') or is_state('media_player.living_room_home','unavailable')) }}"
# set the volume
- service: media_player.volume_set
data:
entity_id: "{{speakers_workhrs}}"
volume_level: "{{ volume }}"
- if:
- alias: "Speak"
condition: template
value_template: "{% if service == 'tts.speak' %}true{% else %}false{% endif %}"
then:
# play the message on google home
- service: "{{service}}"
target:
entity_id: tts.piper
data:
media_player_entity_id: "{{speakers_workhrs}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
else:
# play the message on google home
- service: "{{service}}"
data:
entity_id: "{{speakers_workhrs}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
# Lower volume after 20:00
- conditions:
- condition: time
after: "20:00:00"
sequence:
# wait until announcement devices have finished playing
- wait_template: "{{ (is_state('media_player.master_bedroom_home','idle') or is_state('media_player.master_bedroom_home','off') or is_state('media_player.master_bedroom_home','unavailable')) and (is_state('media_player.living_room_home','idle') or is_state('media_player.living_room_home','off') or is_state('media_player.living_room_home','unavailable')) }}"
# set the volume
- service: media_player.volume_set
data:
entity_id: "{{speakers}}"
volume_level: 0.5
- if:
- alias: "Speak"
condition: template
value_template: "{% if service == 'tts.speak' %}true{% else %}false{% endif %}"
then:
# play the message on google home
- service: "{{service}}"
target:
entity_id: tts.piper
data:
media_player_entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
else:
# play the message on google home
- service: "{{service}}"
data:
entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
default:
# wait until announcement devices have finished playing
- wait_template: "{{ (is_state('media_player.master_bedroom_home','idle') or is_state('media_player.master_bedroom_home','off') or is_state('media_player.master_bedroom_home','unavailable')) and (is_state('media_player.living_room_home','idle') or is_state('media_player.living_room_home','off') or is_state('media_player.living_room_home','unavailable')) }}"
# set the volume
- service: media_player.volume_set
data:
entity_id: "{{speakers}}"
# - media_player.kitchendisplay
volume_level: "{{ volume }}"
- if:
- alias: "Speak"
condition: template
value_template: "{% if service == 'tts.speak' %}true{% else %}false{% endif %}"
then:
# play the message on google home
- service: "{{service}}"
target:
entity_id: tts.piper
data:
media_player_entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
else:
# play the message on google home
- service: "{{service}}"
data:
entity_id: "{{speakers}}"
# - media_player.kitchendisplay
message: "{{ this_message }}"
Edit: There some stuff in there that needs cleaning up, but you should be able to get the idea of it all.
2 Likes
I can work with this. thank you
1 Like
I know I keep saying this but there are also examples at the github repo for the integration.
the two that I use are fairly compact.
So if you’d like to see those then go to the repo and look under the updated packages folder there.