Sports Standings and Scores

Still working on getting around the template error.

Is there anyway to pull the data directly out of my college football sensor and pass that to the flex table?

So if my sensor looks like this:

I could pass the sensor to the decluttering-card (ncaa_football_standings) and have it parse the sensor data based on the child location? Something like this maybe (this doesn’t work)

decluttering_templates:
  ncaa_football_standings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      css:
        table+: 'padding: 0px; width: 1000px;'
        tbody tr td:first-child: 'width: 2%;'
        tbody tr td:nth-child(2): 'width: 5%;'
        tbody tr td:nth-child(n+3): 'width: 2%;'
        tbody tr:hover: 'background-color: black!important; color:white!important;'
        tbody tr td:nth-child(6): 'background-color: green; color: white;'
      card_mod:
        style:
          .: |
            ha-card {
              overflow: auto;
              }
          $: |
            .card-header {
               padding-top: 6px!important;
               padding-bottom: 4px!important;
               font-size: 14px!important;
               line-height: 14px!important;
               font-weight: bold!important;
             }
      sort_by:
        - entries-
      entities:
        include: '[[entity]]'
      columns:
        - name: Short Name
          data: children
          modify: x.standings[0].entries.name
        - name: Long Name
          data: children
          modify: x.standings[0].entries.name

To add some additional comments this is what I am thinking - Do I really need templates? If all of the data is in the sensor I am using to grab from the ESPN API, can’t I just use the API and bail on the Templates. Especially since they are limiting and failing if the template needs to process over the maximum size of 262144 characters

My thought is if I can get to those children I can then just pass that as a variable because everything else is the same. So I would pass 0 for the Atlantic coast conference tab, 1 for the Big 12 Conference tab, etc.

The challenge is that because I am not a JSON Ninja I can only get to the first layer with this code. But if I can dive into the sensor data I can then probably complete my thought process. The first layer works fine, hopefully someone can help me dive into the 13 JSON/children.

  ncaa_football_standings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      css:
        table+: 'padding: 0px; width: 1000px;'
        tbody tr td:first-child: 'width: 2%;'
        tbody tr td:nth-child(2): 'width: 5%;'
        tbody tr td:nth-child(n+3): 'width: 2%;'
        tbody tr:hover: 'background-color: black!important; color:white!important;'
        tbody tr td:nth-child(6): 'background-color: green; color: white;'
      card_mod:
        style:
          .: |
            ha-card {
              overflow: auto;
              }
          $: |
            .card-header {
               padding-top: 6px!important;
               padding-bottom: 4px!important;
               font-size: 14px!important;
               line-height: 14px!important;
               font-weight: bold!important;
             }
      sort_by:
        - entries-
      entities:
        include: '[[entity]]'
      columns:
        - name: id
          data: children
          modify: x.id
        - name: Long Name
          data: children
          modify: x.name

Ok so I gave up on parsing through sensor.college_football_standings. I know that is the correct path but my json skills just weren’t/aren’t working to figure that out and I want Big 10 and Atlantic Coast conference data today. Amazon gives me it same day, figure HA should as well :slight_smile:

Based on how this turned out I honestly think that I am going to move everything in this direction. On top of that I am separating out my yaml files and from what I can tell you can’t separate Template yamls. Templates in this sports scenario just feel too limiting and I would/could eventually run into an EOS error across all sports.

So here is my sandbox that I am working through now and will update as I move along. I will be renaming these sensors and deleting my template configs. Everything is going into a REST sensor unless someone convinces me otherwise.

Since I had problems with Atlantic Coast and Big 10 (you can read the thread above) I started there.

Here are my ncaaf_sensors.yaml data for those 2 conferences - with a test extension today - moving to regular sensors:

- platform: rest
  scan_interval: 36000
  name: atlantic_coast_conference_test
  unique_id: sensor.atlantic_coast_conference_test
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[1]['standings']"
  json_attributes: 
   - entries

- platform: rest
  scan_interval: 36000
  name: big_ten_conference_test
  unique_id: sensor.big_ten_conference_test
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[3]['standings']"
  json_attributes: 
   - entries

My sandbox dashboard is sparse so I will add all of the code here:

decluttering_templates:
  ncaa_football_standings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      css:
        table+: 'padding: 0px; width: 600px;'
        tbody tr td:first-child: 'width: 2%;'
        tbody tr td:nth-child(2): 'background-color: green; color: white width: 1%;'
        tbody tr td:first-child(3): 'width: 2%;'
        tbody tr td:first-child(4): 'width: 10%;'
        tbody tr td:nth-child(n+5): 'width: 5%;'
        tbody tr:hover: 'background-color: black!important; color:white!important;'
      card_mod:
        style:
          .: |
            ha-card {
              overflow: auto;
              }
          $: |
            .card-header {
               padding-top: 6px!important;
               padding-bottom: 4px!important;
               font-size: 14px!important;
               line-height: 14px!important;
               font-weight: bold!important;
             }
      sort_by:
        - entries -
      entities:
        include: '[[entity]]'
      columns:
        - name: Seed
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'SEED').displayValue
          hidden: false
        - name: Conf Record
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'CONF').displayValue
        - name: GB
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GB').displayValue
          hidden: false
        - name: Team
          data: '[[attribute]]'
          modify: >-
            '<div><img src="' + x.team.logos[0].href + '" style="height:
            20px;vertical-align:middle;">&nbsp;' + x.team.displayName +
            '</div>'  
        - name: Overall
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'overall').displayValue
        - name: GB
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GB').displayValue
        - name: Wins
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'W').value
        - name: Conf Record
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'CONF').displayValue
        - name: Streak
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'STRK').value
views:
  - theme: Backend-selected
    title: Sports
    type: panel
    icon: mdi:strategy
    badges: []
    cards:
      - type: custom:mod-card
        card_mod:
          style:
            tabbed-card $: |
              mwc-tab {
                background: black;
                color: silver;
                border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
                border-width: 2px;
                border-style: solid;
                overflow: hidden;
                width: 20%;
              }
              mwc-tab[active] {
                background: white !important;
                color: black !important;
              }
        card:
          type: custom:tabbed-card
          styles:
            '--mdc-theme-primary': black
            '--mdc-tab-text-label-color-default': silver
            '--mdc-typography-button-font-size': 12px
          tabs:
            - attributes:
                label: NCAA
                icon: mdi:school
              card:
                type: custom:mod-card
                card_mod:
                  style:
                    tabbed-card $: |
                      mwc-tab {
                        background: black;
                        border-color: silver;
                        border-width: 2px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 15%;
                      }
                      mwc-tab[active] {
                        background: white !important;
                        color: black !important
                      }
                card:
                  type: custom:tabbed-card
                  card_mod: null
                  style:
                    tabbed-card $: |
                      mwc-tab {
                        background: black;
                        border-color: silver;
                        border-width: 2px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 10%;
                      }
                      mwc-tab[active] {
                        background: white !important;
                        color: black !important
                      }
                  tabs:
                    - attributes:
                        label: NCAA Football
                        icon: mdi:football
                      card:
                        type: custom:mod-card
                        card_mod:
                          style:
                            tabbed-card $: |
                              mwc-tab {
                                background: black;
                                border-color: silver;
                                border-width: 2px;
                                border-top-left-radius: 20px;
                                border-top-right-radius: 20px;
                                border-style: solid;
                                overflow: hidden;
                                width: 5%;
                              }
                              mwc-tab[active] {
                                background: white !important;
                                color: black !important;
                              }
                        card:
                          type: horizontal-stack
                          cards:
                            - type: vertical-stack
                              cards:
                                - type: markdown
                                  content: |
                                    <h1>Conference Standings</h1>
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Atlantic Coast Conference
                                    - entity: sensor.atlantic_coast_conference_test
                                    - attribute: entries
                            - type: vertical-stack
                              cards:
                                - type: markdown
                                  content: |
                                    <h1>Conference Standings</h1>
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Big 10 Conference
                                    - entity: sensor.big_ten_conference_test
                                    - attribute: entries

