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

Where do I add Custom API Configurations
For AFL , is a yaml comfg ? I’m new to yaml and don’t know where to start or in the espn integration

Hello all :slight_smile:

This is a great plugin. I would like to use/check more leagues from Europe and more sports - like the German hockey league. I found another page (not ESPN) with some scores. Do you think we can use it? Or maybe you know another plugin like this?

https://betsapi.com/t/9426/Eisbaren-Berlin

Best,
Kamyk

I think there is a problem with the team tracker with update 2024.5.0

All my team sensors are unavailible

for example sensor.new_york_rangers

I also get this errors in the logs:

  • State attributes for sensor.nhl_west_central exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
  • State attributes for sensor.nhl_east_atlantic exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
  • State attributes for sensor.nhl_east_metropolitan exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
  • State attributes for sensor.nhl_west_pacific exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
  • State attributes for sensor.nhl_wildcard_standings exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored

Have anyone else this problems? And how we can fix it? Is a Team Tracker update necessary?

The second item is not an error. It is information telling you that very large attributes are not managed in the database which is a good thing.

ok thats good.

But why my team sensors are all unavailible?

For example this is my sensor in the yaml:

  - platform: teamtracker
    league_id: NHL
    team_id: NYR
    name: New York Rangers

I don´t change anything on this.

So it is a teamtracker issue. That is not the standings part. Mine NHL seems empty also yet todays games show up. It could be an issue at ESPN

the todays games are also empty here

Edit: There is an issure on gibhub:

Sorry for the delay with this one. I was out and wasn’t checking the issues and delayed taking the update so missed it initially.

The issue was in code that was in the original nfl sensor this was based on. As such, I didn’t fully understand what it was trying to do as it had always just worked. I was finally able to develop a fix that works for me and I don’t believe it has any unintended side effects, which was one of my concerns without fully understanding why the original code was the way it was.

I have released it as a beta version. If you Redownload from HACS and select “Show beta versions” you should get the option to download version v0.12.0.beta. Try that.

Assuming it’s stable for me today and I don’t hear any issues from others, I will release it widespread tomorrow. If you try it, let me know if it works or you still have the issue.

1 Like

Thanks. It is working for me.

Not sure if its just me but I cant get it to recognize any of my “Team” sensors in my sensor.yaml file. If I add them through the integration it works fine, but wont recognize them in the sensor.yaml file if I add them to the sensors.yaml or configuration.yaml if not using sensor.yaml.

  • platform: teamtracker
    league_id: NFL
    team_id: DET
    name: Detroit Lions

Following error AttributeError: ‘NodeDictClass’ object has no attribute ‘entry_id’
2024-05-18 12:27:43.283 INFO (MainThread) [custom_components.teamtracker.sensor] Green Bay: Setting up sensor from YAML using TeamTracker v0.11.0, if you have any issues please report them here: GitHub - vasqued2/ha-teamtracker: Home Assistant integration that provides real-time scores in multiple professional (NBA, NFL, NHL, MLB, MLS, and more), college (NCAA), and international (soccer, golf, tennis, mma, racing) sports using ESPN APIs.
2024-05-18 12:27:43.283 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up teamtracker platform for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 356, in _async_setup_platform
await asyncio.shield(awaitable)
File “/config/custom_components/teamtracker/sensor.py”, line 118, in async_setup_platform
config.entry_id = slugify(f"{config.get(CONF_TEAM_ID)}")

It’s a known issue w/ HA 2024.05. You can manually download v0.12.0.beta which should fix it or you can wait until tomorrow.

As long I don’t see any problems tonight with the beta version and I get no reports of other problems, I plan to release v0.12.0 tomorrow which should fix it.

Sorry wrong thread. Just realized the live card is a different integration.

Thanks beta works but cant get Live- Post/Pregame cards to show up.

1 Like

Can you show some code of what is not working?

Thanks for the update!

v0.12.0 is available and should fix the YAML problem w/ HA 2024.05

2 Likes

With the EURO coming up in Germany in 2 weeks - is there a way to load an entire event into this? And show all scores of all teams involved?
Could be useful for all sort of events, March Madness, World Cup etc.

The easiest way is to download the team tracker map and team tracker from HACS. Then download the team tracker integration and enter all teams there

Albanien
League: Custom: Specify sport and league path
Team/Atlete: ALB
Friendly Name: Albanien
Sport Path: soccer
Leaque Path: uefa.euro

