Sports Standings and Scores

now that this one is done and working,
is it possible to have a page with the weekend results like this:

Thanks for your patience…

It is not normal but what can happen is you change the entity_id in the sensor but the name is the same it gets named with _2 at the end. These eventually go away or you have to delete the main one and rename the _2 one.

Through all the fiddling this probably is what happened as it did to me when I noticed I misspelled one.

1 Like

great.
and for the weekend results, it’s possible ??
Thanks.

I would think most all that information (albiet not in the same look) should be available in the TeamTracker integration. See 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.

So … one would use the custom integration like this (showing just one team):

##
## Belgian Pro League
##
- platform: teamtracker
  league_id: "XXX"
  team_id: "AND"
  sport_path: "soccer"
  league_path: "bel.1"
  name: "Anderlecht"

SHowing:

image

Or you do some custom card yourself based on the returned data. This is all the attributes brought in by TeamTracker. The state is PRE, IN, POST, BYE which is self explanatory. POST stats usually display until ESPN updates with the next game.

attribution: Data provided by ESPN
sport: soccer
league: XXX
league_logo: https://a.espncdn.com/i/leaguelogos/soccer/500/6.png
team_abbr: AND
opponent_abbr: ANT
event_name: ANT @ AND
date: 2023-08-06T11:30Z
kickoff_in: a day ago
venue: Lotto Park
location: Brussels, Belgium
tv_network: null
odds: null
overunder: null
team_name: Anderlecht
team_id: '441'
team_record: 1-0-1
team_rank: null
team_homeaway: home
team_logo: https://a.espncdn.com/i/teamlogos/soccer/500/441.png
team_colors:
  - '#695196'
  - '#fafafc'
team_score: '1'
team_win_probability: null
team_winner: true
team_timeouts: null
opponent_name: Antwerp
opponent_id: '17544'
opponent_record: 1-0-1
opponent_rank: null
opponent_homeaway: away
opponent_logo: https://a.espncdn.com/i/teamlogos/soccer/500/17544.png
opponent_colors:
  - '#C60000'
  - '#ffffff'
opponent_score: '0'
opponent_win_probability: null
opponent_winner: false
opponent_timeouts: null
quarter: 2
clock: FT
possession: null
last_play: null
down_distance_text: null
outs: null
balls: null
strikes: null
on_first: null
on_second: null
on_third: null
team_shots_on_target: null
team_total_shots: null
opponent_shots_on_target: null
opponent_total_shots: null
team_sets_won: null
opponent_sets_won: null
last_update: '2023-08-07 10:45:01-07:00'
api_message: Cached data
icon: mdi:soccer
friendly_name: Anderlecht