Here is what I end up with:

Comments are encouraged!

2 Likes

Ok so a day 2 update. Continuing work on changing NCAAF from Templates to REST sensor.

This helps me in a couple ways:

  1. Most importantly I get around the size limit Templates have - I mentioned earlier in this thread. I ran into it with the Atlantic Coast Conference and Big 10. Guessing it was just a matter of time until I run into with other Conferences - Big 12 and SEC most likely.
  2. I can put these into my NCAAF_sensors.yaml file which eventually allow me to pull those and not have to load them when College football isn’t playing. (I split out all of my sports sensors.yaml file - MLB, NHL, WNBA, NCAAF, etc.)
  3. I have also changed the naming convention in case I want to just throw all teams at a card. More on that in the future, but all of my NCAAF conferences now start with sensor.ncaaf_conference*.

Sandbox testing to make sure all sensors work:

New Naming throwing everything at the Flex-table card:

Here are the new sensors, new naming, that I put in ncaaf_sensors.yaml:

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_american_athletic
  unique_id: sensor.ncaaf_conference_american_athletic
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[0]['standings']"
  json_attributes: 
   - entries

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_atlantic_coast
  unique_id: sensor.ncaaf_conference_atlantic_coast
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[1]['standings']"
  json_attributes: 
   - entries

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_big_12
  unique_id: sensor.ncaaf_conference_big_12
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[2]['standings']"
  json_attributes: 
   - entries

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_big_ten
  unique_id: sensor.ncaaf_conference_big_ten
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[3]['standings']"
  json_attributes: 
   - entries
   
- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_conference_usa
  unique_id: sensor.ncaaf_conference_conference_usa
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[4]['standings']"
  json_attributes: 
   - entries   

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_fbs_independents
  unique_id: sensor.ncaaf_conference_fbs_independents
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[5]['standings']"
  json_attributes: 
   - entries     

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_mid_american
  unique_id: sensor.ncaaf_conference_mid_american
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[6]['standings']"
  json_attributes: 
   - entries   

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_mountain_west
  unique_id: sensor.ncaaf_conference_mountain_west
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[7]['standings']"
  json_attributes: 
   - entries   
- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_pac12
  unique_id: sensor.ncaaf_conference_pac12
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[8]['standings']"
  json_attributes: 
   - entries   

- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_southeastern
  unique_id: sensor.ncaaf_conference_southeastern
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[9]['standings']"
  json_attributes: 
   - entries   

   
- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_sun_belt_east
  unique_id: sensor.ncaaf_conference_sun_belt_east
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[10]['children'][0]['standings']"
  json_attributes: 
   - entries
   
- platform: rest
  scan_interval: 36000
  name: ncaaf_conference_sun_belt_conference_west
  unique_id: sensor.ncaaf_conference_sun_belt_west
  resource: https://site.web.api.espn.com/apis/v2/sports/football/college-football/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes_path: "$.[10]['children'][1]['standings']"
  json_attributes: 
   - entries   

And here is the sandbox dashboard if anyone wants to test:

