Updated to tell us the traffic time right before commuting IF the house has something else to say. #1463

This commit is contained in:
CCOSTAN 2024-06-14 17:52:05 +00:00
parent 0e92d4b905
commit 42194f2e42
2 changed files with 16 additions and 2 deletions

View File

@ -13,6 +13,8 @@ exclude:
entity_globs:
- sensor.*uptime*
- sensor.vpn_client_*
- sensor.*_first_connection*
- sensor.*_last_connection*
- binary_sensor.*_motion
- binary_sensor.*is_present
entities:
@ -40,8 +42,6 @@ exclude:
- sensor.floorplan_time_2
- sensor.ha_uptime
- sensor.large_garage_door_since
- sensor.last_message
- sensor.last_ai_message
- sensor.low_battery
- sensor.medicine_time
- sensor.network

View File

@ -172,6 +172,10 @@
[Include a fact about something that happened in the past on this day at the end of the message]
{% endmacro %}
{%- macro traffic_time() -%}
Current traffic is Spectrum Offices: {{ states.sensor.waze_travel_time.state }} minutes.
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text and replaces underscores with spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
@ -185,6 +189,10 @@
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{% set day_of_week = now().strftime('%a') %}
{% set hour = now().hour %}
{% set minute = now().minute %}
{% if call_no_announcement != 1 %}
{% if now().strftime('%H')|int(9999)< 12 and now().strftime('%H')|int(9999)> 6 %}
Good morning.
@ -251,6 +259,12 @@
{{ medicine() }}
{% endif %}
{% if day_of_week in ['Tue', 'Wed', 'Thu', 'Fri', 'Sat'] %}
{% if (hour == 8 and minute >= 30) or (hour == 9 and minute <= 20) or (hour == 17 and minute >= 0) or (hour == 18 and minute <= 20) %}
{{ traffic_time() }}
{% endif %}
{% endif %}
{% if value1 is not none %}
{{ value1 | default }}
{% endif %}