Added new freeze warning announcments and tweets

This commit is contained in:
Jeffrey Stone 2019-11-09 19:17:42 -05:00
parent 3713709e0d
commit 013b3e0635
3 changed files with 93 additions and 15 deletions

View File

@ -58,6 +58,7 @@ automation:
call_time_annc: 1
call_weather_alerts: 1
call_overnight_forecast: 1
call_freeze_warning: 1
call_upcoming_holidays: 1
call_reminders: 1
call_chores: 1
@ -142,3 +143,16 @@ automation:
{% else %}
07:45
{% endif %}
- alias: Announce Freeze Warning
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.freeze_warning
to: 'on'
action:
- service: script.twitter_notify
data_template:
message: '{{ [ "Appears that the temperature will be below freezing tonight. I think I will stay inside.",
"The temperature tonight will kill sensative plants, so I just made a weather announcement. I cannot through inaction allow another to come to harm.",
"Winter is coming. Actually it is already here. I suggest sleeping with Dragon Glass." ] | random }}'

View File

@ -170,13 +170,34 @@ script:
jarvis_alert:
sequence:
- service: switch.turn_on
entity_id: switch.ha_speaker
- service: mqtt.publish
data_template:
topic: 'house/polly/lastmsg'
payload: "This message is from {{ now().strftime('%-I') }}:{{ now().strftime('%M') }} {{ now().strftime('%p') }}. {{ message | truncate(220)}}"
retain: true
- service: media_player.turn_on
entity_id: media_player.theater
- service: media_player.volume_set
data_template:
entity_id: media_player.theater
volume_level: >
{% if states.input_boolean.audible_notifications.state == 'on' %}
.65
{% else %}
.65
{% endif %}
# media_player.googlehome0715, media_player.googlehomehub3492, media_player.upstairs_speaker
- service: tts.amazon_polly_say
data_template:
entity_id: media_player.guest_tv
entity_id: >
{% if states.input_boolean.audible_notifications.state == 'on' %}
media_player.theater
{% else %}
media_player.house
{% endif %}
message: >-
<speak>
<break time="1.0s" />
{{ message }}
</speak>
cache: true
@ -210,6 +231,8 @@ script:
message: >
{{message }}
jarvis_voice:
sequence:
- service: mqtt.publish
@ -444,10 +467,13 @@ script:
{% endmacro %}
{% macro freeze_warning() %}
{{ [ "The temperature is expected to be near freezing. Someone might want to bring the lemon tree in. ",
"It appears that it will be cold tonight. Think of the poor plants.",
"I suggest bringing in the plants otherwise the temperature might kill them. And that will be on you."
{% if is_state("input_boolean.freeze_warning","on") %}
{{ [ "The temperature is expected to be near or below freezing. Someone might want to bring the lemon tree in. ",
"It appears that it will be cold tonight. Like turn water solid, cold. Think of the poor plants.",
"I suggest bringing in the plants otherwise the temperature might kill them. And that will be on you.",
"I would say winter is coming. But based on the weather forecast it appears to be here. Grab the Dragon glass."
] | random }}
{% endif %}
{% endmacro %}
{% macro upcoming_birthdays() %}
@ -614,13 +640,18 @@ script:
{% endmacro %}
{% macro garage_door_status() %}
{% if is_state("binary_sensor.garage_door_contact_2", "on") %}
{% if is_state("binary_sensor.garage_door", "on") %}
{{ [ "The garage door is open. ",
"The pod bay doors are open. ",
"Someone forgot to close the garage."
] | random }}
{% elif is_state("binary_sensor.side_door", "on") %}
{{ [ "The side door is ajar. ",
"The side door is open. ",
"Someone forgot to close the side door."
] | random }}
{% else %}
{{ [ "The garage door is closed. ",
{{ [ "The garage doors are closed. ",
"The cargo hold is sealed. ",
"Looks like the garage has been secured.",
"The pod bay doors are closed. Do not ask me to open them."

View File

@ -21,6 +21,11 @@ group:
entities:
- sensor.nws_alerts
input_boolean:
freeze_warning:
name: Freeze Warning
icon: mdi:snowflake-alert
### You first need to find either your NWS Zone ID or County ID. Im not sure which is better but I used my Zone ID here.
### You can find your Zone ID by going to https://alerts.weather.gov/ 7, scroll down to your state and click on the “zone list” then look for the entry for your county.
### I recommond useing both
@ -191,6 +196,23 @@ automation:
title: "Tornado Warning!"
message: "The National Weather Service Has issued a Tornado Warning for our area."
- alias: NWS Freeze Warning
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.nws_alerts
condition:
condition: and
conditions:
- condition: template
value_template: "{{states.sensor.nws_alerts.state | int > 0}}"
- condition: template
value_template: "{{ 'Freeze Warning' in states.sensor.nws_alerts.attributes.title}}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.freeze_warning
- alias: Activate Tornado alarm
initial_state: 'on'
trigger:
@ -199,11 +221,8 @@ automation:
from: 'off'
to: 'on'
action:
- service: media_player.play_media
entity_id: media_player.theater
data:
media_content_id: /media/audio/Tornado_Siren.mp3
media_content_type: "music"
- service: script.turn_on
entity_id: script.tornado_alarm
- alias: Deactivate Tornado alarm
initial_state: 'on'
@ -212,8 +231,9 @@ automation:
entity_id: input_boolean.tornado_alarm
from: 'on'
to: 'off'
action:
- service: script.turn_off
entity_id: script.tornado_alarm
- service: media_player.media_stop
entity_id: media_player.theater
@ -240,4 +260,17 @@ script:
tornado_alarm:
sequence:
- service: shell_command.tornado_alarm
- delay:
seconds: 15
- service: media_player.play_media
entity_id: media_player.theater
data:
media_content_id: http://192.168.7.40/audio/tornado_alarm.mp3
media_content_type: "music"
- delay:
seconds: 110
- service: media_player.play_media
entity_id: media_player.theater
data:
media_content_id: http://192.168.7.40/audio/tornado_alarm.mp3
media_content_type: "music"