decluttering_templates:
  ncaa_football_standings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      css:
        table+: 'padding: 0px; width: 600px;'
        tbody tr td:first-child: 'width: 2%;'
        tbody tr td:nth-child(2): 'background-color: green; color: white width: 1%;'
        tbody tr td:first-child(3): 'width: 2%;'
        tbody tr td:first-child(4): 'width: 10%;'
        tbody tr td:nth-child(n+5): 'width: 5%;'
        tbody tr:hover: 'background-color: black!important; color:white!important;'
      card_mod:
        style:
          .: |
            ha-card {
              overflow: auto;
              }
          $: |
            .card-header {
               padding-top: 6px!important;
               padding-bottom: 4px!important;
               font-size: 14px!important;
               line-height: 14px!important;
               font-weight: bold!important;
             }
      sort_by:
        - entries -
      entities:
        include: '[[entity]]'
      columns:
        - name: Seed
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'SEED').displayValue
          hidden: false
        - name: Conf Record
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'CONF').displayValue
        - name: GB
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GB').displayValue
          hidden: false
        - name: Team
          data: '[[attribute]]'
          modify: >-
            '<div><img src="' + x.team.logos[0].href + '" style="height:
            20px;vertical-align:middle;">&nbsp;' + x.team.displayName +
            '</div>'  
        - name: Overall
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'overall').displayValue
        - name: GB
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GB').displayValue
        - name: Wins
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'W').value
        - name: Conf Record
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'CONF').displayValue
        - name: Streak
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'STRK').value
views:
  - theme: Backend-selected
    title: Sports
    type: panel
    icon: mdi:strategy
    badges: []
    cards:
      - type: custom:mod-card
        card_mod:
          style:
            tabbed-card $: |
              mwc-tab {
                background: black;
                color: silver;
                border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
                border-width: 2px;
                border-style: solid;
                overflow: hidden;
                width: 20%;
              }
              mwc-tab[active] {
                background: white !important;
                color: black !important;
              }
        card:
          type: custom:tabbed-card
          styles:
            '--mdc-theme-primary': black
            '--mdc-tab-text-label-color-default': silver
            '--mdc-typography-button-font-size': 12px
          tabs:
            - attributes:
                label: NCAA
                icon: mdi:school
              card:
                type: custom:mod-card
                card_mod:
                  style:
                    tabbed-card $: |
                      mwc-tab {
                        background: black;
                        border-color: silver;
                        border-width: 2px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 15%;
                      }
                      mwc-tab[active] {
                        background: white !important;
                        color: black !important
                      }
                card:
                  type: custom:tabbed-card
                  card_mod: null
                  style:
                    tabbed-card $: |
                      mwc-tab {
                        background: black;
                        border-color: silver;
                        border-width: 2px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 10%;
                      }
                      mwc-tab[active] {
                        background: white !important;
                        color: black !important
                      }
                  tabs:
                    - attributes:
                        label: NCAA Football
                        icon: mdi:football
                      card:
                        type: custom:mod-card
                        card_mod:
                          style:
                            tabbed-card $: |
                              mwc-tab {
                                background: black;
                                border-color: silver;
                                border-width: 2px;
                                border-top-left-radius: 20px;
                                border-top-right-radius: 20px;
                                border-style: solid;
                                overflow: hidden;
                                width: 5%;
                              }
                              mwc-tab[active] {
                                background: white !important;
                                color: black !important;
                              }
                        card:
                          type: vertical-stack
                          cards:
                            - type: horizontal-stack
                              cards:
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: American Athletic Conference
                                    - entity: >-
                                        sensor.ncaaf_conference_american_athletic
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Atlantic Coast Conference
                                    - entity: sensor.ncaaf_conference_atlantic_coast
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Big 12 Conference
                                    - entity: sensor.ncaaf_conference_big_12
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Big 10 Conference
                                    - entity: sensor.ncaaf_conference_big_ten
                                    - attribute: entries
                            - type: horizontal-stack
                              cards:
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Conference USA
                                    - entity: sensor.ncaaf_conference_conference_usa
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: FBS Independents Conference
                                    - entity: sensor.ncaaf_conference_fbs_independents
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Mid American Conference
                                    - entity: sensor.ncaaf_conference_mid_american
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Mountain West Conference
                                    - entity: sensor.ncaaf_conference_mountain_west
                                    - attribute: entries
                            - type: horizontal-stack
                              cards:
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: PAC-12 Conference
                                    - entity: sensor.ncaaf_conference_pac12
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Southeastern Conference
                                    - entity: sensor.ncaaf_conference_southeastern
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Sun Belt West Conference
                                    - entity: sensor.ncaaf_conference_sun_belt_west
                                    - attribute: entries
                                - type: custom:decluttering-card
                                  template: ncaa_football_standings
                                  variables:
                                    - title: Sun Belt East Conference
                                    - entity: sensor.ncaaf_conference_sun_belt_east
                                    - attribute: entries
                    - attributes:
                        label: Overall
                      card:
                        type: custom:decluttering-card
                        template: ncaa_football_standings
                        variables:
                          - title: Overall
                          - entity: sensor.ncaaf_conference_*_*
                          - attribute: entries

Feel free to comment, make recommendations, changes, etc.

1 Like

Hi guys, I’m trying to get this custom dashboard to work. At the moment, I can see all the standings for the NHL, which is what I want to track, but I can’t see the game statuses (POST, IN, PRE…). Am I doing something wrong? I’m sorry if I’m making a dumb mistake.

Games:

This is my dashboard code:

