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

selam emre teşekkür ederim.

will try your yaml. added with ui but dont think it is working.

I added via Uİ with the right paths and it works great.
but i cant see the CL league game.
tried it but it didnt work.
can you get the CL game info.

Thank you so much, this is what I have so far. I’m going to add the direct tv function as a condition once my device comes in the mail and setup. But once they score, the lights will turn on and turn off after 10 seconds. I also created a toggle switch to be on in order for any of this to work. Due to don’t want to annoy my wife if I’m not watching the game, lol.

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 }}"
action:
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.cowboys_color
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.living_room_lights
mode: single

Add a state condition under conditions for your switch to be on.

I did

@jeffcrum if i wanted to have my lights flash blue first and then gray (team colors). I would create a scene for both colors and just add a delay in the action part between them, right?

I don’t have any lights and have not messed with scenes. But, sounds right to me.

You will be able to test if your DirecTV is on but you will not be able to test if it is playing your game. Well maybe but only parsing name off of currently playing and not sure it would show like Lions @ Chiefs or just something like NFL Football. If you are after out of.market games live, which is the only way your lights will work which is live, then only YouTubeTV or a sublicense of them has games this year.

It is not clear to me what LG Cowboys is

LG cowboys is just a switch toggle i made so it will only work if i turn it on so it wont turn on if my wife is watching tv instead. To not upset her.

Another note for you. The team colors are inside the team tracker card as attributes. You could grab them from there if you wanted to be more generic and fixed to one team.

Example just from dev tools, of course you could use the sensor that triggered the automation:

If you implemented that way, you could use the same automation with multiple different teams and get the lights to trigger with their colors. I kinda like that and I may add but only for my favorite teams. Would be too much to run for the entire NFL.

1 Like

so my automation wouldn’t work with the direct tv integration. Or at least win I watch the game, the team tracker would keep up in almost real time for scores correct to trigger the lights?

Was fine last year. This year DirecTV does not have the out of market live games. They have out of market games “after they are over”. Teamtracker is live sports, not what is shown on your TV.

Yes when you watch the game, Teamtracker keeps up (at least) … if the game is on NFL channel it is actually a play ahead. If the game is on Prime, all bets are off as Prime tends to slow down and could be two or three plays behind and way out of sync (it sucks). If the game is on local TV because it is your team, it is near perfect. It remains to be seen how YouTubeTV will be, but my guess is closer to Prime than DirectTV. Last year with DirecTV, it was perfectly in sync and in fact I could have 4 TVs in various rooms on the game, all in sync.

Would I add that in a template? or call service?

Most of the cowboys would be local channel, except Monday night football and Thursday night football.

Here’s my example in a script for Lions only, this could easily move to an automation based on a trigger. I was only testing the lights. Couple of notes …

Depending on the lights you have and how they are controlled you need to be careful with powering them on and then sending commands, this reset my lights (and I had to re-pair them) once until I put in a delay.

The team colors are Hex RGB colors and you need R, G, B as integers. This template handles that.

So this could easily be moved to an automation and the ‘sensor.detroit_lions’ changed to be the trigger_id of the team that scored a TD. However, you could only do tis for a few teams as you will get score changes all the time and they would queue up or be unpredictable.

Mine turns on the switch for the lights.
Waits 5 seconds to not reset the LED controller.
Then turns on the controller for the LED strip to the main color.(Lions Blue)
Waits 2 seconds
Then turns on the controller for the LED strip to the secondary color (Lions Gray)
Repeats the loop 10 times.
Turns off the switch for the lights.

alias: Test Football Lights
sequence:        
  - service: homeassistant.turn_on
    data: {}
    target:
      entity_id: switch.switchlinc_relay_dual_band_1f_a8_f1
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - repeat:
      count: "10"
      sequence:
        - service: light.turn_on
          data_template:
            brightness_pct: 100
            rgb_color:
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[0][1:3] |
                int(base=16) }}
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[0][3:5] |
                int(base=16) }}
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[0][5:7] |
                int(base=16) }}
          target:
            entity_id: light.triangle_leds
        - delay:
            hours: 0
            minutes: 0
            seconds: 2
            milliseconds: 0
        - service: light.turn_on
          data_template:
            brightness_pct: 100
            rgb_color:
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[1][1:3] |
                int(base=16) }}
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[1][3:5] |
                int(base=16) }}
              - >-
                {{ state_attr('sensor.detroit_lions','team_colors')[1][5:7] |
                int(base=16) }}
          target:
            entity_id: light.triangle_leds
  - service: homeassistant.turn_off
    data: {}
    target:
      entity_id: switch.switchlinc_relay_dual_band_1f_a8_f1