Belgien
League: Custom: Specify sport and league path
Team/Atlete: BEL
Friendly Name: Belgien
Sport Path: soccer
Leaque Path: uefa.euro

Dänemark
League: Custom: Specify sport and league path
Team/Atlete: DEN
Friendly Name: Dänemark
Sport Path: soccer
Leaque Path: uefa.euro

Deutschland
League: Custom: Specify sport and league path
Team/Atlete: GER
Friendly Name: Deutschland
Sport Path: soccer
Leaque Path: uefa.euro

England
League: Custom: Specify sport and league path
Team/Atlete: ENG
Friendly Name: England
Sport Path: soccer
Leaque Path: uefa.euro

Frankreich
League: Custom: Specify sport and league path
Team/Atlete: FRA
Friendly Name: Frankreich
Sport Path: soccer
Leaque Path: uefa.euro

Georgien
League: Custom: Specify sport and league path
Team/Atlete: GEO
Friendly Name: Georgien
Sport Path: soccer
Leaque Path: uefa.euro

Italien
League: Custom: Specify sport and league path
Team/Atlete: ITA
Friendly Name: Italien
Sport Path: soccer
Leaque Path: uefa.euro

Kroatien
League: Custom: Specify sport and league path
Team/Atlete: CRO
Friendly Name: Kroatien
Sport Path: soccer
Leaque Path: uefa.euro

Niederland
League: Custom: Specify sport and league path
Team/Atlete: NED
Friendly Name: Niederland
Sport Path: soccer
Leaque Path: uefa.euro

Österreich
League: Custom: Specify sport and league path
Team/Atlete: AUT
Friendly Name: Österreich
Sport Path: soccer
Leaque Path: uefa.euro

Polen
League: Custom: Specify sport and league path
Team/Atlete: POL
Friendly Name: Polen
Sport Path: soccer
Leaque Path: uefa.euro

Portugal
League: Custom: Specify sport and league path
Team/Atlete: POR
Friendly Name: Portugal
Sport Path: soccer
Leaque Path: uefa.euro

Romänien
League: Custom: Specify sport and league path
Team/Atlete: ROU
Friendly Name: Romänien
Sport Path: soccer
Leaque Path: uefa.euro

Team/Atlete: SCO
Friendly Name: Schottland
Sport Path: soccer
Leaque Path: uefa.euro

Schweiz
League: Custom: Specify sport and league path
Team/Atlete: SUI
Friendly Name: Schweiz
Sport Path: soccer
Leaque Path: uefa.euro

Serbien
League: Custom: Specify sport and league path
Team/Atlete: SRB
Friendly Name: Serbien
Sport Path: soccer
Leaque Path: uefa.euro

Slovakai
League: Custom: Specify sport and league path
Team/Atlete: SVK
Friendly Name: Slovakai
Sport Path: soccer
Leaque Path: uefa.euro

Slovenien
League: Custom: Specify sport and league path
Team/Atlete: SVN
Friendly Name: Slovenien
Sport Path: soccer
Leaque Path: uefa.euro

Spanien
League: Custom: Specify sport and league path
Team/Atlete: ESP
Friendly Name: Spanien
Sport Path: soccer
Leaque Path: uefa.euro

Tschechien
League: Custom: Specify sport and league path
Team/Atlete: CZE
Friendly Name: Tschechien
Sport Path: soccer
Leaque Path: uefa.euro

Türkei
League: Custom: Specify sport and league path
Team/Atlete: TUR
Friendly Name: Türkei
Sport Path: soccer
Leaque Path: uefa.euro

Ukraine
League: Custom: Specify sport and league path
Team/Atlete: UKR
Friendly Name: Ukraine
Sport Path: soccer
Leaque Path: uefa.euro

Ungarn
League: Custom: Specify sport and league path
Team/Atlete: HUN
Friendly Name: Ungarn
Sport Path: soccer
Leaque Path: uefa.euro
2 Likes

You will also need the layout map and auto-entities map from HACS

type: custom:auto-entities
unique: true
show_empty: false
card:
  type: custom:layout-card
  layout_type: masonry
