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

I’ve been working on extending the ha-nfl and ha-nfl-card custom component and card, which provide real-team game status for NFL teams, to support multiple sports and leagues. The result is TeamTracker and TeamTracker-Card, which support teams in various football, basketball, baseball, hockey, and soccer leagues.

It’s to the point where I could use some more eyes on them to get feedback. If anyone is willing to help beta test, you can install via HACS after adding the following two repositories. Log any issues, questions, or suggestions at the repository.

Thanks for your help.

Details from the Readme’s…

Team Tracker: Real-time Sports Scores in Home Assistant

This integration provides real-time scores for teams in multiple professional (NBA, NFL, NHL, MLB, MLS, and more), college (NCAA), and international (soccer) sports using ESPN APIs, and creates a sensor with attributes for the details of the game.

This integration is a fork of the excellent ha-nfl custom component by @zacs. Thanks for the starting place!

Supported Sports / Leagues

  • Baseball - MLB
  • Basketball - NBA, WNBA, NCAAM, NCAAW, WNBA
  • Football - NFL, NCAAF
  • Hockey - NHL (Coming Soon)
  • U.S. Soccer - MLS, NWSL
  • International Soccer - BUND (German Bundesliga), EPL (English Premiere League), LIGA (Spanish LaLiga), LIG1 (French Ligue 1), SERA (Italian Serie A)

It is also possible to set up additional sports/leagues if you know the ESPN API.

Team Tracker Card: Home Assistant Real-Time Sports Score Card

A Home Assistant frontend custom card that will display real-time updates for teams tracked with the ha-teamtracker integration by @vasqued2. Has custom in-game layouts for football, baseball, basketball, and soccer.

This card was strongly based on the fantastic ha-nfl-card by @D34DC3N73R.

PRE Game Examples

IN Game Examples

IN-baseball2

IN-soccer2

POST Game Examples

POST-soccer2

14 Likes

Installed and running. Most teams I entered into yaml show up fine but and few like the Saints, LSU, ULL, Miss State and a couple others are state: “not found”. Only thing i can think of is the abbreviation I’m using is wrong but those college football abbreviations are working with gopher_daves’ college football integration so I’m not sure. But very cool and the Cards look great; watching the Braves’ ticker right now.

1 Like

I think this in the doc may need an update:

- platform: teamtracker
  league_id: NFL
  team_id: CLE
  name: Browns

Using the configuration example above the sensor will then be called "sensor.seahawks".

Seahawks? Unless, of course, you are a huge Cleveland Browns fan!

I am unable to get it to work with Texas Tech. I am using TTU which appears to be correct but all that shows is no upcoming games found. Please advise as this looks really nice and I would love to get it working. Thanks!

For the NFL Lovers:

##
##  NFL Teams
##
- platform: teamtracker
  league_id: NFL
  team_id: DET
  name: Detroit Lions
- platform: teamtracker
  league_id: NFL
  team_id: GB
  name: Green Bay
- platform: teamtracker
  league_id: NFL
  team_id: CHI
  name: Chicago Bears
- platform: teamtracker
  league_id: NFL
  team_id: MIN
  name: Minnesota Vikings
- platform: teamtracker
  league_id: NFL
  team_id: BUF
  name: Buffalo Bills
- platform: teamtracker
  league_id: NFL
  team_id: MIA
  name: Miami Dolphins
- platform: teamtracker
  league_id: NFL
  team_id: NE
  name: New England Patriots
- platform: teamtracker
  league_id: NFL
  team_id: NYJ
  name: New York Jets
- platform: teamtracker
  league_id: NFL
  team_id: DAL
  name: Dallas Cowboys
- platform: teamtracker
  league_id: NFL
  team_id: NYG
  name: New York Giants
- platform: teamtracker
  league_id: NFL
  team_id: PHI
  name: Philadelphia Eagles
- platform: teamtracker
  league_id: NFL
  team_id: WSH
  name: Washington Commanders
- platform: teamtracker
  league_id: NFL
  team_id: BAL
  name: Baltimore Ravens
- platform: teamtracker
  league_id: NFL
  team_id: CIN
  name: Cincinnati Bengals
- platform: teamtracker
  league_id: NFL
  team_id: CLE
  name: Cleveland Browns
- platform: teamtracker
  league_id: NFL
  team_id: PIT
  name: Pittsburg Steelers
- platform: teamtracker
  league_id: NFL
  team_id: HOU
  name: Houston Texans
- platform: teamtracker
  league_id: NFL
  team_id: IND
  name: Indianapolis Colts
- platform: teamtracker
  league_id: NFL
  team_id: JAX
  name: Jacksonville Jaguars
- platform: teamtracker
  league_id: NFL
  team_id: TEN
  name: Tennessee Titans
- platform: teamtracker
  league_id: NFL
  team_id: ATL
  name: Atlanta Falcons
- platform: teamtracker
  league_id: NFL
  team_id: CAR
  name: Carolina Panthers
- platform: teamtracker
  league_id: NFL
  team_id: NO
  name: New Orleans Saints
- platform: teamtracker
  league_id: NFL
  team_id: TB
  name: Tampa Bay Buccaneers