yes, I thought about it, but, I take my case in Belgium, there are 22 teams. if I make 22 cards (1 for each team, I would have 11 duplicate cards each time because there are only 11 matches. so how to avoid that.

in the case of this weekend, I have the duplicate card.

i have:
Anderlecht - Antwerp
but also:
Antwerp - Anderlecht.

I have posted that solution in the past. You use auto-entities and eliminate the away teams.
Example for NFL:

Perfect, it works great.
I am happy.
more than to put all that on a nice correct card.
there too, I still have work to do. I would like to reproduce the kind of page like this:

nhl

With above, the different football leagues (belgium, france, england, etc…)
and in the sub tab, the rankings, the weekend matches, and the results.

Still a lot of work I think. I’m not there yet…

in any case, I really want to thank everyone who contributed to the success of my card, and to understand the whole system a little more. I’m mostly talking about:

@kbrown01
@schmierlappe
@jeffcrum
who really helped me out.

If you still have a little time to waste and concentrate on me, I’m a buyer for the famous card that I still have to do. :grinning: :grinning: :grinning:

Here is the result of my progress.
It’s still not too bad I think, for a beginner… :grinning: :grinning: :grinning:

What do you think ?

1 Like

I think it looks excellent! Nice work.

Now this is completed I am going to remove this from my Dev environment. You seem to be well along now. Moving on to complete a huge music system rewrite!

1 Like

Are you going to re-write the music system?
If so, I’m very interested…

And thank you again for your help…

Off topic here but I helped with the Dayton Audio Dax88 integration. I have been working in a few directions but the overall system is very nice. I just added “Alexa” support as I have an Alexa hockey puck plugged into my multizone controller as one input. I downloaded a list of 10000 artist names and plugged all that together (culling the list to 1500 for now).

This new thing allow you to select Spotify or Pandora (easily could be extended to Amazon or Apple or whatever integrates to Alexa) and select an artist and it basically sends the command to Alexa.

I have wall mounted pads throughout the house … here’s a screen showing picking Marley to play on one zone in my house through Spotify.

not bad at all…
Nice work.
do you already have a link concerning this subject, or a sharing of this music system?
Me on my side, I have a abo on spotify, and I use 8 alexa in all the house and 1 sonos. so yes, your system interests me too.
a link to the forum or to the share?
thanks to you.

Here is a current card

In case anyone here would like it or wants to modify it for their own sports and leagues or favorites, here is an automation that play on Alexa when the score changes in a game. This is mine for NFL (which I think I can template, not sure): It just lists the teamtracker entities for all NFL teams.

alias: Sport Scoring
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.minnesota_vikings
      - sensor.philadelphia_eagles
      - sensor.washington_commanders
      - sensor.new_york_jets
      - sensor.tampa_bay_buccaneers
      - sensor.houston_texans
      - sensor.tennessee_titans
      - sensor.dallas_cowboys
      - sensor.chicago_bears
      - sensor.los_angeles_rams
      - sensor.carolina_panthers
      - sensor.new_york_giants
      - sensor.kansas_city_chiefs
      - sensor.buffalo_bills
      - sensor.denver_broncos
      - sensor.arizona_cardinals
      - sensor.pittsburg_steelers
      - sensor.atlanta_falcons
      - sensor.san_francisco_49ers
      - sensor.cincinnati_bengals
      - sensor.baltimore_ravens
      - sensor.detroit_lions
      - sensor.miami_dolphins
      - sensor.jacksonville_jaguars
      - sensor.cleveland_browns
      - sensor.los_angeles_chargers
      - sensor.new_orleans_saints
      - sensor.green_bay
      - sensor.indianapolis_colts
      - sensor.new_england_patriots
      - sensor.las_vegas_raiders
      - sensor.seattle_seahawks
    attribute: opponent_score
  - platform: state
    entity_id:
      - sensor.minnesota_vikings
      - sensor.philadelphia_eagles
      - sensor.washington_commanders
      - sensor.new_york_jets
      - sensor.tampa_bay_buccaneers
      - sensor.houston_texans
      - sensor.tennessee_titans
      - sensor.dallas_cowboys
      - sensor.chicago_bears
      - sensor.los_angeles_rams
      - sensor.carolina_panthers
      - sensor.new_york_giants
      - sensor.kansas_city_chiefs
      - sensor.buffalo_bills
      - sensor.denver_broncos
      - sensor.arizona_cardinals
      - sensor.pittsburg_steelers
      - sensor.atlanta_falcons
      - sensor.san_francisco_49ers
      - sensor.cincinnati_bengals
      - sensor.baltimore_ravens
      - sensor.detroit_lions
      - sensor.miami_dolphins
      - sensor.jacksonville_jaguars
      - sensor.cleveland_browns
      - sensor.los_angeles_chargers
      - sensor.new_orleans_saints
      - sensor.green_bay
      - sensor.indianapolis_colts
      - sensor.new_england_patriots
      - sensor.las_vegas_raiders
      - sensor.seattle_seahawks
    attribute: team_score
condition:
  - condition: template
    value_template: "{{ state_attr(trigger.entity_id,'team_homeaway') == 'home'}}"
action:
  - service: media_player.play_media
    data:
      media_content_id: air_horn_03
      media_content_type: sound
    target:
      entity_id:
        - media_player.deck_alexa
  - service: notify.alexa_media_deck_alexa
    data:
      message: >
        Score update! {{state_attr(trigger.entity_id, 'team_name')}}
        {{state_attr(trigger.entity_id,'team_score')}}, 
        {{state_attr(trigger.entity_id, 'opponent_name')}} 
        {{state_attr(trigger.entity_id,'opponent_score')}}
mode: parallel

I’m testing that right away. very good idea my friend. :ok_hand:
Thank you for sharing.

Is it just me? NFL standings are not showing up. Looking at the JSON, I am not getting all of the info using https://site.web.api.espn.com/apis/v2/sports/football/nfl/standings?seasontype=2&type=0&level=3

Are they not updating that yet? I find that odd since they are in pre-season now.

Never mind! I see seasontype causes this.

Yes, you would have to set seasontype to the preseaon value should you be interested in preseason standings. YOu could probably get that information from a query and make it more automatic

1 Like

FYI, I changed the last part for NFL fans to this:

service: notify.alexa_media_deck_alexa
data:
  message: >
    Score update in {{state_attr(trigger.entity_id, 'opponent_name')}} versus
    {{state_attr(trigger.entity_id, 'team_name')}}.

    {{state_attr(trigger.entity_id, 'team_name')}}
    {{state_attr(trigger.entity_id,'team_score')}}, 
    {{state_attr(trigger.entity_id, 'opponent_name')}} 
    {{state_attr(trigger.entity_id,'opponent_score')}}.

    Last Play. 

    {{state_attr(trigger.entity_id,'last_play') | replace ('Ex. Pt','Extra
    Point')}}

I got sick of Alexa saying “E X P T” … lol

1 Like

I added this one also to my setup, announces gametime with a BANG:

alias: NFL Announce Gametime
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.minnesota_vikings
      - sensor.philadelphia_eagles
      - sensor.washington_commanders
      - sensor.new_york_jets
      - sensor.tampa_bay_buccaneers
      - sensor.houston_texans
      - sensor.tennessee_titans
      - sensor.dallas_cowboys
      - sensor.chicago_bears
      - sensor.los_angeles_rams
      - sensor.carolina_panthers
      - sensor.new_york_giants
      - sensor.kansas_city_chiefs
      - sensor.buffalo_bills
      - sensor.denver_broncos
      - sensor.arizona_cardinals
      - sensor.pittsburg_steelers
      - sensor.atlanta_falcons
      - sensor.san_francisco_49ers
      - sensor.cincinnati_bengals
      - sensor.baltimore_ravens
      - sensor.detroit_lions
      - sensor.miami_dolphins
      - sensor.jacksonville_jaguars
      - sensor.cleveland_browns
      - sensor.los_angeles_chargers
      - sensor.new_orleans_saints
      - sensor.green_bay
      - sensor.indianapolis_colts
      - sensor.new_england_patriots
      - sensor.las_vegas_raiders
      - sensor.seattle_seahawks
    from: PRE
    to: IN
condition:
  - condition: template
    value_template: "{{ state_attr(trigger.entity_id,'team_homeaway') == 'home'}}"
action:
  - service: notify.alexa_media_deck_alexa
    data:
      message: <audio src="soundbank://soundlibrary/guns/cannons/cannons_02"/>
  - service: notify.alexa_media_deck_alexa
    data:
      message: >
        Gametime! {{state_attr(trigger.entity_id, 'opponent_name')}} versus
        {{state_attr(trigger.entity_id, 'team_name')}} 
mode: single

HAHA. Yup. I do not have my automations speaking. But, can certainly understand that annoyance!

Again, thanks for all you have done with this. It is really amazing!!!