#1463 - Add in automation to check traffic and alert us if there is more than a 35 minute commute.

This commit is contained in:
CCOSTAN
2024-06-06 01:53:27 +00:00
parent c94cf5d75a
commit 7c1023ad15
2 changed files with 47 additions and 13 deletions

View File

@@ -168,18 +168,6 @@
[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 %}
@@ -268,7 +256,7 @@
{% endif %}
{# call a Random fact about the house or inspiration quote #}
{{ ([justin_work, iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote, fact_of_the_day]|random)() }}
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote, fact_of_the_day]|random)() }}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}