Real-Time Sports Scores w/ TeamTracker and TeamTracker-Card (Beta)

You need to post those questions in the Teamtracker blog. We are a group that uses my code for stats and teamtracker to do other things. If you have an issue getting info, the teamtracker blog is where you should be

Where is teamtracker blog?

I use this bluleprint. It captures the current scene, flashes the lights and returns the scene.

1 Like

Sorry, you are in it (I had mixed up my postings with the Sports Standings and Scores blog).
Although this topic is marked solved (don’t know why). I can look at your request in a bit and see.

I would think if not listed here, it is not available:

1 Like

It might be possible with the DirecTV integration. Although this is a replay, the media_player attributes might contain what you need for a condition instead of the switch (in case you forget to throw it) … or you could automate throwing the switch to “on” when the media_title contains “Cowboys”.

However, if you are playing “Mama Don’t Let your Babies Grow Up to be Cowboys” … but you would not get any scoring while that happens. Best would be conditions like media_player media_title contains “@ Cowboys” or “Cowboys @”. Or look at the state when a live game in on and see if the media_series_title is populated, then it would have “Dallas Cowboys”

Thanks for this! I have never used scene_create and scene.turn_on before. This is a great addition. I added this to my script so that the original state of the lights is returned. I have many other places in my automations/scripts where this would be a fit.

Thanks, I’m using an android TV remote as I got the Gemini air direct TV remote streaming instead of satellite, so I can’t use the direct TV integration. Luckily, it picked up this. So I will see what displays when I watch the last Cowboys’ preseason game this Saturday.

What are the two entities? Is one a media_player (one is likely a remote).
If one is a media_player, turn on something and look at the state in developer tools.

I have it on ESPN right now and this is the info it gives back!

Doesn;t look good then. I have a dashboard I use for development. And one this dashboard I have this card:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: media_player*
  exclude: []

This will display every single media_player entity I have and information bout what is going on. Like my Deck DirecTV is showing your Cowboys game right now. Perhaps it can be found in another media_player entity (like the TV … or?)

You see my DirecTV media_player shows me what’s playing, but two entries above is “Office Vizio” which is the TV it is playing on and it only shows “Cast” and no info about what is actually on. SInce the new box you have is pure Cast, likely you need to delve deeper into commands to get into what info you may get from the stream.

And thanks for this … this is another reason I will not switch out my satellite dish and Genie boxes for Gemini unless we can look through your information and get better info. I wrote a very complex DirecTV remote with Vizio TV integration that works perfect. I hate to lose it’s functionality.

As a side note … I happen to know the Product Manager for the Gemini box. I will ask if there is any REST interface that I am not aware of as this could solve it.

Looks like it is working …

Thanks for your help. I had to take back the DirecTV due to they had hidden fees and charge me almost double what they offered me. So I don’t have DirecTV anymore. I decided to go with sling TV and buy a local antenna for my local channels. Come out way cheaper than direct TV.

So I’m gonna use this blueprint and just add my own conditions with it: https://github.com/zacs/ha-nfl/blob/5e8805d79b113266e51aed4083329290fe5423aa/blueprints/nfl-game-score-lights.yaml

If that does not work they way I want. I still have my original automation backup:

alias: How Bout Them Cowboys
description: Notify Team Score
trigger:
  - platform: state
    entity_id:
      - sensor.dallas_cowboys
    attribute: team_score
condition:
  - condition: and
    conditions:
      - condition: template
        value_template: "{{ trigger.to_state == 'IN' }}"
      - condition: template
        value_template: "{{ trigger.to_state.team_score - trigger.from_state.team_score > 1 }}"
  - condition: state
    entity_id: person.animeking
    state: home
  - condition: state
    entity_id: input_boolean.lg_cowboys_on
    state: "on"
action:
  - service: light.turn_on
    data_template:
      brightness_pct: 30
      rgb_color:
        - >-
          {{ state_attr('sensor.dallas_cowboys', 'team_colors')[0][1:3] |
          int(base=16) }}
        - >-
          {{ state_attr('sensor.dallas_cowboys', 'team_colors')[0][3:5] |
          int(base=16) }}
        - >-
          {{ state_attr('sensor.dallas_cowboys', 'team_colors')[0][5:7] |
          int(base=16) }}
    target:
      entity_id: light.living_room_lights
    alias: Cowboys Blue
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.living_room_lights
mode: restart

Okay. First chance to test it.



Thinking I like it!

1 Like

