Sports Standings and Scores

March Madness
Maybe someone has moved this down the road (would love to see what you have) but if not I just started playing around with it. Feel free to use. Teams haven’t been selected so just creating a shell right now. Once they are announced I’ll be able to add Names/Logos/venue/etc.

Layout is my typical layout of everything on a single screen. Games are current but when MM starts you will see them there.

I built my March Madness tab using the api that was mentioned in the thread here - https://gist.github.com/akeaswaran/b48b02f1c94f873c6655e7129910fc3b

For those that want it - I have updated my github sensors, NCAA College dashboard and started to add a Women’s College Basketball - sensors only right now - for what I am showing below.

Here is the rough shell but you can see ESPN lays out the games through the Championship.


For those that just want the sensor here is what I am currently using:

##
## NCAA Basketball Mens March Madness
###
- platform: rest
  scan_interval: 86400
  name: NCAAM March Madness
  unique_id: sensor.ncaam_march_madness
  resource: https://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard?dates=20250320-20250430&groups=100&limit=500
  value_template: "{{ now() }}"
  json_attributes:
      - events        

That looks amazing. Any chance you can hand out the yaml file for your ncaa tab?

Already added your March Madness sensor :wink:

Thanks in advance.

EDIT: People who read have advantages in most cases. This here is one of those cases :wink:
Nevermind, I found everything I need :slight_smile:

2 Likes

March Madness Men’s and Women’s selection was done today. Just a couple notes:

  • I tried to quickly make adjustments but I won’t be able to get back to this until next weekend. So any help or adjustments are appreciated.
  • I have updated my github for Men’s Basketball and Women’s BB. It’s rough right now but hopefully it will get cleand up.
  • I added an -odds section to the rest sensor because I was thinking about adding that in to the screen at some point. ESPN does provide Odds/Spread/etc…
  • I don’t like the formatting or the way sorting is done but I will work on that later.

Here are a couple screen shots. Can’t wait to see what you all add/fix/improve


Just tried to make a couple improvements and was working to see if I could create a bracket.

I am having alignment issues/sorting challenges with it, but I figured I would put the code out there if anyone wants it. I have only focused on the Men’s bracket but the basic decluttering template works for Women’s as well.

Here are some of the changes:

  • Reformatted the basic layout to show teams with Away over Home to better show the scores. Code is updated in the Sports_US_College_NCAA dashboard on GitHub. Here is an example showing the womens MM.
  • Created a separate sandbox for MM bracket building.
    – To build the bracket I am keying off .notes.headline and filtering based on what it is saying. 1st Four/1st Round/2nd Round/Sweet 16/Elite 8/Final Four/Championship.
    – I am using a template to filter. For those that know me, I would rather use REST but ESPN doesn’t break it out easily that way. To keep things clean I put this in a separate file in my GitHub site - under templates :wink:
    – The Dashboard for the sandbox also has a separate file. I haven’t tabbed it yet but that is pretty straightforward to add.
    – I need to do the same thing for Women’s MM but their brackets require different regions (which honestly doesn’t make sense) - Region 1/2/3/4 - so not a simple cut & paste.
    – I don’t have TT in the sandbox - just became to cluttered.
    – Before you ask - yes you can change the colors. It a variable that is called color. These colors just helped me lay the bracket out to see how it works. You can see the format here - just change it.
          - type: vertical-stack
            cards:
              - type: custom:decluttering-card
                template: ncaa_march_madness
                variables:
                  - title: East Region (Elite 8)
                  - color: '#8F00FF'
                  - entity: sensor.ncaam_march_madness_filtered_events
                  - events: east_region_elite_8_events

– Here is where I am currently with the Sandbox bracket building.


– Last point is that I have also add Game state at the top of each game in the sandbox - Games haven’t started today but you can see below the New Mexico Game Score is Final and Colorado State Starts tomorrow at 4:10 and the half/time will be reflected on the right as well as the current score. To get this I needed to update the scan interval - I picked 90 but you can adjust.

- platform: rest
  scan_interval: 90
  name: NCAAM March Madness
  unique_id: sensor.ncaam_march_madness
  resource: https://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard?dates=20250317-20250430&groups=100&limit=500
  value_template: "{{ now() }}"
  json_attributes:
      - events   
      - odds    

Anyway - hope this helps and I look forward to any changes/ideas.

UPDATE: Just a quick update on MM dashboard. Just some highlighting to easier find games -

  • games playing have a red background with time (remember I am only updating every 3 minutes)
  • Final - White background

