Redoing how Ha handles the forecast so I can use Pirate Weather instead of NWS

This commit is contained in:
Jeffrey Stone 2022-03-06 18:35:23 -05:00
parent 2c3a3a1d72
commit aca880a378
2 changed files with 585 additions and 193 deletions

View File

@ -108,138 +108,542 @@ sensor:
unit_of_measurement: '' unit_of_measurement: ''
icon_template: mdi:weather-sunny icon_template: mdi:weather-sunny
value_template: >- value_template: >-
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.condition }} {{ forecast.condition }}
attribute_templates: attribute_templates:
high_temp: >- high_temp: >-
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.temperature }} {{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{{ forecast.templow }}
wind_bearing: >- wind_bearing: >-
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.wind_bearing }} {{ forecast.wind_bearing }}
wind_speed: >- wind_speed: >-
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.wind_speed }} {{ forecast.wind_speed }}
precipitation_probability: >- precipitation: >-
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.precipitation_probability }} {{ forecast.precipitation }}
description: > current_forecast_detail:
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} friendly_name: Current Forecast Detail
{{ forecast.detailed_description | truncate(250, False) }}
overnight_forecast:
friendly_name: Overnight Forecast
unit_of_measurement: '' unit_of_measurement: ''
icon_template: mdi:weather-sunny icon_template: mdi:weather-sunny
value_template: >- value_template: >-
{% if is_state('binary_sensor.overnight', 'on') %} {%- macro getReport() -%}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {{ [
{% else %} 'Today in Grayson ',
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} 'Later Today ',
{% endif %} 'For the rest of the day'
{{ forecast.condition }} ] | random }}
attribute_templates: expect a high of {{ state_attr('sensor.current_forecast','high_temp') }}
low_temp: >- {%- if states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','off')%}
{% if is_state('binary_sensor.overnight', 'on') %} {{ [
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} 'and sunny.',
{% else %} 'with sun.',
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} 'with sunny conditions prevailing.'
{% endif %} ] | random }}
{{ forecast.temperature }} {%- elif states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','on') %}
wind_bearing: >- {{ [
{% if is_state('binary_sensor.overnight', 'on') %} 'and clear.',
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} 'with clear skies.'
{% else %} ] | random }}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} {%- elif states('sensor.current_forecast') == 'clear-night' %}
{% endif %} {{ [
{{ forecast.wind_bearing }} 'and clear.',
wind_speed: >- 'with clear skies.'
{% if is_state('binary_sensor.overnight', 'on') %} ] | random }}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} {%- elif states('sensor.current_forecast') == 'rainy' %}
{% else %} {{ [
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} 'with rain.',
{% endif %} 'with showers.',
{{ forecast.wind_speed }} 'and rainy.'
precipitation_probability: >- ] | random }}
{% if is_state('binary_sensor.overnight', 'on') %} {{ [
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} 'Rainfall accumulations ',
{% else %} 'Total Rainfall amounts '
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} ] | random }}
{% endif %} near {{ state_attr('sensor.current_forecast','precipitation') }} inches
{{ forecast.precipitation_probability }} possible.
description: >- {%- elif states('sensor.current_forecast') == 'snowy' %}
{% if is_state('binary_sensor.overnight', 'on') %} {{ [
{% set forecast = state_attr('weather.klzu_daynight','forecast')[0] %} 'with snow.',
{% else %} 'with snow showers.'
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} ] | random }}
{% endif %} {{ [
{{ forecast.detailed_description | truncate(250, False) }} 'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible.',
'with snow and rain showers.'
] | random }}
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'windy' %}
{{ [
'and windy.',
'with lots of wind.'
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy.',
'with some fog.'
] | random }}
{% elif states('sensor.current_forecast') == 'cloudy' %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif states('sensor.current_forecast') == 'partlycloudy' %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scattered clouds'
] | random }}
{%- elif states('sensor.current_forecast') == 'hail' %}
{{ [
'with severve thunderstorms possible.',
'with hail possible.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible.',
'with the potential of thunderstorms.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{% endif -%}
{{ [
'Later tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
tomorrow_forecast: tomorrow_forecast:
friendly_name: Tomorrows Forecast friendly_name: Tomorrows Forecast
unit_of_measurement: '' unit_of_measurement: ''
icon_template: mdi:weather-sunny icon_template: mdi:weather-sunny
value_template: >- value_template: >-
{% if is_state('binary_sensor.overnight', 'on') %} {% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %}
{% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %}
{% endif %}
{{ forecast.condition }} {{ forecast.condition }}
attribute_templates: attribute_templates:
high_temp: >- high_temp: >-
{% if is_state('binary_sensor.overnight', 'on') %} {% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %}
{% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %}
{% endif %}
{{ forecast.temperature }} {{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('weather.anchorage_house','forecast')[2] %}
{{ forecast.templow }}
wind_bearing: >- wind_bearing: >-
{% if is_state('binary_sensor.overnight', 'on') %} {% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %}
{% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %}
{% endif %}
{{ forecast.wind_bearing }} {{ forecast.wind_bearing }}
wind_speed: >- wind_speed: >-
{% if is_state('binary_sensor.overnight', 'on') %} {% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %}
{% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %}
{% endif %}
{{ forecast.wind_speed }} {{ forecast.wind_speed }}
precipitation_probability: >- precipitation: >-
{% if is_state('binary_sensor.overnight', 'on') %} {% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} {{ forecast.precipitation }}
tomorrow_forecast_detail:
friendly_name: Tomorrow Forecast Detail
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{%- macro getReport() -%}
{{ [
'Tomorrow in Grayson ',
'For the next day ',
'Tomorrow '
] | random }}
expect a high of {{ state_attr('sensor.tomorrow_forecast','high_temp') }}
{%- if states('sensor.tomorrow_forecast') == 'sunny' %}
{{ [
'and sunny.',
'with sun.',
'with sunny conditions prevailing.'
] | random }}
{%- elif states('sensor.tomorrow_forecast') == 'rainy' %}
{{ [
'with rain.',
'with showers.',
'and rainy.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.tomorrow_forecast') == 'snowy' %}
{{ [
'with snow.',
'with snow showers.'
] | random }}
{{ [
'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.tomorrow_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible.',
'with snow and rain showers.'
] | random }}
Total accumulation near {{ state_attr('sensor.tomorrow_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.tomorrow_forecast') == 'windy' %}
{{ [
'and windy.',
'with lots of wind.'
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy.',
'with some fog.'
] | random }}
{% elif states('sensor.tomorrow_forecast') == 'cloudy' %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif states('sensor.tomorrow_forecast') == 'partlycloudy' %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scattered clouds'
] | random }}
{%- elif states('sensor.tomorrow_forecast') == 'hail' %}
{{ [
'with severve thunderstorms possible.',
'with hail possible.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible.',
'with the potential of thunderstorms.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{% endif -%}
{{ [
' Tomorrow night expect a low of '
] | random }}
{{ state_attr('sensor.tomorrow_forecast','overnight_low') }} degrees.
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
current_conditions:
friendly_name: Current Conditions
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{%- macro getReport() -%}
The Weather in Grayson
{{ [
' is ',
' is currently '
] | random }}
{{states('sensor.acurite_6045m_3078_f')|round}} degrees
{% if is_state('weather.home', 'rainy') %}
{{ [
'with rain.',
'with showers.'
] | random }}
{% elif is_state('weather.home', 'cloudy') %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif is_state('weather.home', 'partlycloudy') %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scatterd clouds'
] | random }}
{% elif is_state('weather.home', 'sunny') %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ [
'and sunny.',
'with sun.'
] | random }}
{% else %}
{{ [
'and clear.',
'with clear skies.'
] | random }}
{% endif %}
{% else %} {% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %} and {{ states.weather.home.state }}
{% endif %} {% endif %}
{{ forecast.precipitation_probability }} {%- endmacro -%}
description: >- {# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{% if is_state('binary_sensor.overnight', 'on') %} {%- macro cleanup(data) -%}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[1] %} {%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
current_conditions_detail:
friendly_name: Current Conditions Detail
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{%- macro getReport() -%}
The Weather in Grayson
{{ [
' is ',
' is currently '
] | random }}
{{states('sensor.acurite_6045m_3078_f')|round}} degrees
{% if is_state('weather.home', 'rainy') %}
{{ [
'with rain.',
'with showers.'
] | random }}
{% elif is_state('weather.home', 'cloudy') %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif is_state('weather.home', 'partlycloudy') %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scatterd clouds'
] | random }}
{% elif is_state('weather.home', 'sunny') %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ [
'and sunny.',
'with sun.'
] | random }}
{% else %}
{{ [
'and clear.',
'with clear skies.'
] | random }}
{% endif %}
{% else %} {% else %}
{% set forecast = state_attr('weather.klzu_daynight','forecast')[2] %} and {{ states.weather.home.state }}
{% endif %} {% endif %}
{{ forecast.detailed_description | truncate(250, False) }} {%- if is_state('binary_sensor.night','off')%}
{{ [
'Later Today ',
'For the rest of the day'
] | random }}
expect a high of {{ state_attr('sensor.current_forecast','high_temp') }}
{%- if states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','off')%}
{{ [
'and sunny.',
'with sun.',
'with sunny conditions prevailing.'
] | random }}
{%- elif states('sensor.current_forecast') == 'sunny' and is_state('binary_sensor.night','on') %}
{{ [
'and clear.',
'with clear skies.'
] | random }}
{%- elif states('sensor.current_forecast') == 'clear-night' %}
{{ [
'and clear.',
'with clear skies.'
] | random }}
{%- elif states('sensor.current_forecast') == 'rainy' %}
{{ [
'with rain.',
'with showers.',
'and rainy.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'snowy' %}
{{ [
'with snow.',
'with snow showers.'
] | random }}
{{ [
'Snowfall accumulations ',
'Total snowfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'snowy-rainy' %}
{{ [
'with mix preciptation possible.',
'with snow and rain showers.'
] | random }}
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'windy' %}
{{ [
'and windy.',
'with lots of wind.'
] | random }}
{%- elif states('sensor.current_forecast') == 'fog' %}
{{ [
'and foggy.',
'with some fog.'
] | random }}
{% elif states('sensor.current_forecast') == 'cloudy' %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif states('sensor.current_forecast') == 'partlycloudy' %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scattered clouds'
] | random }}
{%- elif states('sensor.current_forecast') == 'hail' %}
{{ [
'with severve thunderstorms possible.',
'with hail possible.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{%- elif states('sensor.current_forecast') == 'lightning' %}
{{ [
'with thunderstorms possible.',
'with the potential of thunderstorms.'
] | random }}
{{ [
'Rainfall accumulations ',
'Total Rainfall amounts '
] | random }}
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
possible.
{% endif -%}
{{ [
'Later tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
{%- else -%}
{{ [
'Tonight expect a low of ',
'Overnight expect a low of '
] | random }}
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
{% endif %}
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
outside_pressure: outside_pressure:
friendly_name: 'outisde pressure' friendly_name: 'outisde pressure'
value_template: '{{ state_attr(''weather.home'',''pressure'') }}' value_template: '{{ state_attr(''weather.home'',''pressure'') }}'
unit_of_measurement: '' unit_of_measurement: ''
todays_high_temp:
friendly_name: "Today's High Temp"
unit_of_measurement: ''
device_class: temperature
value_template: >-
{% set forecast = state_attr('weather.anchorage_house','forecast')[0] %}
{{ forecast.temperature }}
tonights_low_temp:
friendly_name: "Tonight's Low Temp"
unit_of_measurement: ''
device_class: temperature
value_template: >-
{% set forecast = state_attr('weather.anchorage_house','forecast')[1] %}
{{ forecast.lowtemp }}
clothing_forecast: clothing_forecast:
friendly_name: "Clothing Forecast" friendly_name: "Clothing Forecast"
unit_of_measurement: '' unit_of_measurement: ''
value_template: >- value_template: >-
{%- if state_attr('sensor.current_forecast', 'high_temp')|int > 63 %} {% if is_state('binary_sensor.overnight', 'off') %}
{%- if state_attr('sensor.current_forecast', 'high_temp')|int < 80 %} {% set temp = states('sensor.todays_high_temp')|int %}
{% else %}
{% set temp = states('sensor.acurite_6045m_3078_f')|round %}
{% endif %}
{%- if states('sensor.todays_high_temp')|int > 63 %}
{%- if states('sensor.todays_high_temp')|int < 80 %}
Nice Nice
{% elif state_attr('sensor.current_forecast', 'high_temp')|int > 95 %} {% elif states('sensor.todays_high_temp')|int > 95 %}
Hot Hot
{% else %} {% else %}
Toasty Toasty
{%- endif %} {%- endif %}
{% elif state_attr('sensor.current_forecast', 'high_temp')|int < 64 %} {% elif states('sensor.todays_high_temp')|int < 64 %}
{%- if state_attr('sensor.current_forecast', 'high_temp')|int < 32 %} {%- if states('sensor.todays_high_temp')|int < 32 %}
Freezing Freezing
{% elif state_attr('sensor.current_forecast', 'high_temp')|int > 50 %} {% elif states('sensor.todays_high_temp')|int > 50 %}
Chilly Chilly
{% else %} {% else %}
Cold Cold
@ -247,36 +651,90 @@ sensor:
{% else %} {% else %}
Unknown Unknown
{%- endif %} {%- endif %}
nws_current_forecast: clothing_forecast_detail:
friendly_name: 'Current Detailed Forecast' friendly_name: "Clothing Forecast Detail"
value_template: "{{ state_attr('sensor.current_forecast', 'description')}}"
nws_current_rain_forecast:
friendly_name: 'Current Rain Chance'
value_template: "{{ state_attr('sensor.current_forecast', 'precipitation_probability')}}"
unit_of_measurement: '%'
nws_current_temperature:
friendly_name: 'Current Temperature'
value_template: "{{ state_attr('weather.klzu_daynight','temperature') }}"
device_class: temperature
nws_current_condition:
friendly_name: 'Current Condition'
value_template: "{{ states('weather.klzu_daynight') }}"
nws_current_humidity:
friendly_name: 'Current Humidity'
value_template: "{{ state_attr('weather.klzu_daynight','humidity') }}"
nws_current_visibility:
friendly_name: "Current Visability"
value_template: "{{ state_attr('weather.klzu_daynight','visibility') }}"
nws_current_windspeed:
friendly_name: "Current Windspeed"
value_template: "{{ state_attr('weather.klzu_daynight','wind_speed') }}"
nws_overnight_low:
friendly_name: "Overnight Low"
unit_of_measurement: '' unit_of_measurement: ''
value_template: >- value_template: >-
{{ state_attr('sensor.overnight_forecast', 'low_temp')}} {% if is_state('binary_sensor.morning','on') %}
Based on the forecasted high temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is going to be cold today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is going to be chilly today. so I suggest wearing at least long pants.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is going to be
{{ [ 'nice outside. ',
'pretty nice outside. ',
'a good day to be outside. ',
'rather enjoyable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'bit warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is going to be
{{ [ 'hot',
'hotter than the sun ',
'hotter than hot. but in a lot of bad ways ',
'hotter than the sun outside ',
'super hot ',
'hotter than the inside of a volcano '
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
{% endif %}
{% else %}
Based on the current temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
It is freezing. so I suggest wearing long pants and a heavy coat if you are going out.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is cold outside. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is chilly right now. so I suggest wearing at least long pants
if you are going to venture outside.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is
{{ [ 'nice outside. ',
'pretty nice outside. ',
'a good day to be outside. ',
'rather enjoyable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is
{{ [ 'bit warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
outside. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is
{{ [ 'hot',
'hotter than the sun ',
'hotter than hot. but in a lot of bad ways ',
'hotter than the sun outside ',
'super hot ',
'hotter than the inside of a volcano '
] | random }}
outside. So I suggest wearing shorts.
{% else %}
It is {{ states.sensor.clothing_forecast.state }} right now so I suggest wearing shorts.
{% endif %}
{% endif %}
nws_current_visibility:
friendly_name: "Current Visability"
value_template: "{{ ((state_attr('weather.anchorage_house','visibility') | int) * 0.621371) | round }}"
current_inside_humidity: current_inside_humidity:
friendly_name: "Current Inside Humidity" friendly_name: "Current Inside Humidity"
unit_of_measurement: '%' unit_of_measurement: '%'
@ -301,8 +759,6 @@ sensor:
automation: automation:
- alias: 'record previous day rainfall' - alias: 'record previous day rainfall'
trigger: trigger:
- platform: time - platform: time
@ -317,10 +773,10 @@ automation:
- alias: Forecast Low Near Freezing - alias: Forecast Low Near Freezing
trigger: trigger:
- platform: numeric_state - platform: numeric_state
entity_id: sensor.nws_overnight_low entity_id: sensor.tonights_low_temp
below: 35 below: 35
- platform: numeric_state - platform: numeric_state
entity_id: sensor.nws_current_temperature entity_id: sensor.pirateweather_temperature
below: 35 below: 35
condition: condition:
- condition: state - condition: state
@ -333,14 +789,14 @@ automation:
- alias: Forecast Low Above Freezing - alias: Forecast Low Above Freezing
trigger: trigger:
- platform: numeric_state - platform: numeric_state
entity_id: sensor.nws_overnight_low entity_id: sensor.tonights_low_temp
above: 33 above: 33
condition: condition:
- condition: state - condition: state
entity_id: input_boolean.freeze_warning entity_id: input_boolean.freeze_warning
state: 'on' state: 'on'
- condition: numeric_state - condition: numeric_state
entity_id: sensor.nws_overnight_low entity_id: sensor.tonights_low_temp
above: 35 above: 35
action: action:
- service: input_boolean.turn_off - service: input_boolean.turn_off

View File

@ -11,82 +11,18 @@
</p> </p>
<p> <p>
The Weather in Grayson is {{states('sensor.acurite_6045m_3078_f')|round}} degrees {# Moved the current conditions to a tempate sensor in packages/weather.yaml #}
{% if is_state('weather.home', 'rainy') %} {# That will allow me to use it on other briefings with without having to rewrite it #}
{{ [ {{ states('sensor.current_conditions')}}
'with rain.',
'with showers.'
] | random }}
{% elif is_state('weather.home', 'cloudy') %}
{{ [
'with clouds.',
'with cloudy skies.'
] | random }}
{% elif is_state('weather.home', 'partlycloudy') %}
{{ [
'with some clouds.',
'with partly cloudy skies.',
'with scatterd clouds'
] | random }}
{% elif is_state('weather.home', 'sunny') %}
{% if is_state('sun.sun', 'above_horizon') %}
{{ [
'and sunny.',
'with sun.'
] | random }}
{% else %}
{{ [
'and clear.',
'with clear skies.'
] | random }}
{% endif %}
{% else %}
and {{ states.weather.home.state }}
{% endif %}
{% if states.sensor.weatheralerts_active_alerts.state | int > 0 %} {% if states.sensor.weatheralerts_active_alerts.state | int > 0 %}
There are currently {{states.sensor.weatheralerts_active_alerts.state }} active weather alerts for our area. There are currently {{states.sensor.weatheralerts_active_alerts.state }} active weather alerts for our area.
{% endif %} {% endif %}
Based on the forecasted high temperature, {# Moved the clothing forecast to a tempate sensor in packages/weather.yaml #}
{% if is_state('binary_sensor.morning','on') %} {# That will allow me to use it on other briefings with without having to rewrite it #}
{% if is_state('sensor.clothing_forecast', 'Freezing') %} {{ states('sensor.clothing_forecast_detail') }}
It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It is going to be cold today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It is going to be chilly today. so I suggest wearing at least long pants.
{% elif is_state('sensor.clothing_forecast', 'Nice') %}
It is going to be
{{ [ 'nice outside. ',
'pretty nice outside. ',
'a good day to be outside. ',
'rather enjoyable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'bit warm ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is going to be
{{ [ 'hot',
'hotter than the sun ',
'hotter than hot. but in a lot of bad ways ',
'hotter than the sun outside ',
'super hot ',
'hotter than the inside of a volcano '
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
{% endif %}
{% endif %}
</p> </p>