Still needs a little tweak, can get out of sync I think … in logs I see many of these:

  • TemplateError(‘UndefinedError: list object has no element 5’) while processing template ‘Template<template=({% set redzone = namespace(teams=[]) %} {%- for team in integration_entities(“teamtracker”) -%} {%- if state_attr(team, “league”) == “NFL” -%} {%- if states(team) == “IN” -%} {%- if state_attr(team,‘possession’) is not none -%} {% set possession = state_attr(team,‘possession’) %} {% set team_id = state_attr(team,‘team_id’) %} {% set opponent_id = state_attr(team,‘opponent_id’) %} {% set team_abbr = state_attr(team,‘team_abbr’) %} {% set opponent_abbr = state_attr(team,‘opponent_abbr’) %} {% set down_distance_text = state_attr(team,‘down_distance_text’) %} {% set down_distance_endzone = state_attr(team,‘down_distance_text’).split(’ ‘)[4] %} {% set down_distance_yardline = state_attr(team,‘down_distance_text’).split(’ ‘)[5] %} {% set possession_abbr = opponent_abbr if opponent_id == possession else team_abbr %} {% set non_possession_abbr = opponent_abbr if opponent_id != possession else team_abbr %} {%- if (possession_abbr != down_distance_endzone) and (down_distance_yardline | int) <= 20 %} {% set redzone.teams = redzone.teams + [team] %} {% endif %} {% endif %} {% endif %} {% endif %} {% endfor %} {{ redzone.teams }}) renders=777294>’ for attribute ‘teams’ in entity ‘sensor.nfl_red_zone’

And this …

  • TemplateError(‘UndefinedError: ‘None’ has no attribute ‘split’’) while processing template ‘Template<template=({% set redzone = namespace(teams=[]) %} {%- for team in integration_entities(“teamtracker”) -%} {%- if state_attr(team, “league”) == “NFL” -%} {%- if states(team) == “IN” -%} {%- if state_attr(team, “team_homeaway”) == “home” -%} {%- if state_attr(team,‘possession’) is not none -%} {% set possession = state_attr(team,‘possession’) %} {% set team_id = state_attr(team,‘team_id’) %} {% set opponent_id = state_attr(team,‘opponent_id’) %} {% set team_abbr = state_attr(team,‘team_abbr’) %} {% set opponent_abbr = state_attr(team,‘opponent_abbr’) %} {% set down_distance_text = state_attr(team,‘down_distance_text’) %} {% set down_distance_endzone = state_attr(team,‘down_distance_text’).split(’ ‘)[4] %} {% set down_distance_yardline = state_attr(team,‘down_distance_text’).split(’ ‘)[5] %} {% set possession_abbr = opponent_abbr if opponent_id == possession else team_abbr %} {% set non_possession_abbr = opponent_abbr if opponent_id != possession else team_abbr %} {%- if (possession_abbr != down_distance_endzone) and (down_distance_yardline | int) <= 20 %} {% set redzone.teams = redzone.teams + [team] %} {% endif %} {% endif %} {% endif %} {% endif %} {% endif %} {% endfor %} {{ redzone.teams | count }}) renders=776182>’ for attribute ‘_attr_native_value’ in entity ‘sensor.nfl_red_zone’

So what happens I believe is that sometimes the game is still IN, teams still in Red Zone but the message is not down and distance text that is expected. So it needs a test to make sure that message is structured right or abort I guess. Have to watch all the messages.

Yup. down_distance_text is none during half time. I suspect other time like between scores as well.

Question is … is it none or is it blank?

down_distance_text: null

So it should be tested with “is not none”.

Testing in Dev Tools, it shows None.
I believe that to be non existent.

I added this if/endif around here.

            {%- if state_attr(team, "down_distance_text") %}
            {% set down_distance_endzone = state_attr(team,'down_distance_text').split(' ')[4] %}
            {% set down_distance_yardline = state_attr(team,'down_distance_text').split(' ')[5] %}
            {% set possession_abbr = opponent_abbr if opponent_id == possession else team_abbr %}
            {% set non_possession_abbr = opponent_abbr if opponent_id != possession else team_abbr %}
            {%- if (possession_abbr != down_distance_endzone) and (down_distance_yardline | int) <= 20 %}
            {% set redzone.teams = redzone.teams + [team] %}
            {% endif %}
            {% endif %}

Watching it now to see how it does.

Did the same except I used:

            {% if state_attr(team,'down_distance_text') is not none %}
            {% set down_distance_text = state_attr(team,'down_distance_text') %}
           ....

I think that did it. No errors and the redzone is working.