Improve severe weather TTS alerts

This commit is contained in:
2023-05-02 18:26:56 -04:00
parent f1d20cfcd8
commit 3bd2ef755f
3 changed files with 119 additions and 39 deletions

View File

@ -1010,7 +1010,7 @@ input_boolean:
name: Severe Weather Mode
icon: mdi:weather-tornado
automation:
# automation:
# - alias: 'record previous day rainfall'
# trigger:
# - platform: time
@ -1022,39 +1022,39 @@ automation:
# retain: true
# payload: "{{ states('sensor.todays_rainfall') }}"
- id: 14421478-a33c-471a-ae01-b48827f6121a
alias: Forecast Low Near Freezing
trigger:
- platform: numeric_state
entity_id: sensor.overnight_lowest_temperature
below: 35
- platform: numeric_state
entity_id: sensor.pirateweather_temperature
below: 35
condition:
- condition: state
entity_id: input_boolean.freeze_warning
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.freeze_warning
# - id: 14421478-a33c-471a-ae01-b48827f6121a
# alias: Forecast Low Near Freezing
# trigger:
# - platform: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# below: 35
# - platform: numeric_state
# entity_id: sensor.pirateweather_temperature
# below: 35
# condition:
# - condition: state
# entity_id: input_boolean.freeze_warning
# state: 'off'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.freeze_warning
- id: 088285ec-6435-435c-a8ce-800851fb15e2
alias: Forecast Low Above Freezing
trigger:
- platform: numeric_state
entity_id: sensor.overnight_lowest_temperature
above: 33
condition:
- condition: state
entity_id: input_boolean.freeze_warning
state: 'on'
- condition: numeric_state
entity_id: sensor.overnight_lowest_temperature
above: 35
action:
- service: input_boolean.turn_off
entity_id: input_boolean.freeze_warning
# - id: 088285ec-6435-435c-a8ce-800851fb15e2
# alias: Forecast Low Above Freezing
# trigger:
# - platform: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# above: 33
# condition:
# - condition: state
# entity_id: input_boolean.freeze_warning
# state: 'on'
# - condition: numeric_state
# entity_id: sensor.overnight_lowest_temperature
# above: 35
# action:
# - service: input_boolean.turn_off
# entity_id: input_boolean.freeze_warning
script:

View File

@ -1638,14 +1638,33 @@ script:
] | random }}
It is safe to resume normal activities.
{% endmacro %}
{% macro thunderstorm_warning() %}
{{ ['A severe thunderstorm warning has been issued, it is about to get loud!',
'The national weather service has issued a severe thunderstorm warning for our area.'
] | random }}
Make sure to secure any outdoor items and consider moving cars away from trees!
{% endmacro %}
{% macro tornado_watch() %}
{{ ['A tornado watch has been issued. Keep an eye on the skies and your local weather experts, and move the cars away from trees!',
'The national weather service has issued a tornado watch. Keep your eyes peeled for rotating clouds, and move your cars away from trees!'
] | random}}
{% endmacro %}
{% macro thunderstorm_watch() %}
{{ ['A severe thunderstorm watch has been issued.',
'The national weather service has issued a severe thunderstorm watch.'
] | random }}
Make sure to secure any outdoor items and consider moving cars away from trees!
{% endmacro %}
{% macro freeze_warning() %}
{% if is_state('input_boolean.freeze_warning','on') %}
'There is a freeze warning in effect for tonight. '
{{ [ 'It appears that it will be cold tonight. Like, the turn water solid kind of cold. Think of the poor plants.',
'I would say winter is coming. But, based on the weather forecast it appears to be here.',
'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.'
] | random }}
{% endif %}
{% endmacro %}
{% macro traffic_conditions() %}
@ -1822,6 +1841,18 @@ script:
{{ lightning_clear() }}
{% endif %}
{% if call_thunderstorm_warning == 1 %}
{{ thunderstorm_warning() }}
{% endif %}
{% if call_tornado_watch == 1 %}
{{ tornado_watch() }}
{% endif %}
{% if call_thunderstorm_watch == 1 %}
{{ thunderstorm_watch() }}
{% endif %}
{% if call_freeze_warning == 1 %}
{{ freeze_warning() }}
{% endif %}

View File

@ -1489,6 +1489,22 @@ automation:
entity_id: sensor.weatheralerts_active_alerts
attribute: tstorm_warning_count
above: 0
id: tstorm-warning
- platform: numeric_state
entity_id: sensor.weatheralerts_active_alerts
attribute: tornado_watch_count
above: 0
id: tornado-watch
- platform: numeric_state
entity_id: sensor.weatheralerts_active_alerts
attribute: tstorm_watch_count
above: 0
id: tstorm-watch
- platform: numeric_state
entity_id: sensor.weatheralerts_active_alerts
attribute: freeze_warning_count
above: 0
id: freeze-warning
condition:
- condition: and
conditions:
@ -1499,10 +1515,43 @@ automation:
- condition: template
value_template: "{{ state_attr('sensor.weatheralerts_alert_1', 'alert_id') not in states('input_text.weatheralerts_triggered_audible_alert_ids') }}"
action:
- service: script.speech_engine
data:
who: everywhere
message: Severe thunderstorm warning has been issued, it's about to get loud!
- choose:
- conditions:
- condition: trigger
id: tstorm-warning
sequence:
- service: script.status_annc
data:
who: everywhere
call_interruption: 1
call_thunderstorm_warning: 1
- conditions:
- condition: trigger
id: tornado-watch
sequence:
- service: script.status_annc
data:
who: everywhere
call_interruption: 1
call_tornado_watch: 1
- conditions:
- condition: trigger
id: tstorm-watch
sequence:
- service: script.status_annc
data:
who: everywhere
call_interruption: 1
call_thunderstorm_watch: 1
- conditions:
- condition: trigger
id: freeze-warning
sequence:
- service: script.status_annc
data:
who: everywhere
call_interruption: 1
call_freeze_warning: 1
- service: input_text.set_value
data:
entity_id: input_text.weatheralerts_triggered_audible_alert_ids