Hi there!
I’m new to this, I copied and pasted what in dashboard in github @kbrown01, standings for NHL, NFL, MLB and NBA work perfectly. But I don’t have any matchs in PRE, IN, POST tabs. May I forget to do something? Thanks in advance.

First thing to check is if you have the TeamTracker entities getting loaded. Go into Developer Tools → Template and put this in there - Is anything in result?

{% for team in integration_entities("teamtracker") %} {{team }} {%- endfor %}

Thanks here is what I get

Ok if you put this in what do you get:

{{ states('sensor.san_diego_padres')}}

Here is what I am showing right now:

Here is what I get:

Ok so it looks like you have Teamtracker setup and the sensors are being populated.

Now you can check and see if there is something wrong with your dashboard.

Create a new, blank dashboad and then go edit the yaml configuration.

Put this in there:

views:
  - title: Home
    cards:
      - type: custom:teamtracker-card
        entity: sensor.san_diego_padres
        outline: true
        outline_color: deeppink

You should see this:

I saw it:

Ok then it looks like there is something in the pre/in/post tabs config because everything seems to be working.

The flow is → it is called in the dashboard and then goes through the decluttering card ->game_stats and then appears. So look at your dashboard code and game_stats code.

You have NFL loaded which sometimes if you don’t it needs to have the red zone removed. But I would look there, maybe recopy kbrowns code in case something was missed accidently.

Or You could create another test dashboard and grab my Sports_US_Professional code here under dashboard - GitHub - bburwell/HA-Sports-Scores: Home Assistant Sports Scores, Standings, Dashboards and Yaml's for Home Assistant. It has WNBA and UFL but those just wouldn’t/shouldn’t populate

Hope you get it fixed.

Likely it is redzone. Given the above example try with an NFL team. The superbowl should still be in postgame so use KC or Philly.

I have any match that are displayed.

What can be wrong?

instead of padres use
sensor.chicago_blackhawks
for the template and test dashboard.

They are playing right now:

What is MLB showing - do you see games?

I’m sorry but where I should place sensor.chicago_blackhawks.

About MLB, I see nothing

What kbrown and I are saying is that it may be the red zone piece of game_stats.

We are trying to figure out what is causing the error and it may be that the NFL sensors aren’t loaded on your system.

Put this in your test dashboard:

views:
  - title: Home
    cards:
      - type: custom:teamtracker-card
        entity: sensor.chicago_blackhawks
        outline: true
        outline_color: deeppink
      - type: custom:teamtracker-card
        entity: sensor.kansas_city_chiefs
        outline: true
        outline_color: deeppink

Should see this:

Edit: lets use Chiefs

I see that well

I’m sorry I am jumping on a plane - but last test today and then will try to relook as soon as I can.

Put this code in your test dashboard - I pulled the red zone check:

decluttering_templates:
  game_stats:
    card:
      type: custom:auto-entities
      unique: true
      show_empty: false
      card:
        type: custom:layout-card
        layout_type: masonry
        width: 200px
        max-columns: 5
      card_param: cards
      filter:
        template: |
          {%- for team in integration_entities("teamtracker") -%}
            {%- if state_attr(team, "league") == "[[sport]]" -%}
              {%- if states(team) == "[[status]]" -%}
                {%- if state_attr(team, "team_homeaway") == "home" -%}
                    {{{"type": "custom:teamtracker-card",
                      "entity": team, 
                      "home_side": "right"}}},                  
                {%- endif -%}
              {%- endif -%}
            {%- endif -%}
          {%- endfor -%}
        exclude:
          - entity_id: '*team_tracker*'
      sort:
        method: attribute
        attribute: date
views:
  - title: Home
    cards:
      - type: custom:teamtracker-card
        entity: sensor.chicago_blackhawks
        outline: true
        outline_color: deeppink
      - type: custom:teamtracker-card
        entity: sensor.kansas_city_chiefs
        outline: true
        outline_color: deeppink
      - type: custom:decluttering-card
        template: game_stats
        variables:
          - sport: NHL
          - status: IN
          - type: markdown
        content: |
          <h1>NHL Games Coming-up</h1>
      - type: custom:decluttering-card
        template: game_stats
        variables:
          - sport: NHL
          - status: PRE
      - type: markdown
        content: |
          <h1>NHL Games Completed</h1>
      - type: custom:decluttering-card
        template: game_stats
        variables:
          - sport: NHL
          - status: POST

Games are displayed.
It works now!

Thanks for your help.