decluttering_templates:
  nhl_settings:
    card:
      type: custom:flex-table-card
      title: Temporada NHL
      css:
        table+: 'padding: 0px; width: 1600px;'
        tbody tr td:first-child: 'width: 2%;'
        tbody tr td:nth-child(2): 'width: 20%;'
        tbody tr td:nth-child(n+3): 'width: 5%;'
        tbody tr:hover: 'background-color: green!important; color:white!important;'
        tbody tr td:nth-child(7): 'background-color: green; color: white;'
      card_mod:
        style:
          .: |
            ha-card {
              overflow: auto;
              }
          $: |
            .card-header {
               padding-top: 6px!important;
               padding-bottom: 4px!important;
               font-size: 14px!important;
               line-height: 14px!important;
               font-weight: bold!important;
             }
      entities:
        include: '[[entity]]'
        exclude: '[[excluded_entities]]'
      sort_by: entries-
      columns:
        - hidden: true
          data: '[[attribute]]'
          modify: '[[sort]]'
        - name: <div>C</div>
          data: '[[attribute]]'
          modify: >-
            if(typeof x.stats.find(y=>y.abbreviation == 'CLINCH') !==
            'undefined' ){x.stats.find(y=>y.abbreviation ==
            'CLINCH').displayValue}else{'-'}
        - name: Team
          data: '[[attribute]]'
          modify: >-
            '<div><a href="' + x.team.links[0].href + '" target="_blank"><img
            src="' + x.team.logos[0].href + '" style="height:
            20px;vertical-align:middle;"></a>&nbsp;' + x.team.displayName +
            '</div>'
        - name: <div>GP</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GP').displayValue
        - name: <div>W</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'W').displayValue
        - name: <div>L</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'L').displayValue
        - name: <div>OTL</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'OTL').displayValue
        - name: <div>PTS</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'PTS').displayValue
        - name: <div>RW</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'RW').displayValue
        - name: <div>ROW</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'ROW').displayValue
        - name: <div>SOW</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'SOW').displayValue
        - name: <div>SOL</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'SOL').displayValue
        - name: <div>HOME</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'HOME').displayValue
        - name: <div>AWAY</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'AWAY').displayValue
        - name: <div>GF</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GF').displayValue
        - name: <div>GA</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'GA').displayValue
        - name: <div>DIFF</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'DIFF').displayValue
        - name: <div>L10</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'L10').summary
        - name: <div>STRK</div>
          data: '[[attribute]]'
          modify: x.stats.find(y=>y.abbreviation == 'STRK').displayValue
  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" -%}
            {%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
              {{{"type": "custom:teamtracker-card",
                "entity": team,
                "card_mod": {"style": "ha-card {\n\n    color:  black; \n    background-color:  #ffcccc; \n    box-shadow: 0 0 10px 5px red;\n}\n"},
                "home_side": "right"}}},
            {%- else -%}
              {{{"type": "custom:teamtracker-card",
                "entity": team, 
                "home_side": "right"}}},
            {%- endif -%}
            {%- endif -%}
            {%- endif -%}
            {%- endif -%}
          {%- endfor -%}
        exclude:
          - entity_id: '*team_tracker*'
      sort:
        method: attribute
        attribute: date
views:
  - theme: Backend-selected
    title: Temporada NHL
    type: panel
    icon: mdi:strategy
    badges: []
    cards:
      - type: custom:mod-card
        card_mod:
          style:
            tabbed-card $: |
              mwc-tab {
                background: var(--ha-card-background, var(--card-background-color, white) );
                border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
                border-width: 2px;
                border-top-left-radius: 20px;
                border-top-right-radius: 20px;
                border-style: solid;
                overflow: hidden;
                width: 25%;
              }
              mwc-tab[active] {
                background: #EBFFD8 !important;
              }
        card:
          type: custom:tabbed-card
          styles:
            '--mdc-theme-primary': green
            '--mdc-tab-text-label-color-default': silver
            '--mdc-typography-button-font-size': 12px
          tabs:
            - attributes:
                label: NHL
                icon: mdi:hockey-puck
              card:
                type: custom:mod-card
                card_mod:
                  style:
                    tabbed-card $: |
                      mwc-tab {
                        background: var(--ha-card-background, var(--card-background-color, white) );
                        border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
                        border-width: 2px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 20%;
                      }
                      mwc-tab[active] {
                        background: #EBFFD8 !important;
                      }
                card:
                  type: custom:tabbed-card
                  styles:
                    '--mdc-theme-primary': green
                    '--mdc-tab-text-label-color-default': silver
                    '--mdc-typography-button-font-size': 12px
                  tabs:
                    - attributes:
                        label: Standings
                        icon: mdi:ballot
                      card:
                        type: custom:mod-card
                        card_mod:
                          style:
                            tabbed-card $: |
                              mwc-tab {
                                background: var(--ha-card-background, var(--card-background-color, white) );
                                border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );
                                border-width: 2px;
                                border-top-left-radius: 20px;
                                border-top-right-radius: 20px;
                                border-style: solid;
                                overflow: hidden;
                                width: 25%;
                              }
                              mwc-tab[active] {
                                background: #EBFFD8 !important;
                              }
                        card:
                          type: custom:tabbed-card
                          styles:
                            '--mdc-theme-primary': green
                            '--mdc-tab-text-label-color-default': silver
                            '--mdc-typography-button-font-size': 12px
                          tabs:
                            - attributes:
                                label: Divisional
                              card:
                                type: custom:stack-in-card
                                mode: vertical
                                cards:
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Eastern Atlantic
                                      - entity: sensor.nhl_east_atlantic
                                      - attribute: entries
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Eastern Metropolitan
                                      - entity: sensor.nhl_east_metropolitan
                                      - attribute: entries
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: West Central
                                      - entity: sensor.nhl_west_central
                                      - attribute: entries
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: West Pacific
                                      - entity: sensor.nhl_west_pacific
                                      - attribute: entries
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                            - attributes:
                                label: Conference
                              card:
                                type: custom:stack-in-card
                                mode: vertical
                                cards:
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Eastern
                                      - entity: sensor.nhl_east_*
                                      - attribute: entries
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Western
                                      - entity: sensor.nhl_west_*
                                      - attribute: entries
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings
                            - attributes:
                                label: Overall
                              card:
                                type: custom:decluttering-card
                                template: nhl_settings
                                variables:
                                  - title: Overall
                                  - entity: sensor.nhl_*_*
                                  - attribute: entries
                                  - excluded_entities:
                                      - sensor.nhl_starting_goalies
                                      - sensor.nhl_wildcard
                                      - sensor.nhl_wildcard_standings
                                  - sort: >-
                                      x.stats.find(y=>y.shortDisplayName ==
                                      'PTS').value
                            - attributes:
                                label: Wildcard
                              card:
                                type: custom:stack-in-card
                                mode: vertical
                                cards:
                                  - type: markdown
                                    content: |
                                      <h2>Eastern Conference</h2>
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Atlantic Leaders
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: east_atlantic_top
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Metropolitan Leaders
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: east_metropolitan_top
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Wildcards
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: east_wildcard
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: In The Hunt
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: east_hunt
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Eliminated
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: east_eliminated
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: markdown
                                    content: |
                                      <h2>Western Conference</h2>
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Central Leaders
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: west_central_top
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Pacific Leaders
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: west_pacific_top
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Wildcards
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: west_wildcard
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: In The Hunt
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: west_hunt
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                                  - type: custom:decluttering-card
                                    template: nhl_settings
                                    variables:
                                      - title: Eliminated
                                      - entity: sensor.nhl_wildcard_standings
                                      - attribute: west_eliminated
                                      - excluded_entities:
                                          - sensor.nhl_starting_goalies
                                      - sort: >-
                                          x.stats.find(y=>y.shortDisplayName ==
                                          'PTS').value
                    - attributes:
                        label: Postgame
                        icon: mdi:hockey-sticks
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: POST
                    - attributes:
                        label: Live
                        icon: mdi:hockey-puck
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: IN
                    - attributes:
                        label: Pregame
                        icon: mdi:blood-bag
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: PRE
                    - attributes:
                        label: Starting Goalies
                        icon: mdi:strategy
                      card:
                        type: custom:flex-table-card
                        title: Starting Goalies
                        css:
                          table+: 'padding: 0px; width: 1600px;'
                          tbody tr:hover: >-
                            background-color: green!important;
                            color:white!important;
                          tbody tr td:nth-child(10): 'background-color: green; color: white;'
                        card_mod:
                          style: |
                            ha-card {
                                overflow: auto;
                            }
                            $: |
                                .card-header {
                                   padding: 12px 0px 8px 4px!important;
                                   font-size: 16px!important;
                                   line-height: 18px!important;
                                   font-weight: bold!important;
                                 }
                        entities:
                          include: sensor.nhl_starting_goalies
                        columns:
                          - name: HOME
                            data: data
                            modify: >-
                              '<div><img src="' + x.homeTeamLogoSvg + '"
                              style="height:
                              20px;vertical-align:middle;">&nbsp;' +
                              x.homeTeamName + '</div>'
                          - name: GOALIE
                            data: data
                            modify: x.homeGoalieName
                          - name: RANK
                            data: data
                            modify: >-
                              if(x.homeGoaliePositionRank === null
                              ){'None'}else{x.homeGoaliePositionRank}
                          - name: W
                            data: data
                            modify: >-
                              if(x.homeGoalieWins === null
                              ){'0'}else{x.homeGoalieWins}
                          - name: L
                            data: data
                            modify: >-
                              if(x.homeGoalieLosses === null
                              ){'0'}else{x.homeGoalieLosses}
                          - name: OTL
                            data: data
                            modify: >-
                              if(x.homeGoalieOvertimeLosses === null
                              ){'0'}else{x.homeGoalieOvertimeLosses}
                          - name: SO
                            data: data
                            modify: >-
                              if(x.homeGoalieShutouts === null
                              ){'0'}else{x.homeGoalieShutouts}
                          - name: SVP
                            data: data
                            modify: Number(x.homeGoalieSavePercentage).toFixed(3)
                          - name: GAA
                            data: data
                            modify: Number(x.homeGoalieGoalsAgainstAvg).toFixed(2)
                          - name: PICK
                            data: data
                            modify: |-
                              switch(true){
                                case (x.homeGoalieGoalsAgainstAvg == 0) || (x.awayGoalieGoalsAgainstAvg == 0) :
                                  '<div style="text-align:center;"><ha-icon icon="mdi:crosshairs-question"></div>';
                                  break;
                                case (x.homeGoalieGoalsAgainstAvg - x.awayGoalieGoalsAgainstAvg) > 0:
                                  '<div style="text-align:center;"><ha-icon icon="mdi:arrow-right"></div>';
                                  break;
                                case (x.homeGoalieGoalsAgainstAvg - x.awayGoalieGoalsAgainstAvg) < 0:
                                  '<div style="text-align:center;"><ha-icon icon="mdi:arrow-left"></div>';
                                  break;
                                default:
                                  '<div style="text-align:center;"><ha-icon icon="mdi:arrow-all"></div>';
                                }
                          - name: AWAY
                            data: data
                            modify: >-
                              '<div><img src="' + x.awayTeamLogoSvg + '"
                              style="height:
                              20px;vertical-align:middle;">&nbsp;' +
                              x.awayTeamName + '</div>'
                          - name: GOALIE
                            data: data
                            modify: x.awayGoalieName
                          - name: RANK
                            data: data
                            modify: >-
                              if(x.awayGoaliePositionRank == null
                              ){'None'}else{x.awayGoaliePositionRank}
                          - name: W
                            data: data
                            modify: >-
                              if(x.awayGoalieWins === null
                              ){'0'}else{x.awayGoalieWins}
                          - name: L
                            data: data
                            modify: >-
                              if(x.awayGoalieLosses === null
                              ){'0'}else{x.awayGoalieLosses}
                          - name: OTL
                            data: data
                            modify: >-
                              if(x.awayGoalieOvertimeLosses === null
                              ){'0'}else{x.awayGoalieOvertimeLosses}
                          - name: SO
                            data: data
                            modify: >-
                              if(x.awayGoalieShutouts === null
                              ){'0'}else{x.awayGoalieShutouts}
                          - name: SVP
                            data: data
                            modify: Number(x.awayGoalieSavePercentage).toFixed(3)
                          - name: GAA
                            data: data
                            modify: Number(x.awayGoalieGoalsAgainstAvg).toFixed(2)
