From 0a76720d0c5e0aefc94ee12f487b2ca9ad6cd866 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 11 May 2022 17:30:17 -0400 Subject: [PATCH] Some weather-related changes to briefing scripts --- packages/custom_weather.yaml | 72 ++++++++++++++++--- templates/speech/kallen_morning_briefing.yaml | 29 ++++++-- 2 files changed, 88 insertions(+), 13 deletions(-) diff --git a/packages/custom_weather.yaml b/packages/custom_weather.yaml index a6bd00f..9569238 100644 --- a/packages/custom_weather.yaml +++ b/packages/custom_weather.yaml @@ -266,7 +266,7 @@ sensor: {% 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] %} + {% set forecast = state_attr('weather.iron_nerd_weather_station','forecast')[1] %} {{ forecast.precipitation }} tomorrow_forecast_detail: friendly_name: Tomorrow Forecast Detail @@ -384,11 +384,11 @@ sensor: value_template: >- {%- macro getReport() -%} The Weather in Defiance - {{ [ + {{ [ ' is ', ' is currently ' ] | random }} - {{states('sensor.pirateweather_temperature')|round}} degrees + {{states('sensor.pirateweather_temperature')|round}} degrees {% if is_state('weather.iron_nerd_weather_station', 'rainy') %} {{ [ 'with rain. ', @@ -440,11 +440,11 @@ sensor: value_template: >- {%- macro getReport() -%} The Weather in Defiance - {{ [ + {{ [ ' is ', ' is currently ' ] | random }} - {{states('sensor.pirateweather_temperature')|round}} degrees + {{states('sensor.pirateweather_temperature')|round}} degrees {% if is_state('weather.iron_nerd_weather_station', 'rainy') %} {{ [ 'with rain. ', @@ -627,7 +627,7 @@ sensor: {%- if states('sensor.todays_high_temp')|int > 63 %} {%- if states('sensor.todays_high_temp')|int < 80 %} Nice - {% elif states('sensor.todays_high_temp')|int > 95 %} + {% elif states('sensor.todays_high_temp')|int > 90 %} Hot {% else %} Toasty @@ -664,6 +664,29 @@ sensor: '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\'ll 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 ', @@ -677,11 +700,16 @@ sensor: {{ [ 'so hot you\'ll 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.state }} today so I suggest wearing shorts. {% endif %} + {% set high = state_attr('sensor.current_forecast','high_temp') %} + {% if high > 85 %} + Warning, today will be a very sweaty day, so please remember to stay hydrated! + {% endif %} {% else %} Based on the current temperature, {% if is_state('sensor.clothing_forecast', 'Freezing') %} @@ -699,11 +727,34 @@ sensor: '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\'ll 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 outside ', - ' almost too hot outside ', + ' rather warm ', + ' almost too hot ', ' a little warm ', ] | random }} outside. So I suggest wearing shorts. @@ -712,11 +763,16 @@ sensor: {{ [ 'so hot you\'ll 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.state }} right now so I suggest wearing shorts. {% endif %} + {% set heatindex = states('sensor.pirateweather_apparent_temperature') | float | round %} + {% if heatindex > 90 %} + Warning, the heat index is {{ heatindex }} degrees right now, which is very high. So please make sure to stay hydrated! + {% endif %} {% endif %} {%- endmacro -%} {# a macro that removes all newline characters, empty spaces, and returns formatted text #} diff --git a/templates/speech/kallen_morning_briefing.yaml b/templates/speech/kallen_morning_briefing.yaml index cdaa77a..aa3f88f 100644 --- a/templates/speech/kallen_morning_briefing.yaml +++ b/templates/speech/kallen_morning_briefing.yaml @@ -13,7 +13,7 @@ 'If you have not gotten dressed it is that time.', 'It is time to get your butt in gear. And your face too, ideally.', 'It is time to do the getting of readiness. And be nice to your mother!', - 'In the words of the legendary Tom Brady, LETS GO!!!' + 'In the words of the legendary Tom Brady, LETS GO!!!', ] | random }} {% endif %}

@@ -32,6 +32,21 @@ '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. ', @@ -49,7 +64,11 @@ So I suggest wearing shorts. {% else %} It is going to be {{ states.sensor.clothing_forecast.state }} today so I suggest wearing shorts. - {% endif %} + {% endif %} + {% set hightemp = state_attr('sensor.current_forecast','high_temp') | float %} + {% if hightemp > 85 %} + Warning, today will be a very sweaty day, so you need to remember to stay hydrated. + {% endif %}

@@ -58,7 +77,7 @@ Today is the first day of school! {% else %} {{ [ 'Today is a school day.', - 'It is a school day. ' + 'It is a school day. ', ] | random }} {% endif %} Pickup today will be at {{(state_attr('input_datetime.school_day_end', 'timestamp') | int | timestamp_custom('%I:%M %p', False)) }} @@ -73,9 +92,9 @@ And look at that. You do not have school today. {{ [ 'Guess today would be a good day to clean your room.', 'You could always do some chores. HA, good one.', - 'Want to play a nice game of chess? Sorry. I meant, want to play Dark Souls?', + 'Want to play a nice game of chess? Sorry. I meant, want to play Beam NG?', 'I hope you enjoy your day off. You deserve it.', - 'Today would be a good day to spend some time with mom and dad.' + 'Today would be a good day to spend some time with mom and dad.', ] | random }} {% endif %}