Overhaul presentation of general weather information
This commit is contained in:
@ -27,6 +27,20 @@ template:
|
|||||||
attributes:
|
attributes:
|
||||||
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
|
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
|
||||||
threshold: "{{ states('input_number.hot_day_threshold') | int }}"
|
threshold: "{{ states('input_number.hot_day_threshold') | int }}"
|
||||||
|
- binary_sensor:
|
||||||
|
- name: Heat Index Threshold
|
||||||
|
state: >
|
||||||
|
{% set feelslike = states('sensor.pirateweather_apparent_temperature') | int %}
|
||||||
|
{% set threshold = states('input_number.heat_index_threshold') | int %}
|
||||||
|
{% if feelslike >= threshold %}
|
||||||
|
true
|
||||||
|
{% else %}
|
||||||
|
false
|
||||||
|
{% endif %}
|
||||||
|
device_class: heat
|
||||||
|
attributes:
|
||||||
|
current_temp: "{{ states('sensor.pirateweather_apparent_temperature') | int }}"
|
||||||
|
threshold: "{{ states('input_number.heat_index_threshold') | int }}"
|
||||||
- binary_sensor:
|
- binary_sensor:
|
||||||
- name: Cold Threshold
|
- name: Cold Threshold
|
||||||
state: >
|
state: >
|
||||||
@ -41,6 +55,20 @@ template:
|
|||||||
attributes:
|
attributes:
|
||||||
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
|
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
|
||||||
threshold: "{{ states('input_number.cold_day_threshold') | int }}"
|
threshold: "{{ states('input_number.cold_day_threshold') | int }}"
|
||||||
|
- binary_sensor:
|
||||||
|
- name: Wind Chill Threshold
|
||||||
|
state: >
|
||||||
|
{% set feelslike = states('sensor.pirateweather_apparent_temperature') | int %}
|
||||||
|
{% set threshold = states('input_number.wind_chill_threshold') | int %}
|
||||||
|
{% if feelslike <= threshold %}
|
||||||
|
true
|
||||||
|
{% else %}
|
||||||
|
false
|
||||||
|
{% endif %}
|
||||||
|
device_class: cold
|
||||||
|
attributes:
|
||||||
|
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
|
||||||
|
threshold: "{{ states('input_number.wind_chill_threshold') | int }}"
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: weatheralerts
|
- platform: weatheralerts
|
||||||
@ -492,8 +520,7 @@ sensor:
|
|||||||
'Rainfall accumulations ',
|
'Rainfall accumulations ',
|
||||||
'Total Rainfall amounts '
|
'Total Rainfall amounts '
|
||||||
] | random }}
|
] | random }}
|
||||||
near {{ state_attr('sensor.current_forecast','precipitation') }} inches
|
near {{ state_attr('sensor.current_forecast','precipitation') }} inches possible.
|
||||||
possible.
|
|
||||||
{%- elif states('sensor.current_forecast') == 'snowy' %}
|
{%- elif states('sensor.current_forecast') == 'snowy' %}
|
||||||
{{ [
|
{{ [
|
||||||
'with snow. ',
|
'with snow. ',
|
||||||
@ -510,8 +537,7 @@ sensor:
|
|||||||
'with mix preciptation possible. ',
|
'with mix preciptation possible. ',
|
||||||
'with snow and rain showers. '
|
'with snow and rain showers. '
|
||||||
] | random }}
|
] | random }}
|
||||||
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches
|
Total accumulation near {{ state_attr('sensor.current_forecast','precipitation') }} inches possible.
|
||||||
possible.
|
|
||||||
{%- elif states('sensor.current_forecast') == 'windy' %}
|
{%- elif states('sensor.current_forecast') == 'windy' %}
|
||||||
{{ [
|
{{ [
|
||||||
'and windy. ',
|
'and windy. ',
|
||||||
@ -561,26 +587,26 @@ sensor:
|
|||||||
'Overnight expect a low of '
|
'Overnight expect a low of '
|
||||||
] | random }}
|
] | random }}
|
||||||
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
|
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ [
|
{{ [
|
||||||
'Tonight expect a low of ',
|
'Tonight expect a low of ',
|
||||||
'Overnight expect a low of '
|
'Overnight expect a low of '
|
||||||
] | random }}
|
] | random }}
|
||||||
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
|
{{ state_attr('sensor.current_forecast','overnight_low') }} degrees.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
||||||
{%- macro cleanup(data) -%}
|
{%- macro cleanup(data) -%}
|
||||||
{%- for item in data.split("\n") if item | trim != "" -%}
|
{%- for item in data.split("\n") if item | trim != "" -%}
|
||||||
{{ item | trim }} {% endfor -%}
|
{{ item | trim }} {% endfor -%}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
{# a macro to call all macros :) #}
|
{# a macro to call all macros :) #}
|
||||||
{%- macro mother_of_all_macros() -%}
|
{%- macro mother_of_all_macros() -%}
|
||||||
{{ getReport() }}
|
{{ getReport() }}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{# Call the macro #}
|
{# Call the macro #}
|
||||||
{{- cleanup(mother_of_all_macros()) -}}
|
{{- cleanup(mother_of_all_macros()) -}}
|
||||||
outside_pressure:
|
outside_pressure:
|
||||||
friendly_name: 'Outside Pressure'
|
friendly_name: 'Outside Pressure'
|
||||||
value_template: '{{ state_attr(''weather.iron_nerd_weather_station'',''pressure'') }}'
|
value_template: '{{ state_attr(''weather.iron_nerd_weather_station'',''pressure'') }}'
|
||||||
@ -690,10 +716,12 @@ sensor:
|
|||||||
{% else %}
|
{% else %}
|
||||||
It is going to be {{ states('sensor.clothing_forecast') }} today so I suggest wearing shorts.
|
It is going to be {{ states('sensor.clothing_forecast') }} today so I suggest wearing shorts.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set high = state_attr('sensor.current_forecast','high_temp') %}
|
{% if is_state('input_boolean.hot_day','on') %}
|
||||||
{% if high > 85 %}
|
|
||||||
Warning, today will be a very sweaty day, so please remember to stay hydrated!
|
Warning, today will be a very sweaty day, so please remember to stay hydrated!
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if is_state('input_boolean.cold_day','on') %}
|
||||||
|
Warning, today will be excessively cold, please make sure all exposed skin is covered to avoid frostbite!
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
Based on the current temperature,
|
Based on the current temperature,
|
||||||
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
|
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
|
||||||
@ -753,13 +781,15 @@ sensor:
|
|||||||
{% else %}
|
{% else %}
|
||||||
It is {{ states('sensor.clothing_forecast') }} right now so I suggest wearing shorts.
|
It is {{ states('sensor.clothing_forecast') }} right now so I suggest wearing shorts.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set heatindex = states('sensor.pirateweather_apparent_temperature') | float | round %}
|
{% if is_state('binary_sensor.heat_index_threshold','on') %}
|
||||||
{% if heatindex > 90 %}
|
Warning, the heat index is {{ states('sensor.pirateweather_apparent_temperature') | float | round }} degrees right now, which is very high. So please make sure to stay hydrated!
|
||||||
Warning, the heat index is {{ heatindex }} degrees right now, which is very high. So please make sure to stay hydrated!
|
{% endif %}
|
||||||
|
{% if is_state('binary_sensor.wind_chill_threshold','on') %}
|
||||||
|
Warning, it currently feels like {{ states('sensor.pirateweather_apparent_temperature') | float | round }} degrees outside, so please make sure all exposed skin is covered to avoid frostbite!
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if states('sensor.thermal_comfort_simmerindex') in ['extremely_warm','danger_of_heatstroke','extreme_danger_of_heatstroke','circulatory_collapse_imminent'] %}
|
{% if states('sensor.thermal_comfort_simmerindex') in ['extremely_warm','danger_of_heatstroke','extreme_danger_of_heatstroke','circulatory_collapse_imminent'] %}
|
||||||
"To reiterate, it is dangerously hot outside! "
|
"To reiterate, the current weather is dangerously hot! "
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_state('sensor.thermal_comfort_perception','somewhat_uncomfortable') %}
|
{% if is_state('sensor.thermal_comfort_perception','somewhat_uncomfortable') %}
|
||||||
"The humidity is somewhat uncomfortable outside."
|
"The humidity is somewhat uncomfortable outside."
|
||||||
|
@ -22,38 +22,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The weather in Defiance is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees
|
{{ states('sensor.current_conditions_detail') }}
|
||||||
{% if is_state('weather.iron_nerd_weather_station','rainy') %}
|
|
||||||
{{ [
|
|
||||||
'with rain.',
|
|
||||||
'with showers.'
|
|
||||||
] | random }}
|
|
||||||
{% elif is_state('weather.iron_nerd_weather_station','cloudy') %}
|
|
||||||
{{ [
|
|
||||||
'with clouds.',
|
|
||||||
'with cloudy skies.'
|
|
||||||
] | random }}
|
|
||||||
{% elif is_state('weather.iron_nerd_weather_station','partlycloudy') %}
|
|
||||||
{{ [
|
|
||||||
'with some clouds.',
|
|
||||||
'with partly cloudy skies.',
|
|
||||||
'with scattered clouds.'
|
|
||||||
] | random }}
|
|
||||||
{% elif is_state('weather.iron_nerd_weather_station','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.iron_nerd_weather_station.state }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if states('sensor.weatheralerts_active_alerts') > '0' %}
|
{% if states('sensor.weatheralerts_active_alerts') > '0' %}
|
||||||
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weatheralerts_active_alerts') }}. They are as follows. "
|
"Currently there are weather alerts active. The total number of alerts is {{ states('sensor.weatheralerts_active_alerts') }}. They are as follows. "
|
||||||
@ -75,6 +44,24 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ [
|
||||||
|
'The weather for the rest of today should be,',
|
||||||
|
'The forecast for the rest of the day is,',
|
||||||
|
'Through the rest of your day, the weather is expected to be,'
|
||||||
|
] | random }}
|
||||||
|
{{ states.sensor.current_forecast.state }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ [
|
||||||
|
'Just in case you were planning on going anywhere,',
|
||||||
|
'On the off chance that you planned to go outside,',
|
||||||
|
'If you were planning to go out and do something with your life,',
|
||||||
|
] | random }}
|
||||||
|
{{ states('sensor.clothing_forecast_detail') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% if is_state('sun.sun','below_horizon') %}
|
{% if is_state('sun.sun','below_horizon') %}
|
||||||
You have
|
You have
|
||||||
|
@ -20,56 +20,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
|
Today the high temperature will be {{ state_attr('sensor.current_forecast','high_temp') }} degrees.
|
||||||
It is going to be freezing today. so I suggest wearing long pants and a heavy coat.
|
{{ states('sensor.clothing_forecast_detail') }}
|
||||||
{% 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
|
|
||||||
{{ [ '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') and is_state('sensor.current_forecast','sunny') %}
|
|
||||||
It is going to be
|
|
||||||
{{ [ ' rather warm outside. ',
|
|
||||||
' almost too hot outside. ',
|
|
||||||
' a little warm today. ',
|
|
||||||
] | random }}
|
|
||||||
and very sunny, so I suggest wearing shorts and maybe some sunscreen.
|
|
||||||
{% elif is_state('sensor.clothing_forecast', 'Hot') and is_state('sensor.current_forecast','sunny') %}
|
|
||||||
It is going to be
|
|
||||||
{{ [ 'hotter than the sun today. ',
|
|
||||||
'hotter than the sun outside. ',
|
|
||||||
'super hot today. ',
|
|
||||||
'hotter than the inside of a volcano today. Well not exactly, but you get the point. '
|
|
||||||
] | random }}
|
|
||||||
and very sunny, so I suggest wearing shorts and maybe some sunscreen.
|
|
||||||
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
|
|
||||||
It is going to be
|
|
||||||
{{ [ ' rather warm outside. ',
|
|
||||||
' almost too hot outside. ',
|
|
||||||
' a little warm today. ',
|
|
||||||
] | random }}
|
|
||||||
So I suggest wearing shorts.
|
|
||||||
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
|
|
||||||
It is going to be
|
|
||||||
{{ [ 'hotter than the sun today. ',
|
|
||||||
'hotter than the sun outside. ',
|
|
||||||
'super hot today. ',
|
|
||||||
'hotter than the inside of a volcano today. Well not exactly, but you get the point. '
|
|
||||||
] | random }}
|
|
||||||
So I suggest wearing shorts.
|
|
||||||
{% else %}
|
|
||||||
It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts.
|
|
||||||
{% endif %}
|
|
||||||
{% set hightemp = state_attr('sensor.current_forecast','high_temp') | float %}
|
|
||||||
{% if hightemp > 84 %}
|
|
||||||
Warning, today will be a very sweaty day, so you need to remember to stay hydrated.
|
|
||||||
{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -66,7 +66,10 @@
|
|||||||
'The rest of the day should be,',
|
'The rest of the day should be,',
|
||||||
'Todays forecast should be ,'
|
'Todays forecast should be ,'
|
||||||
]|random }}
|
]|random }}
|
||||||
{{ states.sensor.current_forecast.state }}
|
{{ states('sensor.current_forecast') }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ states('sensor.clothing_forecast_detail') }}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{% if is_state('sensor.halloween_countdown','0') %}
|
{% if is_state('sensor.halloween_countdown','0') %}
|
||||||
|
Reference in New Issue
Block a user