title: Temporada NHL

By the other hand, is the goalie sensor working?

I don’t know about the goalie sensor, been focused on NCAAF. I do show NHL games coming-up and Completed.

Is this a new install or are you changing an existing config that had been working? If this is your first time setting it up, I would suggest going through @kbrown01 documentation at the top of this thread or hit his github site to make sure everything is installed.

To show game cards there are a couple pieces. The cards are done through Teamtracker. In the dashboard. Your code works on my dashboard so guessing it is Teamtracker either in your yaml or somewhere else

To see if you have teamtracker sensors setup go to developer tools, template and put this code in - you should see sensors for all of the NHL teams. If not most likely that is your problem.

{%- for team in integration_entities("teamtracker") -%}
            {%- if state_attr(team, "league") == "NHL" -%}
            {{ team, " " }}
            {%- endif -%}
          {%- endfor -%}

Thanks @bburwell that’s weird I got values with that template:

Maybe something language-related? This is a new install. I’ve been using TeamTracker and its card for a long time and I can see my old sensors and the new ones. I installed all the prerequisites too.

Hello. For the goalie sensor to display results on it’s tab, you’ll need to ensure you add the decluttering template to your dashboard. You’ll also want to ensure you create the sensor. Scroll up to message 67 / 626 and you can start there. I can’t remember if there were more changes afterwards, so a quick search would be wise. @kbrown01 has shared many updates since first introduction.

For your Pre, In and Post sensors to display, make sure you have the NHL TeamTracker sensors added to sensor.yaml. If you have, pick one and check to ensure its live. I’m also going to assume you installed TeamTracker from HACS along with everything else listed in the initial post.

You can try adding a testing tab to your NHL and have it show a card. You will be calling a sensor directly and not using the decluttering card.

Here is the code - using Avalanche because they are playing today.

                   -  attributes:
                        label: Testing
                      card:
                        type: custom:layout-card
                        layout_type: masonry
                        width: 200px
                        max-columns: 5
                        cards:
                          - type: markdown
                            content: |
                              <h2>Testing Teamtracker/h2>
                          - type: custom:teamtracker-card
                            entity: sensor.colorado_avalanche
                            outline: true
                            outline_color: deeppink

Yes it worked, also I’m going to check messages as @ehcah said:
It is supposed that each custom card automatically adds the resources to Lovelace, right? I can see them in lovelace resources; however, I’m not sure if something additional is required.


It looks like you have NFL and MLB. Assuming you have Pre/Post/Live cards there as well. Do they populate correctly?

If yes - then something is wrong around your NHL Teamtracker - but the test seems to point that it is ok.
If no - then would want to go through your code again.

I just tested your game_stats and -attributes down code in NHL and it worked for me. May need to test the whole code if NFL/MLB fail.

Ok I just created a blank dashboard, applied your dashboard code and it worked for me.

I think this is pretty much @kbrown01 original code, I just moved it into separate yaml file - nhl_sensor.yaml. This is what is working for me.

##
##  NHL Teams
##
- platform: teamtracker
  league_id: NHL
  team_id: DET
  name: Detroit Red Wings
- platform: teamtracker
  league_id: NHL
  team_id: NSH
  name: Nashville Predators
- platform: teamtracker
  league_id: NHL
  team_id: FLA
  name: Florida Panthers
- platform: teamtracker
  league_id: NHL
  team_id: STL
  name: St Louis Blues
- platform: teamtracker
  league_id: NHL
  team_id: COL
  name: Colorado Avalanche
- platform: teamtracker
  league_id: NHL
  team_id: BOS
  name: Boston Bruins
- platform: teamtracker
  league_id: NHL
  team_id: NYI
  name: New York Islanders
- platform: teamtracker
  league_id: NHL
  team_id: PIT
  name: Pittsburg Penguins
- platform: teamtracker
  league_id: NHL
  team_id: NJ
  name: New Jersey Devils
- platform: teamtracker
  league_id: NHL
  team_id: DAL
  name: Dallas Stars
- platform: teamtracker
  league_id: NHL
  team_id: CBJ
  name: Columbus Blue Jackets
