From 42194f2e42f7fec186a7c427144e45301e128586 Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Fri, 14 Jun 2024 17:52:05 +0000 Subject: [PATCH] Updated to tell us the traffic time right before commuting IF the house has something else to say. #1463 --- config/recorder.yaml | 4 ++-- config/templates/speech/briefing.yaml | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config/recorder.yaml b/config/recorder.yaml index b28670e6..d22eb0d4 100755 --- a/config/recorder.yaml +++ b/config/recorder.yaml @@ -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 diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index 099728ae..853f9ec2 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -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. @@ -250,6 +258,12 @@ {% if now().strftime('%H')|int(0) > 21 %} {{ 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 }}