card_param: cards
filter:
  template: |
    {%- set ns = namespace(items=[]) -%}  
      {%- for team in integration_entities ("teamtracker") -%}
        {%- if states(team) and states(team) in "PRE,IN,POST" -%} 
          {%- set event_name = state_attr(team, "event_name") if state_attr(team, "event_name") else state_attr(team, "team_abbr") -%} 
          {%- set ns.items = ns.items + [{"team_sensor": team, "event_name": event_name}] -%}
          {%- endif -%}
        {%- endfor -%}  {%- for team in ns.items|unique(attribute="event_name") -%}
      {{{"type": "custom:teamtracker-card","entity": team.team_sensor, "home_side": "left" }}},
    {%- endfor -%}
  exclude:
    - entity_id: '*team_tracker*'
sort:
  method: attribute
  attribute: date
  reverse: true

If you have all so search for manual Card and paste the code.
If you are interested in football tables, please take a look at my GitHub page. There is also a table there for the European Championships.

2 Likes

I have adapted small dashboard tennis cards to my needs and created them with TailwindCSS Template Card.
However, these are a bit heavy and I feel that the loading time is a bit slow.
Can someone check the code?

POST

PRE

type: custom:tailwindcss-template-card
content: >
  <div style="display: flex; flex-direction: column; min-height: 0;
  border-radius: 0.5rem;  overflow: hidden; position: relative;">
    <!-- Hintergrund Bilder -->
    <div style="position: absolute; inset: 0; opacity: 0.3; display: flex; justify-content: space-between; align-items: center; padding-left: 0; padding-right: 0;">
      <img src="{{state_attr('sensor.tennis_atp_rafael_nadal', 'team_logo')}}" alt="Left Background" style="height: 10rem; width: 10rem;">
      <img src="{{state_attr('sensor.tennis_atp_rafael_nadal', 'opponent_logo')}}" alt="Rechts Background" style="height: 10rem; width: 10rem;">
    </div>

    <div style="position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; padding-left: 0; padding-right: 0;">
      <img src="https://a.espncdn.com/combiner/i?img=/i/headshots/tennis/players/full/{{state_attr('sensor.tennis_atp_rafael_nadal', 'team_id')}}.png" alt="Left Foreground" style="height: 7.5rem; width: 10rem;">
      <img src="https://a.espncdn.com/combiner/i?img=/i/headshots/tennis/players/full/{{state_attr('sensor.tennis_atp_rafael_nadal', 'opponent_id')}}.png" alt="" style="height: 7.5rem; width: 10rem;">
    </div>

    <div style="flex: 1; padding: 0.75rem; position: relative; z-index: 0;">
      <center>
        <p style="color: white; font-size: 1rem; font-weight: bold;">

    {% set down_distance_text = state_attr('sensor.tennis_atp_rafael_nadal',
    'down_distance_text') %}  {% set date_attr =
    state_attr('sensor.tennis_atp_rafael_nadal', 'date') %} {% if date_attr %}
        {% set date = date_attr | as_timestamp | timestamp_custom('%d.%m.%y um %H:%M Uhr') %}
    {% else %}
        {% set date = 'Kein Datum vorhanden' %}
    {% endif %}

    {% set uhr_attr = state_attr('sensor.tennis_atp_rafael_nadal', 'date') %}
    {% if uhr_attr %}
        {% set uhr = uhr_attr | as_timestamp | timestamp_custom('%H:%M Uhr') %}
    {% else %}
        {% set uhr = 'Keine Uhrzeit vorhanden' %}
    {% endif %}

    {% set kickoff_in = state_attr('sensor.tennis_atp_rafael_nadal',
    'kickoff_in') %} {% set event_name =
    state_attr('sensor.tennis_atp_rafael_nadal', 'event_name') %} {% set venue
    = state_attr('sensor.tennis_atp_rafael_nadal', 'venue') %} {% set location
    = state_attr('sensor.tennis_atp_rafael_nadal', 'location') %} {% set clock
    = state_attr('sensor.tennis_atp_rafael_nadal', 'clock') %} {% set
    team_score = state_attr('sensor.tennis_atp_rafael_nadal', 'team_score') %}

      {% set translations = {'Round 1': 'Runde 1', 'Round 2': 'Runde 2', 'Round 3': 'Runde 3', 'Round 4': 'Runde 4', 'Quarterfinal': 'Viertelfinale', 'Semifinal': 'Halbfinale', 'Final': 'Finale'} %}
      {% set down_distance_text = translations.get(state_attr('sensor.tennis_atp_rafael_nadal', 'down_distance_text'), state_attr('sensor.tennis_atp_rafael_nadal', 'down_distance_text')) %}

    {% set opponent_score = state_attr('sensor.tennis_atp_rafael_nadal',
    'opponent_score') %} {% set gegner_name =
    state_attr('sensor.tennis_atp_rafael_nadal', 'opponent_name') %} {% set
    spieler_name = state_attr('sensor.tennis_atp_rafael_nadal', 'team_name')
    %} {% set spieler_win_set = state_attr('sensor.tennis_atp_rafael_nadal',
    'team_sets_won') %} {% set gegner_win_set =
    state_attr('sensor.tennis_atp_rafael_nadal', 'opponent_sets_won') %} 

    {% set last_play = state_attr('sensor.tennis_atp_rafael_nadal',
    'last_play') %} 

    {% set result = "<font color=grean>Gewinnt</font>" if team_score is not none
    and opponent_score is not none and team_score > opponent_score
                      else "<font color=red>Verliert</font>" if team_score is not none and opponent_score is not none and team_score < opponent_score
                      else "<font color=yellow>Unentschieden</font>" %}

    {% if is_state('sensor.tennis_atp_rafael_nadal', 'PRE') %}

      {{ spieler_name }} gegen {{ gegner_name }}<br />
      ({{ down_distance_text }}) um {{ uhr }}<br />
      

    {% elif is_state('sensor.tennis_atp_rafael_nadal', 'IN') %}

      {% if team_score is not none and opponent_score is not none %}
       ({{ down_distance_text }}) Satzsieg {{ spieler_win_set }}:{{ gegner_win_set }}<br />
       LIVE {{ result }} {{ team_score | int }} zu {{ opponent_score | int }} im {{ clock }} <br />
      {% else %}
        Keine Ergebnisse verfügbar.
      {% endif %}

      {% if last_play %}
        {% set spieler = last_play.split(' ;')|regex_findall('(\d+)(?=\s)') %}
        {% set gegner = last_play.split(' ;')|regex_findall('\d+(?=\s*;)') %}
          
      <div style="display: inline-block; text-align: right;">
      <p class="text-white text-base font-bold">
      {{ spieler_name }}: {{ spieler|join('|') }}<br />    
      {{ gegner_name }}: {{ gegner|join('|') }}
      {% else %}
        Keine Daten gefunden.
      {% endif %}</p>
          </div>
      </div>
            
      
    {% elif is_state('sensor.tennis_atp_rafael_nadal', 'POST') %}
      {% if team_score is not none and opponent_score is not none %}
     Ergebnis ({{ down_distance_text }}):
        {{ result }} {{ team_score | int }} zu {{ opponent_score | int }} <br/>
      {% else %}
        Keine Ergebnisse verfügbar.
      {% endif %}

      {% if last_play %}
        {% set spieler = last_play.split(' ;')|regex_findall('(\d+)(?=\s)') %}
        {% set gegner = last_play.split(' ;')|regex_findall('\d+(?=\s*;)') %}
            
      <div style="display: inline-block; text-align: right;">
      <p class="text-white text-base font-bold">
      {{ spieler_name }}: {{ spieler|join('|') }}<br />
      {{ gegner_name }}: {{ gegner|join('|') }}
      {% else %}
        Keine Daten gefunden.
      {% endif %}</p>
          </div>
      </div>

    {% elif is_state('sensor.tennis_atp_rafael_nadal', 'NOT_FOUND') %}
      Momentan Keine Tennis ATP Spiele.
    {% endif %}
   
        </p>
      </center>
    </div>

    <!-- Linke transparente Klickfläche -->
    <a href="/dashboard-sport/tennis" style="position: absolute; left: 0; top: 0; bottom: 0; width: 10rem; background-color: transparent; z-index: 1;"></a>
    <!-- Rechte transparente Klickfläche -->
    <a href="https://a.espncdn.com/combiner/i?img=/i/headshots/tennis/players/full/{{state_attr('sensor.tennis_atp_rafael_nadal', 'opponent_id')}}.png" target="_blank" style="position: absolute; right: 0; top: 0; bottom: 0; width: 10rem; background-color: transparent; z-index: 1;"></a>
  </div>

  <hr style="border-color: #cbd5e0; width: 100%;" /> <p style="color: #f7fafc;
  text-align: center; font-size: 1rem; padding-top: 0.25rem; padding-bottom:
  0.25rem;">
    {{ event_name }} - {{ venue }} - {{ location }}
  </p>