Skip to content

Commit

Permalink
Updated to tell us the traffic time right before commuting IF the hou…
Browse files Browse the repository at this point in the history
…se has something else to say. #1463
  • Loading branch information
CCOSTAN committed Jun 14, 2024
1 parent 0e92d4b commit 42194f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/recorder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions config/templates/speech/briefing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" -%}
Expand All @@ -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.
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit 42194f2

Please sign in to comment.