Don't announce traffic from school to work when not needed

This commit is contained in:
2022-12-17 14:04:08 -05:00
parent 3baf4ded3f
commit 7be4e7b785

View File

@ -105,18 +105,21 @@
<p>
{% if is_state('input_boolean.school_today','on') and is_state('input_boolean.work_today','on') %}
{% set diff = (state_attr('input_datetime.tina_workday_start','timestamp') - state_attr('input_datetime.school_day_start','timestamp')) %}
{%- if states.sensor.home_to_school.state|round > 12 %}
Traffic to the school appears heavier than normal.
{% else %}
Traffic to the school is normal.
{% endif %}
Currently it will take {{states.sensor.home_to_school.state|round}} minutes to get to the school.
{%- if states.sensor.school_to_bob_evans.state|round > 15 %}
Traffic from the school to Bob Evans appears heavier than normal.
{% else %}
Traffic from the school to Bob Evans is normal.
{%- if diff <= 3600 %}
{%- if states.sensor.school_to_bob_evans.state|round > 15 %}
Traffic from the school to Bob Evans appears heavier than normal.
{% else %}
Traffic from the school to Bob Evans is normal.
{% endif %}
Currently it will take {{states.sensor.school_to_bob_evans.state|round}} minutes to get to Bob Evans from the school.
{% endif %}
Currently it will take {{states.sensor.school_to_bob_evans.state|round}} minutes to get to Bob Evans from the school.
{% elif is_state('input_boolean.work_today','on') %}
{%- if states.sensor.home_to_bob_evans.state|round > 8 %}
Traffic to Bob Evans appears heavier than normal.