mode: single

Now I have a set of RGBW lights I need to add into the mix. Then I will move to an automation that only triggers when a team on my favorites list scores. Live in Cali but grew up in Michigan so my Favs are set to Lions, Tigers, Pistons, Michigan State.

2 Likes

My lights are just regular kasa color light bulbs. I think there just RGB
https://www.amazon.com/gp/product/B08TB8Z5HF/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

I added this to my action on my cowboys script. May I as what is the "[1:3] | int(base=16) }}"for in the template. Trying to learn new things?

repeat:
  count: "10"
  sequence:
    - service: light.turn_on
      data_template:
        brightness_pct: 100
        rgb_color:
          - >-
            {{ state_attr('sensor.dallas_cowboys', 'team_colors')[0][1:3] |
            int(base=16) }}
          - >-
            {{ state_attr('sensor.dallas_cowboys', 'team_colors')[1][3:5] |
            int(base=16) }}
      target:
        entity_id: light.living_room_lights

using developer tools and testing is your friend, nothing could be better

{{ state_attr('sensor.dallas_cowboys', 'team_colors')[0][1:3] | int(base=16) }}

Lets look at this:

That should explain it all. A Hex color is #RRGGBB so you parse off the RR, GG, BB and convert to decimals to get the R,G.B colors as decimals (0-255).

Your template above needs (at least) three entries, not two as you have shown.
RGB = 3 entries
RGBW = 4 entries
RGBWW = 5 entries

You also took the the first color entry (Red) from the first color in the list and the second color (Green) from the second color in the list.

The two colors in the list are the two main colors — like blue and grey … the team colors.

If you examine my code above, it sends the Detroit Lions main color (call it blue) waits a few seconds and then send the Detroit Lions secondary color (call it silver). Don;t pick a color from each, pick the full set from both.

Take what I posted above and create a tempoprary script. Change the sensor to your light, change the Lions to the Cowboys, then run it right in the script editor. Mine could be confusing because all my LEDs are behind a controllable switch. I never turn off the LEDs … I turn off the switch that sends power to them. Hence that script turns on the switch, iterates the lights, turns off the switch.

You would modify that and remove the turn on switch to turn on LEDs.

1 Like

Here i my final script before I plug it in. I modified it to run the color changes in parallel for both sets of lights. i could actually swap colors so blue on one and gray on the other … but hey:

alias: Test Football Lights
sequence:
  - service: homeassistant.turn_on
    data: {}
    target:
      entity_id:
        - switch.switchlinc_relay_dual_band_1f_a8_f1
        - switch.switchlinc_relay_dual_band_1f_ad_f7
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - repeat:
      count: "10"
      sequence:
        - parallel:
          - service: light.turn_on
            data_template:
              brightness_pct: 100
              transition: 0
              rgbw_color:
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][1:3] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][3:5] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][5:7] |
                  int(base=16) }}
                - 255
            target:
              entity_id:
                - light.triangle_leds
          - service: light.turn_on
            data_template:
              brightness_pct: 100
              transition: 0
              rgbww_color:
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][1:3] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][3:5] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[0][5:7] |
                  int(base=16) }}
                - 150
                - 0
            target:
              entity_id:
                - light.pergola_leds
        - delay:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
        - parallel:
          - service: light.turn_on
            data_template:
              brightness_pct: 100
              transition: 0
              rgbw_color:
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][1:3] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][3:5] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][5:7] |
                  int(base=16) }}
                - 255
            target:
              entity_id:
                - light.triangle_leds
          - service: light.turn_on
            data_template:
              brightness_pct: 100
              transition: 0
              rgbww_color:
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][1:3] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][3:5] |
                  int(base=16) }}
                - >-
                  {{ state_attr('sensor.detroit_lions','team_colors')[1][5:7] |
                  int(base=16) }}
                - 150
                - 0
            target:
              entity_id:
                - light.pergola_leds
  - service: homeassistant.turn_off
    data: {}
    target:
      entity_id:
        - switch.switchlinc_relay_dual_band_1f_a8_f1
        - switch.switchlinc_relay_dual_band_1f_ad_f7
mode: single

1 Like

Is there Serbian Superliga? I tried using srb.1, didn’t work.