Make weather more resilient to failures #89

This commit is contained in:
2023-07-29 14:26:19 -04:00
parent 92a2b185d8
commit 9c12f64586
6 changed files with 16 additions and 13 deletions

View File

@ -5,6 +5,12 @@
{% from 'time.jinja' import current_time, current_date_readout, input_datetime_read %}
{% from 'speech.jinja' import dadjoke, inspirational_quote %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
{% set precipTypes = [
states.sensor.pirateweather_precip,
states.sensor.openweathermap_precipitation_kind,
states.sensor.tomorrow_io_stratton_ave_precipitation_type
] %}
{% set snowing = precipTypes | selectattr('state','eq','snow') | map(attribute='state') | list | count | int %}
<p>
Good morning, Collin.
@ -164,7 +170,7 @@
{%- endif %}
{% endif %}
{% if is_state ('input_boolean.kallen_school_today', 'off') and is_state('sensor.pirateweather_icon', 'snow') %}
{% if is_state ('input_boolean.kallen_school_today', 'off') and snowing > 0 %}
Do you wanna build a snowman? It is snowing!
{% endif %}

View File

@ -41,7 +41,7 @@
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weather_alerts_active_corrected') }}. They are as follows. "
{{ states('sensor.weather_alert_string') }}.
{% endif %}
{% if (states('sensor.pirateweather_visibility') | int ) < 3 %}
{% if (state_attr('weather.iron_nerd_weather_station','visibility') | int ) < 3 %}
{{ [
"It is foggy outside, please exercise caution when driving. ",
"The visibility outside is quite low. If you will be driving soon, please be cautious. ",

View File

@ -86,7 +86,7 @@
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weather_alerts_active_corrected') }}. They are as follows. "
{{ states('sensor.weather_alert_string') }}.
{% endif %}
{% if (states('sensor.pirateweather_visibility') | int ) < 3 %}
{% if (state_attr('weather.iron_nerd_weather_station','visibility') | int ) < 3 %}
"In case you are planning to go back out, "
{{ [
"It is foggy outside, please exercise caution when driving. ",