From c94cf5d75a45c9433a09b4b753b5319f97098ad2 Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Wed, 5 Jun 2024 21:42:54 +0000 Subject: [PATCH] #1463 - Added to speech random --- config/templates/speech/briefing.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index 099728ae..ac5d60a7 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -168,6 +168,18 @@ [Include an inspirational quote relevant to the day or situation at the end of the message. "] {% endmacro %} + {% macro justin_work() %} + {% set current_hour = now().hour %} + {% set current_minute = now().minute %} + {% set waze_travel_time = states('sensor.waze_travel_time') | int %} + + {% if (8 <= current_hour <= 9 and current_minute <= 30) or (17 <= current_hour <= 18 and current_minute <= 30) %} + {% if waze_travel_time => 35 %} + [This message is IMPORTANT] There is traffic on the route to take justin to work. The current travel time is {{ waze_travel_time }} minutes. + {% endif %} + {% endif %} + {% endmacro %} + {% macro fact_of_the_day() %} [Include a fact about something that happened in the past on this day at the end of the message] {% endmacro %} @@ -256,7 +268,7 @@ {% endif %} {# call a Random fact about the house or inspiration quote #} - {{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote, fact_of_the_day]|random)() }} + {{ ([justin_work, iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote, fact_of_the_day]|random)() }} {%- endmacro -%} {{- cleanup(mother_of_all_macros()) -}}