Files
Home-Assistant-Configs/packages/custom_weather.yaml
Tony Stork 6034f7d099 Updated template weather provider
Changed to OpenWeatherMap API for forecast because PirateWeather was on some stupid shit. Also, added units of measure where applicable, just for completion's sake.
2023-02-06 21:30:35 -05:00

956 lines
40 KiB
YAML

weather:
- platform: template
name: "Iron Nerd Weather Station"
condition_template: "{{ states('weather.iron_nerd_studios') }}"
temperature_template: "{{ states('sensor.pirateweather_temperature') | float }}"
temperature_unit: °F
humidity_template: "{{ states('sensor.pirateweather_humidity') | float }}"
forecast_template: "{{ state_attr('weather.openweathermap', 'forecast') }}"
pressure_template: "{{ states('sensor.kdfi_barometric_pressure') | float }}"
pressure_unit: inHg
wind_speed_template: "{{ states('sensor.pirateweather_wind_speed') | float }}"
wind_speed_unit: mph
wind_bearing_template: "{{ states('sensor.pirateweather_wind_bearing') | float }}"
visibility_template: "{{ states('sensor.kdfi_visibility') | float }}"
visibility_unit: mi
attribution_template: "Weather data from Iron Nerd's custom weather station template"
ozone_template: "{{ states('sensor.pirateweather_ozone') | float }}"
precipitation_unit: in
template:
- binary_sensor:
- name: Heat Threshold
state: >
{% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.hot_day_threshold') | int %}
{% if temp >= threshold %}
true
{% else %}
false
{% endif %}
device_class: heat
attributes:
current_temp: "{{ states('sensor.pirateweather_temperature') | 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:
- name: Cold Threshold
state: >
{% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.cold_day_threshold') | int %}
{% if temp <= threshold %}
true
{% else %}
false
{% endif %}
device_class: cold
attributes:
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
threshold: "{{ states('input_number.cold_day_threshold') | int }}"
- binary_sensor:
- name: Overnight Low Threshold
state: >
{% set temp = states('sensor.pirateweather_temperature') | int %}
{% set threshold = states('input_number.overnight_low_threshold') | int%}
{% if temp <= threshold %}
true
{% else %}
false
{% endif %}
device_class: cold
attributes:
current_temp: "{{ states('sensor.pirateweather_temperature') | int }}"
threshold: "{{ states('input_number.overnight_low_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:
- platform: weatheralerts
state: OH
zone: 4
county: 39
# - platform: statistics
# unique_id: b5996cb4-b715-4fc9-b3d8-98fc12c2b7dd
# name: Outside Temp Average
# entity_id: sensor.pirateweather_temperature
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: 6192c95a-8fd1-4ba0-87de-d06fdc071d6b
# name: Apparent Temp Average
# entity_id: sensor.pirateweather_apparent_temperature
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: 7b9c269c-40b7-4255-a051-2d1b7a6af017
# name: Wind Speed Average
# entity_id: sensor.pirateweather_wind_speed
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: b43d053f-aafb-4237-a742-a2ca841498fa
# name: Visibility Stats Average
# entity_id: sensor.kdfi_visibility
# state_characteristic: average_linear
# max_age:
# days: 7
# - platform: statistics
# unique_id: b1206da2-fa00-4f7d-9af4-f2cf6794bd24
# name: Humidity Stats Average
# entity_id: sensor.pirateweather_humidity
# state_characteristic: average_linear
# max_age:
# days: 7
- platform: template
sensors:
current_forecast:
friendly_name: Current Forecast
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.condition }}
attribute_templates:
high_temp: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.templow }}
wind_bearing: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.wind_bearing }}
wind_speed: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.wind_speed }}
precipitation: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.precipitation }}
current_forecast_detail:
friendly_name: Current Forecast Detail
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{%- macro getReport() -%}
{{ [
'Today in Defiance ',
'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 severe 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:
friendly_name: Tomorrows Forecast
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
{{ forecast.condition }}
attribute_templates:
high_temp: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
{{ forecast.temperature }}
overnight_low: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
{{ forecast.templow }}
wind_bearing: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
{{ forecast.wind_bearing }}
wind_speed: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %}
{{ forecast.wind_speed }}
precipitation: >-
{% set forecast = state_attr('weather.iron_nerd_weather_station','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 Defiance ',
'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 severe 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 Defiance
{{ [
' is ',
' is currently '
] | random }}
{{states('sensor.pirateweather_temperature')|round}} degrees
{% 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 scatterd 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 %}
{%- 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_detail:
friendly_name: Current Conditions Detail
unit_of_measurement: ''
icon_template: mdi:weather-sunny
value_template: >-
{%- macro getReport() -%}
The Weather in Defiance
{{ [
' is ',
' is currently '
] | random }}
{{states('sensor.pirateweather_temperature')|round}} degrees
{% 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 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 severe 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:
friendly_name: 'Outside Pressure'
value_template: '{{ state_attr(''weather.iron_nerd_weather_station'',''pressure'') }}'
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.iron_nerd_weather_station','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.iron_nerd_weather_station','forecast')[0] %}
{{ forecast.templow }}
clothing_forecast:
friendly_name: "Clothing Forecast"
unit_of_measurement: ''
value_template: >-
{% if is_state('binary_sensor.overnight', 'off') %}
{% set temp = states('sensor.todays_high_temp')|int %}
{% else %}
{% set temp = states('sensor.pirateweather_temperature')|round %}
{% endif %}
{%- if states('sensor.todays_high_temp')|int > 63 %}
{%- if states('sensor.todays_high_temp')|int < 80 %}
Nice
{% elif states('sensor.todays_high_temp')|int > 90 %}
Hot
{% else %}
Toasty
{%- endif %}
{% elif states('sensor.todays_high_temp')|int < 64 %}
{%- if states('sensor.todays_high_temp')|int < 32 %}
Freezing
{% elif states('sensor.todays_high_temp')|int > 48 %}
Chilly
{% else %}
Cold
{%- endif %}
{% else %}
Unknown
{%- endif %}
clothing_forecast_detail:
friendly_name: "Clothing Forecast Detail"
unit_of_measurement: ''
value_template: >-
{%- macro getReport() -%}
{% if is_state('binary_sensor.morning','on') %}
Based on the forecasted high temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
You're gonna freeze your balls off out there. so I suggest wearing long pants and a heavy coat.
{% elif is_state('sensor.clothing_forecast','Cold') %}
It's gonna be cold as balls today. so I suggest wearing long pants and a light jacket.
{% elif is_state('sensor.clothing_forecast', 'Chilly') %}
It's gonna be on the chilly side 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. ',
'a decent day outside for once. ',
'downright tolerable 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
{{ [ 'on the warm side ',
' rather warm outside ',
' almost too hot outside ',
' a little warm ',
] | random }}
today, and very sunny. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Hot') and is_state('sensor.current_forecast', 'sunny') %}
It is going to be
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
] | random }}
today, and very sunny. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is going to be
{{ [ 'on the warm side ',
' 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
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
'hotter than hell itself ',
] | random }}
today. So I suggest wearing shorts.
{% else %}
It is going to be {{ states('sensor.clothing_forecast') }} today so I suggest wearing shorts.
{% endif %}
{% if is_state('input_boolean.hot_day','on') %}
Warning, today will be a very sweaty day, so please remember to stay hydrated!
{% 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 %}
Based on the current temperature,
{% if is_state('sensor.clothing_forecast', 'Freezing') %}
You're gonna freeze your balls off out there. 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 as balls 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
{{ [ 'pretty nice outside. ',
'a good day to be outside. ',
'a decent day outside for once. ',
'downright tolerable outside. ',
] | random }}
So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Toasty') and is_state('weather.iron_nerd_weather_station','sunny') %}
It is
{{ [ 'on the warm side ',
' rather warm ',
' almost too hot ',
' a little warm ',
] | random }}
and very sunny outside. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Hot') and is_state('weather.iron_nerd_weather_station','sunny') %}
It is
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
] | random }}
and very sunny outside. So I suggest wearing shorts and
{{ [ 'bringing your shades, hat, and maybe some sunscreen.',
'preparing to bake under the sun.',
'getting ready to be cooked alive.',
] | random }}
{% elif is_state('sensor.clothing_forecast', 'Toasty') %}
It is
{{ [ 'on the warm side ',
' rather warm ',
' almost too hot ',
' a little warm ',
] | random }}
outside. So I suggest wearing shorts.
{% elif is_state('sensor.clothing_forecast', 'Hot') %}
It is
{{ [ 'so hot you will sweat your balls off',
'hotter than the sun ',
'hotter than the inside of a volcano ',
'hotter than hell itself ',
] | random }}
outside. So I suggest wearing shorts.
{% else %}
It is {{ states('sensor.clothing_forecast') }} right now so I suggest wearing shorts.
{% endif %}
{% if is_state('binary_sensor.heat_index_threshold','on') %}
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!
{% 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 %}
{% if states('sensor.thermal_comfort_simmerindex') in ['extremely_warm','danger_of_heatstroke','extreme_danger_of_heatstroke','circulatory_collapse_imminent'] %}
"To reiterate, the current weather is dangerously hot! "
{% endif %}
{% if is_state('sensor.thermal_comfort_perception','somewhat_uncomfortable') %}
"The humidity is somewhat uncomfortable outside."
{% elif is_state('sensor.thermal_comfort_perception','quite_uncomfortable') %}
"The humidity is very uncomfortable outside. "
{% elif is_state('sensor.thermal_comfort_perception','extremely_uncomfortable') %}
"The humidity outside is extremely uncomfortable and oppresive. "
{% elif is_state('sensor.thermal_comfort_perception','severely_high') %}
"The humidity outside is severely high, and could even be deadly for asthma related illnesses. "
{% endif %}
{% if is_state('sensor.thermal_comfort_frostrisk','high') %}
"There is currently a high chance of frost outside. Plan accordingly! "
{% elif is_state('sensor.thermal_comfort_frostrisk','probable') %}
"The possibility of frost exists currently. Be prepared. "
{% 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()) -}}
nws_current_visibility:
friendly_name: "Current Visibility"
value_template: "{{ ((state_attr('weather.iron_nerd_weather_station','visibility') | int) * 0.621371) | round }}"
# current_inside_humidity:
# friendly_name: "Current Inside Humidity"
# unit_of_measurement: '%'
# value_template: "{{ state_attr('climate.home','current_humidity') }}"
# lighting_stike_count:
# friendly_name: "Lightning Strike Count"
# value_template: "{{ states('sensor.acurite_6045m_3078_strcnt') }}"
# yesterday_rainfall_in:
# friendly_name: "Yesterday Rainfall"
# value_template: "{{ state_attr('sensor.daily_rainfall_in', 'last_period') }}"
# previous_rainfall:
# friendly_name: "Past 48h Rainfall"
# value_template: "{{ states('sensor.daily_rainfall_in') | float + state_attr('sensor.daily_rainfall_in', 'last_period') | float }}"
lightning_warning:
friendly_name: "Lightning Warning"
value_template: >-
{%- if states('sensor.blitzortung_lightning_counter') | int > 0 %}
Unsafe
{% else %}
Safe
{%- endif %}
input_boolean:
freeze_warning:
name: Freeze Warning
icon: mdi:snowflake-alert
weather_alert_texts:
name: Weather Alert Texts
icon: mdi:message-processing
lightning_warning:
name: Lightning Warning
icon: mdi:flash-alert
tornado_alarm:
name: Tornado Alarm
icon: mdi:speaker-wireless
tstorm_alarm:
name: T-Storm Alarm
icon: mdi:speaker-wireless
raining:
name: Raining
automation:
# - alias: 'record previous day rainfall'
# trigger:
# - platform: time
# at: '23:58:00'
# action:
# service: mqtt.publish
# data_template:
# topic: 'house/rain/yesterday_total'
# 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.tonights_low_temp
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.tonights_low_temp
above: 33
condition:
- condition: state
entity_id: input_boolean.freeze_warning
state: 'on'
- condition: numeric_state
entity_id: sensor.tonights_low_temp
above: 35
action:
- service: input_boolean.turn_off
entity_id: input_boolean.freeze_warning
script:
# refresh_weather_alert_sensors:
# sequence:
# - service: homeassistant.update_entity
# entity_id: sensor.tornado_warning
# - service: homeassistant.update_entity
# entity_id: sensor.tornado_watch
# - service: homeassistant.update_entity
# entity_id: sensor.tstorm_warning
# - service: homeassistant.update_entity
# entity_id: sensor.tstorm_watch
# - service: homeassistant.update_entity
# entity_id: sensor.flood_warning
# - service: homeassistant.update_entity
# entity_id: sensor.flood_watch
weather_briefing:
alias: 'Weather Briefing'
sequence:
- service: script.speech_engine
data_template:
who: "{{ who }}"
message: !include ../templates/speech/weather_briefing_full.yaml