- platform: teamtracker
  league_id: NHL
  team_id: TOR
  name: Toronto Maple Leafs
- platform: teamtracker
  league_id: NHL
  team_id: MTL
  name: Montreal Canadians
- platform: teamtracker
  league_id: NHL
  team_id: CAR
  name: Carolina Hurricanes
- platform: teamtracker
  league_id: NHL
  team_id: WSH
  name: Washington Senators
- platform: teamtracker
  league_id: NHL
  team_id: CGY
  name: Calgary Flames
- platform: teamtracker
  league_id: NHL
  team_id: NYR
  name: New York Rangers
- platform: teamtracker
  league_id: NHL
  team_id: VAN
  name: Vancouver Canucks
- platform: teamtracker
  league_id: NHL
  team_id: PHI
  name: Philadelphia Fylers
- platform: teamtracker
  league_id: NHL
  team_id: LA
  name: Los Angeles Kings
- platform: teamtracker
  league_id: NHL
  team_id: ARI
  name: Arizona Coyotes
- platform: teamtracker
  league_id: NHL
  team_id: SJ
  name: San Jose Sharks
- platform: teamtracker
  league_id: NHL
  team_id: BUF
  name: Buffalo Sabres
- platform: teamtracker
  league_id: NHL
  team_id: SEA
  name: Seattle Kraken
- platform: teamtracker
  league_id: NHL
  team_id: VGK
  name: Los Vegas Golden Knights
- platform: teamtracker
  league_id: NHL
  team_id: TB
  name: Tampa Bay Lightning
- platform: teamtracker
  league_id: NHL
  team_id: OTT
  name: Ottawa Senators
- platform: teamtracker
  league_id: NHL
  team_id: WPG
  name: Winnipeg Jets
- platform: teamtracker
  league_id: NHL
  team_id: EDM
  name: Edmonton Oilers
- platform: teamtracker
  league_id: NHL
  team_id: MIN
  name: Minnesota Wild
- platform: teamtracker
  league_id: NHL
  team_id: ANA
  name: Anaheim Ducks
- platform: teamtracker
  league_id: NHL
  team_id: CHI
  name: Chicago Blackhawks
  
##
## NHL Standings
##
- platform: rest
  scan_interval: 36000
  name: NHL Standings
  unique_id: sensor.nhl_standings
  #resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?region=us&lang=en&contentorigin=espn&type=3&level=2&sort=playoffseed%3Aasc%2Cpoints%3Adesc%2Cgamesplayed%3Aasc%2Crotwins%3Adesc&seasontype=2
  resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - children
##
## NHL Wildcard
##
- platform: rest
  scan_interval: 36000
  name: NHL Wildcard
  unique_id: sensor.nhl_wildcard
  resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?region=us&lang=en&contentorigin=espn&type=3&level=2&sort=playoffseed%3Aasc%2Cpoints%3Adesc%2Cgamesplayed%3Aasc%2Crotwins%3Adesc&seasontype=2
  value_template: "{{ now() }}"
  json_attributes:
      - children
      - overall


##
## Starting Goalies
##
## NOTE: At this time this does not work as expected. The resource link changes daily and you need to get the new link from the site.
## Currenty looking at alternatives
##
- platform: rest
  name: nhl_starting_goalies
  scan_interval: 3600
  resource: https://www.dailyfaceoff.com/_next/data/q_XkeY-XNmz9svQccaln1/starting-goalies.json
  value_template: "{{ value_json.pageProps.date }}"
  json_attributes_path: "$.pageProps"
  json_attributes:
    - data        

I don’t have MLB or NFL, I’ll check again my code. All resorces are automaticaly added when custom cards are intalled, Am I right?
I think it is an error on my custom cards config (layout-card, decluttering), because every test I get the sensors state:

What I don’t understand is that when I copied your dashboard to an empty dashboard on my system, it provided all of the pre and post NHL games. So based on that I assume your code is correct. I assumed MLB/NFL but was mistaken.

With the template testing it also looks like Teamtracker is installed correctly because you can display a card that we showed in test.

Do your NHL sensors look like what I sent? Can you post those?

Here is my working game_stats. Maybe delete yours and add this one. Maybe there is some weird formatting that is getting lost when you post here but is on your system

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" -%}
            {%- if team in state_attr('sensor.nfl_red_zone','teams') -%}
              {{{"type": "custom:teamtracker-card",
                "entity": team,
                "card_mod": {"style": "ha-card {\n\n    color:  black; \n    background-color:  #ffcccc; \n    box-shadow: 0 0 10px 5px red;\n}\n"},
                "home_side": "right"}}},
            {%- else -%}
              {{{"type": "custom:teamtracker-card",
                "entity": team, 
                "home_side": "right"}}},
            {%- endif -%}
            {%- endif -%}
            {%- endif -%}
            {%- endif -%}
          {%- endfor -%}
        exclude:
          - entity_id: '*team_tracker*'
      sort:
        method: attribute
        attribute: date

Sure I copied-pasted from yours into mine:

##
##  NHL Teams
##
- platform: teamtracker
  league_id: NHL
  team_id: DET
  name: Detroit Red Wings
- platform: teamtracker
  league_id: NHL
  team_id: NSH
  name: Nashville Predators
- platform: teamtracker
  league_id: NHL
  team_id: FLA
  name: Florida Panthers
- platform: teamtracker
  league_id: NHL
  team_id: STL
  name: St Louis Blues
- platform: teamtracker
  league_id: NHL
  team_id: COL
  name: Colorado Avalanche
- platform: teamtracker
  league_id: NHL
  team_id: BOS
  name: Boston Bruins
- platform: teamtracker
  league_id: NHL
  team_id: NYI
  name: New York Islanders
- platform: teamtracker
  league_id: NHL
  team_id: PIT
  name: Pittsburg Penguins
- platform: teamtracker
  league_id: NHL
  team_id: NJ
  name: New Jersey Devils
- platform: teamtracker
  league_id: NHL
  team_id: DAL
  name: Dallas Stars
- platform: teamtracker
  league_id: NHL
  team_id: CBJ
  name: Columbus Blue Jackets
- platform: teamtracker
  league_id: NHL
  team_id: TOR
  name: Toronto Maple Leafs
- platform: teamtracker
  league_id: NHL
  team_id: MTL
  name: Montreal Canadians
- platform: teamtracker
  league_id: NHL
  team_id: CAR
  name: Carolina Hurricanes
- platform: teamtracker
  league_id: NHL
  team_id: WSH
  name: Washington Senators
- platform: teamtracker
  league_id: NHL
  team_id: CGY
  name: Calgary Flames
