Sports Standings and Scores

No. YOu would only have NFL but it is possible that because you do not have NHL, MLB, NBA setup it errors.

It is also possible that you used different naming … how did you nae your teamtracker entities?

You of course would only have entries if you selected the NFL tab …

I copied your files so I have every sport setup including NBA but an example of an nfl one i see is sensor.buffalo_bills. Is that correct?

sensor.buffalo_bills would be a teamtracker one.
If you use the developer’s tools and look at the states, what do you get for:

sensor.nfl_standings
sensor.nfl_afc_west

Do these so data like this?

and this?

I only see the nfl standings sensor not the afc west one. The standings one does have the data

OK, you either need to reload “templates” or restart HA. If the full stats are there and not the divisions, you get nothing. Also, if you do not see the divisions one … be sure that the first line in template.yaml is:

sensor:

You may have copied it before I added it in the original post, I added it in an edit. Look above for the template.yaml and be sure that is the first line. After I edit such things I always run check configuration too, it does help to identify issues. If it isn;t there at all to see states, it is defined wrong in YAML, if it is there and no data … then that needs to be addressed to see why.

Boom! That was it. Standings are now populated for all sports. Goalies all say undefined for NHL though. Do the other tabs only get populated when there is data? for example the live tab is just blank for all. Thanks for the help!

The tabs Postgame, Live and Pregame are just organizing Teamtracker. The other tabs for standings are mine I wrote. So like NFL, NHL would have POST and PRE but nothing LIVE. In fact, no sport is playing right now so all LIVE would be empty.

NFL PRE should give this for the weeks games:

You would note that not even Monday’s game is populated yet. This is an ESPN thing, we can only serve up what ESPN gives.

If you want starting goalies, that is some new stuff. Create a scrape sensor to get their ever changing “cookie”: For this, I add in configuration.yaml:

scrape: !include scrape.yaml

Then add a scrape sensor to get the cookie. This is in scrape.yaml which is now another include like the other includes:

  - resource: https://www.dailyfaceoff.com/starting-goalies
    sensor:
      - name: Starting Goalie BuildID
        unique_id: sensor.starting_goalie_buildid
        select: '#__NEXT_DATA__'
        value_template: >
            {{ value | regex_findall('buildId":\s?"([a-zA-Z0-9_-]{1,99})"') | first }}

Then add this to sensor.yaml:

##
## Starting Goalies
##
- platform: rest
  name: nhl_starting_goalies
  unique_id: sensor.nhl_starting_goalies
  scan_interval: 3600
  resource_template: "https://www.dailyfaceoff.com/_next/data/{{states('sensor.starting_goalie_buildid')}}/starting-goalies.json"
  value_template: "{{ value_json.pageProps.date }}"
  json_attributes_path: "$.pageProps"
  json_attributes:
    - data

This should extract the data for today’s starting goalies (NOTE: It will be blank as there are no NHL games today).

For some reason the pregame tab isn’t working. It’s just blank. Any ideas?

For what league?

All of them….

OK, pre/post and (of course live)?
Then your naming is not the same as mine or done in a different way.
if you go to Developer’s Tools and template and put this in:

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

this is what I get, what do you get?

That should show every single “teamtracker” entitiy

Yep. All sensors appear when using that string

OK, let’s go deeper. What do you get from this in the same way in developer’s tools:

{% for team in integration_entities("teamtracker") -%}
{% if state_attr(team, "league") == "NFL" -%}
{% if states(team) == "PRE" -%}
{% if state_attr(team, "team_homeaway") == "home" -%}
{{team}}
{% endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}

Mine shows this:

Same 13 teams for me too.

OK. Did you create the red zone sensor? If not it will error and you will get nothing. If you did, examine the states of sensor.nfl_red_zone … if you didn;t we need to remove that test in the decluttering template. Note: It would be there and return nothing as no NFL team is in the Red ZOne right now. If that sensor does not exist, then you didn;t create it

Ok that sensor is not there. I need to remove it from template.yaml?

I would remove it from the dashboard for now. If you look into the dashboard code in the decluttering templates, change the game_stats: template to remove the test for red zone like this:

      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 -%}

You can add it back once you can figure out what is wrong with the sensor for the red zone teams. The only thing that template is used for is to draw the teamtracker cards with red border and background when an NFL team is in the red zone. You have a problem or that sensor is not setup and hence it fails and so would every teamtracker card.

Are you saying to replace the entire code below with what you posted for each sport? NFL example below.

>    - attributes:
>                 label: Postgame
>                 icon: mdi:football-helmet
>               card:
>                 type: custom:decluttering-card
>                 template: game_stats
>                 variables:
>                   - sport: NFL
>                   - status: POST
>             - attributes:
>                 label: Live
>                 icon: mdi:football
>               card:
>                 type: custom:decluttering-card
>                 template: game_stats
>                 variables:
>                   - sport: NFL
>                   - status: IN
>             - attributes:
>                 label: Pregame
>                 icon: mdi:strategy
>               card:
>                 type: custom:decluttering-card
>                 template: game_stats
>                 variables:
>                   - sport: NFL
>                   - status: PRE’

No look toward the top if editing the whole dashboard. Look for the decluttering templates an specifically the one named “game_stats”. Under that, just replace the filter: