Numerous improvements to sports updates, add Minnesota Wild, close #135
This commit is contained in:
@ -1,12 +1,24 @@
|
||||
{% from 'formatting.jinja' import cleanup %}
|
||||
|
||||
{% macro sports_str(team,type) %}
|
||||
{% if type == 'start' %}
|
||||
{% if state_attr(team,'league') in ['NFL','NCAAF'] %}
|
||||
Kickoff
|
||||
{% elif state_attr(team,'league') == 'MLB' %}
|
||||
First pitch
|
||||
{% elif state_attr(team,'league') == 'NHL' %}
|
||||
Puck drop
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro sports_pregame(team) %}
|
||||
{% macro data() %}
|
||||
{% if is_state(team,'PRE') %}
|
||||
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
|
||||
{% if date == now().strftime('%m-%d') %}
|
||||
The {{ state_attr(team,'friendly_name') }} will be playing today against the {{ state_attr(team,'opponent_name') }} at {{ state_attr(team,'venue') }}.
|
||||
Start time is at {{ state_attr(team,'date') | as_timestamp | timestamp_custom('%I:%M %p') }}.
|
||||
{{ sports_str(team,'start') }} is at {{ state_attr(team,'date') | as_timestamp | timestamp_custom('%I:%M %p') }}.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro%}
|
||||
@ -75,4 +87,69 @@
|
||||
{% if date == now().strftime('%m-%d') %}
|
||||
{{ states(team) in ['PRE','IN'] }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro sports_updates(time) %}
|
||||
{% macro data() %}
|
||||
{% if time == 'pregame' %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_wild_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_wild') }}
|
||||
{% endif %}
|
||||
{% elif time == 'main' %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_main('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_main('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_main('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_main('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_main('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_main('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_wild_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_wild') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
{{ cleanup(data()) }}
|
||||
{% endmacro %}
|
||||
|
||||
{{ sports_updates('pregame') }}
|
@ -1,6 +1,3 @@
|
||||
# Right now this is just to provide binary sensors to control the conditional cards on our dashboard.
|
||||
# These are needed in order to prevent cards showing for events that are several months in the future...
|
||||
|
||||
input_boolean:
|
||||
sports_updates:
|
||||
name: Sports Updates
|
||||
@ -88,6 +85,16 @@ template:
|
||||
state: >
|
||||
{% from 'sports.jinja' import sports_today %}
|
||||
{{ sports_today('sensor.los_angeles_dodgers') }}
|
||||
- name: Minnesota Wild Inhibit
|
||||
unique_id: 3ef763c4-1959-4292-9729-7ef12a2c862e
|
||||
state: >
|
||||
{% from 'sports.jinja' import sports_inhibit %}
|
||||
{{ sports_inhibit('sensor.minnesota_wild') }}
|
||||
- name: Minnesota Wild Event Today
|
||||
unique_id: ebc02b5c-e002-4fa3-909f-75f2a9b90b21
|
||||
state: >
|
||||
{% from 'sports.jinja' import sports_today %}
|
||||
{{ sports_today('sensor.minnesota_wild') }}
|
||||
|
||||
intent_script:
|
||||
SportsScore:
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% from 'status.jinja' import houseStatusReport, tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
|
||||
{% from 'easy_time.jinja' import count_the_days %}
|
||||
{% from 'weather.jinja' import weatherReport %}
|
||||
{% from 'sports.jinja' import sports_pregame, sports_main %}
|
||||
{% from 'sports.jinja' import sports_updates %}
|
||||
<p>
|
||||
{{ greeting() }}
|
||||
</p>
|
||||
@ -243,59 +243,8 @@
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_main('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_main('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_main('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_main('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_main('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_main('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{{ sports_updates('pregame') }}
|
||||
{{ sports_updates('main') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
|
||||
{% from 'easy_time.jinja' import count_the_days %}
|
||||
{% from 'weather.jinja' import weatherReport %}
|
||||
{% from 'sports.jinja' import sports_pregame, sports_main %}
|
||||
{% from 'sports.jinja' import sports_updates %}
|
||||
<p>
|
||||
{{ greeting_nodate() }}
|
||||
</p>
|
||||
@ -117,59 +117,8 @@
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_main('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_main('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_main('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_main('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_main('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_main('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{{ sports_updates('pregame') }}
|
||||
{{ sports_updates('main') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
|
||||
{% from 'easy_time.jinja' import count_the_days %}
|
||||
{% from 'weather.jinja' import weatherReport %}
|
||||
{% from 'sports.jinja' import sports_pregame, sports_main %}
|
||||
{% from 'sports.jinja' import sports_updates %}
|
||||
<p>
|
||||
{{ greeting() }}
|
||||
</p>
|
||||
@ -38,59 +38,8 @@
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_pregame('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{% if is_state('input_boolean.sports_updates','on') %}
|
||||
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
|
||||
{{ sports_main('sensor.michigan_wolverines') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
|
||||
{{ sports_main('sensor.ohio_state_buckeyes') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
|
||||
{{ sports_main('sensor.toledo_rockets') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_vikings') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
|
||||
{{ sports_main('sensor.san_francisco_49ers') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
|
||||
{{ sports_main('sensor.cleveland_guardians') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
|
||||
{{ sports_main('sensor.minnesota_twins') }}
|
||||
{% endif %}
|
||||
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
|
||||
{{ sports_main('sensor.los_angeles_dodgers') }}
|
||||
{% endif %}
|
||||
{{ sports_updates('pregame') }}
|
||||
{{ sports_updates('main') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
|
Reference in New Issue
Block a user