- platform: teamtracker
  league_id: NHL
  team_id: NYR
  name: New York Rangers
- platform: teamtracker
  league_id: NHL
  team_id: VAN
  name: Vancouver Canucks
- platform: teamtracker
  league_id: NHL
  team_id: PHI
  name: Philadelphia Fylers
- platform: teamtracker
  league_id: NHL
  team_id: LA
  name: Los Angeles Kings
- platform: teamtracker
  league_id: NHL
  team_id: ARI
  name: Arizona Coyotes
- platform: teamtracker
  league_id: NHL
  team_id: SJ
  name: San Jose Sharks
- platform: teamtracker
  league_id: NHL
  team_id: BUF
  name: Buffalo Sabres
- platform: teamtracker
  league_id: NHL
  team_id: SEA
  name: Seattle Kraken
- platform: teamtracker
  league_id: NHL
  team_id: VGK
  name: Los Vegas Golden Knights
- platform: teamtracker
  league_id: NHL
  team_id: TB
  name: Tampa Bay Lightning
- platform: teamtracker
  league_id: NHL
  team_id: OTT
  name: Ottawa Senators
- platform: teamtracker
  league_id: NHL
  team_id: WPG
  name: Winnipeg Jets
- platform: teamtracker
  league_id: NHL
  team_id: EDM
  name: Edmonton Oilers
- platform: teamtracker
  league_id: NHL
  team_id: MIN
  name: Minnesota Wild
- platform: teamtracker
  league_id: NHL
  team_id: ANA
  name: Anaheim Ducks
- platform: teamtracker
  league_id: NHL
  team_id: CHI
  name: Chicago Blackhawks
  
##
## NHL Standings
##
- platform: rest
  scan_interval: 36000
  name: NHL Standings
  unique_id: sensor.nhl_standings
  #resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?region=us&lang=en&contentorigin=espn&type=3&level=2&sort=playoffseed%3Aasc%2Cpoints%3Adesc%2Cgamesplayed%3Aasc%2Crotwins%3Adesc&seasontype=2
  resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - children
##
## NHL Wildcard
##
- platform: rest
  scan_interval: 36000
  name: NHL Wildcard
  unique_id: sensor.nhl_wildcard
  resource: https://site.web.api.espn.com/apis/v2/sports/hockey/nhl/standings?region=us&lang=en&contentorigin=espn&type=3&level=2&sort=playoffseed%3Aasc%2Cpoints%3Adesc%2Cgamesplayed%3Aasc%2Crotwins%3Adesc&seasontype=2
  value_template: "{{ now() }}"
  json_attributes:
      - children
      - overall


##
## Starting Goalies
##
## NOTE: At this time this does not work as expected. The resource link changes daily and you need to get the new link from the site.
## Currenty looking at alternatives
##
- platform: rest
  name: nhl_starting_goalies
  scan_interval: 3600
  resource: https://www.dailyfaceoff.com/_next/data/q_XkeY-XNmz9svQccaln1/starting-goalies.json
  value_template: "{{ value_json.pageProps.date }}"
  json_attributes_path: "$.pageProps"
  json_attributes:
    - data        

So I am working on my Top 25 Card. I would really like to be able to have stats on the Top 25 Teams. I will eventually have the top 25 Scores on the left showing win loss. Here is a sandbox example with Arizona State

The Idea is that I parse the Top 25 poll and pull out the team names/abbreviations. Based on that I pull out the teams in the Top 25 that are playing. I want to sort them by their current rankings (1 being shown first, 25th last) but I haven’t figured out how to do that yet.

Would love any feedback on how to do that.

This is what it looks like so far:

I get the top 25 Team name abbreviation by running this template:

########
##NCAA Football Top 25 Teams
#### 
- name: ncaaf_team_names_t25
  unique_id: sensor.ncaaf_team_names_t25
  state: "{{ now() }}"
  attributes: 
    team_names: >
      {% set cteams = namespace(cteam=[]) %}
      {% for team in state_attr('sensor.ncaaf_rank','rankings')[0]['ranks'] %}
        {% set cteams.cteam = cteams.cteam + [team['team']['abbreviation']] %}
      {% endfor %}
      {{ cteams.cteam | join(', ') }}

Then I call them in my dashboard here:

                            - attributes:
                                label: Top 25 Games
                                icon: mdi:account-group
                              card:
                                type: horizontal-stack
                                cards:
                                  - type: vertical-stack
                                    cards:
                                      - type: custom:decluttering-card
                                        template: ncaaf_top_25_game_stats
                                        variables:
                                          - team_names: sensor.ncaaf_team_names_t25

Here is the decluttering code I am calling:

 ncaaf_top_25_game_stats:
    card:
      type: custom:auto-entities
      unique: true
      show_empty: false
      card:
        type: custom:layout-card
        layout_type: grid
        layout:
          grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))
      card_param: cards
      filter:
        template: >
          {%- set top_25_teams =
          state_attr('sensor.ncaaf_team_names_t25','team_names') -%}

          {%- for team in integration_entities('teamtracker') -%}
            {%- set team_abbr = state_attr(team, 'team_abbr') -%}
            {%- if state_attr(team, 'league') == 'NCAAF' -%}
              {%- if team_abbr in top_25_teams -%}  
                {{{"type": "custom:teamtracker-card","entity": team,"card_mod": {"style": "ha-card { font-size: .7em; line-height: .7em; width: 280px;}"},"home_side": "right"}}},
              {%- endif -%}
            {%- endif -%}
          {%- endfor -%}
        exclude:
          - entity_id: '*team_tracker*'
      sort:
        method: attribute
        attribute: date

@bburwell, friend, I finally found the issue. It was this statement: {%- if team in state_attr('sensor.nfl_red_zone','teams') -%} . Thanks for all of your help with this poor-brained guy. After an entire day, it’s finally working!!

Do you know how can I filter the duplicated cards?


And how can I override the language API with this type of sensor? I can’t see the stats by event in the card. I mean, in teamtracker I did it on config:

Your new card settup is amazing btw

if you are running them through game_stats in decluttering that is how @kbrown01 has it set up so that it only shows the Home team card.

I looks like you have adjusted the game_stats because the box on the right is what he wrote to give cards a different look when NFL teams are close to scoring “in the red zone” with the red outline you see.

did you remove this if statement in game_stats or maybe went a different direction?

 {%- if state_attr(team, "team_homeaway") == "home" -%}

Thanks, it is fixed. I erased some part of that statement

So figure I would toss this out here and maybe it helps someone. It is by nowhere complete or at a finished state. It is sloppy and needs to be tightened up but figured it might help someone who was thinking along the similar line.