- platform: teamtracker
  league_id: NFL
  team_id: DEN
  name: Denver Broncos
- platform: teamtracker
  league_id: NFL
  team_id: KC
  name: Kansas City Chiefs
- platform: teamtracker
  league_id: NFL
  team_id: LV
  name: Las Vegas Raiders
- platform: teamtracker
  league_id: NFL
  team_id: LAC
  name: Los Angeles Chargers
- platform: teamtracker
  league_id: NFL
  team_id: ARI
  name: Arizona Cardinals
- platform: teamtracker
  league_id: NFL
  team_id: LAR
  name: Los Angeles Rams
- platform: teamtracker
  league_id: NFL
  team_id: SF
  name: "San Francisco 49ers"
- platform: teamtracker
  league_id: NFL
  team_id: SEA
  name: Seattle Seahawks

And in Lovelace (using auto-entities, styled for my phone systems):

type: custom:auto-entities
unique: true
show_empty: false
card:
  type: entities
filter:
  template: |
    {%- for team in integration_entities("teamtracker") -%}
      {%- if state_attr(team, "team_homeaway") == "home" -%}
        {{{"type": "custom:teamtracker-card",
          "entity": team }}},
      {%- endif -%}
    {%- endfor -%}
  exclude:
    - entity_id: '*team_tracker*'
options: null
sort:
  method: attribute
  attribute: date

Shows matchups by only getting the home teams (instead of every team).
Now, next I am going to try and hook this up to my DirecTV integration so that you can select the game and put it on a specific TV.

7 Likes

Thanks all! It appears as though the API for NCAA Football only returns scores for games involving ranked teams by default. This was exactly the kind of feedback I was looking for. I’m working on a way to enter a conference identifier that will pull in games involving two unranked teams before next week’s games.

Makes since. I am keeping my sensors and the Lovelace cards that have a “not found” state and I’ll let u know when they come online. I still wonder what’s up with the Saints though; my team ID is: NO for that sensor. I have many sensors though spanning multiple leagues with your integration that are working beautifully…good job!

You are correct about new orleans I think. I see it in mine because I only show home teams for the upcoming games. If I look at the state though, I see:

attribution: Data provided by ESPN
sport: football
league: NFL
league_logo: https://a.espncdn.com/i/teamlogos/leagues/500/nfl.png
date: null
kickoff_in: null
quarter: null
clock: null
venue: null
location: null
tv_network: null
odds: null
overunder: null
possession: null
last_play: null
down_distance_text: null
team_abbr: 'FALSE'
team_id: null
team_name: null
team_record: null
team_homeaway: null
team_logo: null
team_colors: null
team_score: null
team_win_probability: null
team_timeouts: null

Another thing I noticed is the teams ranking isn’t an attribute. Is that something that we can’t pull from espn?

More info …

    {%- for team in integration_entities("teamtracker") -%}
      {{[ team, state_attr(team, "team_name"), states(team)]}},
    {%- endfor -%}

Yields this (You can see the issue with New Orleans) … snipped the teams around them:

[
    "sensor.las_vegas_raiders",
    "Raiders",
    "PRE"
  ],
  [
    "sensor.new_orleans_saints",
    null,
    "NOT_FOUND"
  ],
  [
    "sensor.chicago_bears",
    "Bears",
    "PRE"
  ],

I can test in a bit, but it could be that NO is a reserved thing and needs to be quoted as in:

- platform: teamtracker
  league_id: NFL
  team_id: "NO"
  name: New Orleans Saints

Good find kbrown. I tested it though and it makes the sensor “unavailable” instead of state: “not found”.

Shucks. Then it is in the code deeper, @vasqued2 will need to look at it I guess. I assume you restarted HA after as I could get these to update without a restart.

Yeah kbrown. Even tried single quotes and another restart for ya.

Maybe they kicked New Orleans out of the NFL? :laughing:

1 Like

Good news is I have the LSU Neck Chant playing through my raspiaudio muse proto when kickoff happens. For anyone reading that doesn’t know the Neck chant…beware before DuckDuckGoingit.

Anyone smart got out of NOLA years ago.

This is amazing! Great work! Will let you know if any issues after the games this week

If you are using YAML to set up the sensor, it is interpreting NO, as No, which gets interpreted as False, which causes all sorts of problems.

The following worked for me:

Remove the YAML. Restart. Go to the Entity list in Devices and Services and delete the sensor, or sensors if you have duplicates. Add the correct YAML w/ the double quotes. Restart. Sensor should be created and working after the restart.

For some reason, it didn’t work if I didn’t delete the old sensor before correcting the YAML. Not sure if that’s a problem on my side or just how HA works. I’ll look into it.

  - platform: teamtracker
    league_id: NFL
    team_id: "NO"
    name: test_tt
1 Like

Good job vasqued2. Followed your directions and saints sensor and card are working. Kbrown nailed it.

Let’s get some unranked ncaaf teams in here and this integration is ready to go.

Trying to get this to work for Liverpool FC but showing “NOT_FOUND”. Used EPL as the league and LIV as the team. Any suggestions on why it might not be working?