I have been focused on NCAAF and trying to get a layout I like. I wanted to be able to go into a conference and get the data on a single pane for that conference. Same thought around what I posted yesterday on a single place to show the top 25 team games for the upcoming weekend.

Anyway I started seeing my sandbox was getting cluttered. So I looked into collapsible cards. Nothing officially supported but it looks like Alia5 started creating a card a couple years ago. I can’t tell if he is still working on it which was a concern. (here is a link to that card - https://github.com/Alia5/lovelace-expander-card/tree/master.

I saw another card which I believe is a fork for it and can be found here: https://github.com/spencermamer/lovelace-expander-card

What this has allowed me to create is this:

Along the right you can see that I have:

  • Conference Standings as a collapsible card
  • All teams in this conference are collapsible
  • Pulling from the teams schedules I show the final scores of the previous games and the upcoming games. Now I duplicate that with another schedule of games but again I will clean those up.
  • You have already seen this, but the cards in the lower left show upcoming matchups with the Teamtracker card. I used something similar as the red zone and outlined in blue if it was a Conference game.

Here is the code that is used in this NCAAF sandbox:

I have only completed the Big 12 at this time here is that code that I have in my ncaaf_sensors.yaml file

##
## NCAA Teams
## Big 12 Conference
- platform: teamtracker
  league_id: "NCAAF"
  team_id: "ARIZ"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Arizona"
- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_of_arizona
  unique_id: sensor.ncaaf_schedule_big_12_university_of_arizona
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/ARIZ/schedule
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 
      
- platform: teamtracker
  league_id: "NCAAF"
  team_id: "ASU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Arizona State University"
- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_arizona_state_university
  unique_id: sensor.ncaaf_schedule_big_12_arizona_state_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/ASU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 


- platform: teamtracker
  league_id: "NCAAF"
  team_id: "BAY"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Baylor University"
  
- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_baylor_university
  unique_id: sensor.ncaaf_schedule_big_12_baylor_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/BAY/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "BYU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Brigham Young University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_brigham_young_university
  unique_id: sensor.ncaaf_schedule_big_12_brigham_young_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/BYU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 


- platform: teamtracker
  league_id: "NCAAF"
  team_id: "UCF"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Central Florida"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_of_central_florida
  unique_id: sensor.ncaaf_schedule_big_12_university_of_central_florida
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/UCF/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "CIN"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Cincinnati"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_of_cincinnati
  unique_id: sensor.ncaaf_schedule_big_12_university_of_cincinnati
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/CIN/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "COLO"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Colorado Boulder"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_colorado
  unique_id: sensor.ncaaf_schedule_big_12_university_colorado
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/COLO/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "HOU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Houston"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_of_houston
  unique_id: sensor.ncaaf_schedule_big_12_university_of_houston
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/HOU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "ISU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Iowa State University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_iowa_state_university
  unique_id: sensor.ncaaf_schedule_big_12_iowa_state_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/ISU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "KU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Kansas"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_univeristy_of_kansas
  unique_id: sensor.ncaaf_schedule_big_12_univeristy_of_kansas
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/KU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "KSU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Kansas State University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_kansas_state_university
  unique_id: sensor.ncaaf_schedule_big_12_kansas_state_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/KSU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "OKST"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Oklahoma State University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_oklahoma_state_university
  unique_id: sensor.ncaaf_schedule_big_12_oklahoma_state_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/OKST/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "TCU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Texas Christian University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_texas_christian_university
  unique_id: sensor.ncaaf_schedule_big_12_texas_christian_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/TCU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "TTU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "Texas Tech University"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_texas_tech_university
  unique_id: sensor.ncaaf_schedule_big_12_texas_tech_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/TTU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "UTAH"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "University of Utah"

- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_university_of_utah
  unique_id: sensor.ncaaf_schedule_big_12_university_of_utah
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/UTAH/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

- platform: teamtracker
  league_id: "NCAAF"
  team_id: "WVU"
  sport_path: football   
  league_path: "college-football"  
  conference_id: 4
  name: "West Virginia University"
  
- platform: rest
  scan_interval: 36000
  name: ncaaf_schedule_big_12_west_virginia_university
  unique_id: sensor.ncaaf_schedule_big_12_west_virginia_university
  resource: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/WVU/schedule?seasontype=2&type=0&level=3
  value_template: "{{ now() }}"
  json_attributes:
      - team
      - events 

In my groups.yaml file is this code:

Big_12_Conference_teams_group:
    name: "Big 12 Conference Teams"
    entities:
      - sensor.arizona_state_university
      - sensor.university_of_arizona
      - sensor.brigham_young_university
      - sensor.kansas_state_university
      - sensor.oklahoma_state_university
      - sensor.university_of_utah
      - sensor.baylor_university
      - sensor.iowa_state_university
      - sensor.university_of_cincinnati
      - sensor.university_of_colorado_boulder
      - sensor.texas_tech_university
      - sensor.university_of_houston
      - sensor.university_of_kansas
      - sensor.texas_christian_university
      - sensor.university_of_central_florida        
      - sensor.west_virginia_university

sec_conference_teams_group:
    name: "SEC Conference Teams"
    entities:
      - sensor.university_of_alabama
      - sensor.university_of_arkansas
      - sensor.auburn_university
      - sensor.university_of_florida
      - sensor.university_of_georgia
      - sensor.university_of_kentucky
      - sensor.louisiana_state_university
      - sensor.mississippi_state_university
      - sensor.university_of_oklahoma
      - sensor.university_of_mississippi
      - sensor.university_of_tennessee
      - sensor.texas_am_university
      - sensor.univerisity_of_texas_at_austin
      - sensor.vanderbilt_university
      
acc_conference_teams_group:
    name: "ACC Conference Teams"
    entities:
      - sensor.boston_college
      - sensor.university_of_california_berkeley
      - sensor.clemson_university
      - sensor.duke_university
      - sensor.florida_state_university
      - sensor.georgia_institute_of_technology
      - sensor.university_of_louisville
      - sensor.university_of_miami
      - sensor.university_of_north_carolina
      - sensor.notre_dame_fighting_irish
      - sensor.university_of_pittsburgh
      - sensor.southern_methodist_university
      - sensor.stanford_university
      - sensor.syracuse
      - sensor.university_of_virginia
      - sensor.virginia_polytechnic
      - sensor.wake_forest_university

To get the expander card go to the link above (I am using the spence one). Download the file, I created a directory in the /config/www/community directory called lovelace-expander-card and put the .js file there.

Then I went into dashboards resources (upper right - resources) , in resources page add resource, and pointed it here:

Hope this helps and feel free to comment.