Sports Standings and Scores

hahaha. Don’t sweat it. If I could not reply due to family, I would not. We do Christmas with the kids/grandkids Christmas Eve. Just the wife and I watching football.

I think it is time to just post the whole damn dashboard instead of snippets.

I don’t have a test system either. But, I do have test dashboards to paste it into and see what I can see. Although, I am thinking another VM for testing would be prudent. I do a lot of cleanup after helping someone :slight_smile:

Same here. One kid + grands coming later, other is spending today with his girlfriend’s family. Wife watching Netflix … me football and trying to figure out the Playoff for football!

Christmas is odd this year. East coast of Canada, no snow. Our kids are older too. Feels like a random monday. I appreciate the help!

Here is the full dashboard code. I have reordered a few things and changed a few colors, but when I go line by line with GitHub, I’m not seeing the errors. I have removed NFL, MLB, NBA and starting goalies. I wanted to understand how taxing these sensors would be before adding all the rest and then adding college football and soccer (not MLS).

decluttering_templates:
  nhl_settings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      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" -%}
              {{{"type": "custom:teamtracker-card",
                "entity": team, 
                "home_side": "right"}}},
            {%- endif -%}
            {%- endif -%}
            {%- endif -%}
          {%- endfor -%}
        exclude:
          - entity_id: '*team_tracker*'
      sort:
        method: attribute
        attribute: date
  sos_settings:
    card:
      type: custom:flex-table-card
      title: '[[title]]'
      css:
        table+: 'padding: 0px; width: 2000px;'
        tbody tr td:first-child: 'width: 2px;'
        tbody tr:hover: 'background-color: green!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;
             }
      entities:
        include: '[[entity]]'
      sort_by: sos.dataRows-
      columns:
        - name: SOS
          data: '[[attribute]]'
          modify: |-
            if (x[8] > 3 ){
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style="background-color:lightgreen;text-align:center">' + x[8] + '</div>'; }
            else if (x[8] < 3) {
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style="background-color:lightcoral;text-align:center"">' + x[8] + '</div>'; }
            else {
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style=";text-align:center">' + x[8] +'</div>'}
        - name: Team
          data: '[[attribute]]'
          modify: >-
            '<div><img src="' + x[0].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + x[0].team.name
            + ' (' + parseFloat(2*x[0].team.wins + x[0].team.overtimeLosses) +
            ')</div>'
        - name: Monday
          data: '[[attribute]]'
          modify: >-
            if(x[1]){'<div><img src="' + x[1].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[1].home ? ''
            : '@ ') + x[1].team.name + ' (' + parseFloat(2*x[1].team.wins +
            x[1].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Tuesday
          data: '[[attribute]]'
          modify: >-
            if(x[2]){'<div><img src="' + x[2].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[2].home ? ''
            : '@ ') + x[2].team.name + ' (' + parseFloat(2*x[2].team.wins +
            x[2].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Wednesday
          data: '[[attribute]]'
          modify: >-
            if(x[3]){'<div><img src="' + x[3].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[3].home ? ''
            : '@ ') + x[3].team.name + ' (' + parseFloat(2*x[3].team.wins +
            x[3].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Thursday
          data: '[[attribute]]'
          modify: >-
            if(x[4]){'<div><img src="' + x[4].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[4].home ? ''
            : '@ ') + x[4].team.name + ' (' + parseFloat(2*x[4].team.wins +
            x[4].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Friday
          data: '[[attribute]]'
          modify: >-
            if(x[5]){'<div><img src="' + x[5].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[5].home ? ''
            : '@ ') + x[5].team.name + ' (' + parseFloat(2*x[5].team.wins +
            x[5].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Saturday
          data: '[[attribute]]'
          modify: >-
            if(x[6]){'<div><img src="' + x[6].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[6].home ? ''
            : '@ ') + x[6].team.name + ' (' + parseFloat(2*x[6].team.wins +
            x[6].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
        - name: Sunday
          data: '[[attribute]]'
          modify: >-
            if(x[7]){'<div><img src="' + x[7].team.logo + '"
            style="height:20px;vertical-align:middle;">&nbsp;' + (x[7].home ? ''
            : '@ ') + x[7].team.name + ' (' + parseFloat(2*x[7].team.wins +
            x[7].team.overtimeLosses) + ')</div>'}else{'<div
            style="text-align:center">---</div>'}
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: var(--ha-card-background, var(--card-background-color, white) );
                border-color: black;
                border-width: 2px;
                border-top-left-radius: 20px;
                border-top-right-radius: 20px;
                border-style: solid;
                overflow: hidden;
                width: 25%;
              }
              mwc-tab[active] {
                background: #d3d3d3 !important;
              }
        card:
          type: custom:tabbed-card
          styles:
            '--mdc-theme-primary': silver
            '--mdc-tab-text-label-color-default': black
            '--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: black;
                        border-width: 2.5px;
                        border-top-left-radius: 20px;
                        border-top-right-radius: 20px;
                        border-style: solid;
                        overflow: hidden;
                        width: 20%;
                      }
                      mwc-tab[active] {
                        background: #d3d3d3 !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: 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: black;
                                border-width: 2.5px;
                                border-top-left-radius: 20px;
                                border-top-right-radius: 20px;
                                border-style: solid;
                                overflow: hidden;
                                width: 25%;
                              }
                              mwc-tab[active] {
                                background: #d3d3d3 !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: 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_s
                                          - 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_s
                                          - 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_s
                                          - 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: Schedule
                        icon: mdi:calendar-blank
                      card:
                        type: custom:decluttering-card
                        template: sos_settings
                        variables:
                          - title: NHL Strength of Schedule
                          - entity: sensor.hockey_strength_of_schedule
                          - attribute: sos.dataRows
                    - attributes:
                        label: Pregame
                        icon: mdi:blood-bag
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: PRE
                    - attributes:
                        label: Live
                        icon: mdi:hockey-puck
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: IN
                    - attributes:
                        label: Postgame
                        icon: mdi:hockey-sticks
                      card:
                        type: custom:decluttering-card
                        template: game_stats
                        variables:
                          - sport: NHL
                          - status: POST
title: Sports Standings and Scores

That looks wrong. Do you have a sensor named that?

Plus this is doubled up:

                                    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_s
                                          - sensor.nhl_wildcard
                                          - sensor.nhl_wildcard_standings

You have excluded entities twice in the same template. Which could be an issue, I would imagine it is an error for same key twice, but even not if second wins and that sensor does not exist, then you would have issues. That section should not have the second excluded_entities

1 Like
  • sensor.nhl_starting_s is a bit of a mystery. I’m going to guess it’s left over from adding and removing the starting goalies page. At one point, I was on sensor_2 and annoyed. I often used find and replace and must have messed up.

The double exclusion could have happened from removing the other leagues and moving that section around.

@jeffcrum and others, I have posted on flex-table-card GITHUB an enhancement request that IMHO would be killer. Please take a look at:

Read through to the end which has the current solution that works flawlessly in my setup. This enhancement would greatly enhance the use. It allows to import functions from a separate JS file that you can write to do very complex things. It is also especially useful in code repetition reduction so that changes can be made once to change many uses of the same pattern of JS snippets.

Please take a look, test if you like. Questions/comments always welcome.

I will never go back so if it is not put into the core product, I will just reimplement on each update to it. As an example for the Strength of Schedule post I did above. It reduces tons of repetitive JS to this:

      columns:
        - name: SOS
          data: '[[attribute]]'
          modify: |-
            if (x[8] > 3 ){
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style="background-color:lightgreen;text-align:center">' + x[8] + '</div>'; }
            else if (x[8] < 3) {
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style="background-color:lightcoral;text-align:center"">' + x[8] + '</div>'; }
            else {
                '<div style="display:none;">'+ x[8] + '</div>' + '<div style=";text-align:center">' + x[8] +'</div>'}
        - name: Team
          data: '[[attribute]]'
          modify: |
            plugin.sosteam(x)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,1)
        - name: Monday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,1)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,2)
        - name: Tuesday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,2)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,3)
        - name: Wednesday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,3)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,4)
        - name: Thursday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,4)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,5)
        - name: Friday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,5)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,6)
        - name: Saturday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,6)
        - name: ' '
          data: '[[attribute]]'
          modify: |
            plugin.sosind(x,7)
        - name: Sunday
          data: '[[attribute]]'
          modify: |
            plugin.sosopponent(x,7)
1 Like

Thanks. I think it is a great request. I have commented there supporting it!

1 Like

Thank you!

What I should really test is that if the import file does not exist, then does the JS fail?
If not, then the only change would be the ne command and the expected name of the file. I suppose that is not a hard test for me … a few hard refreshes should tell me.

Or some JS code magic.

1 Like

haha. I even came up with an issue that you already solved.

I didn’t read it all the way through and had to edit my response there.

While it isn;t a big code saver, this does provide value should we ever want logic in any of the columns for formatting or across the board changes for all sports:

        - name: <div>GP</div>
          data: '[[attribute]]'
          modify: plugin.sportstat(x,'GP','displayValue')

and

export function sportstat(x,abbr,field){
    return x.stats.find(y=>y.abbreviation == abbr)[field];
}

Note I pass in the name of the fieldname of interest because for some its ‘displayValue’, for some ‘summary’ and for some ‘value’

1 Like

For those that follow, I changed the Strength of Schedule and also the Starting Goalie Sensors because of the latest change in multiscrape supporting scraping JSON into attributes. THese are now created this way (so you can eliminate getting the buildid for starting goalies):

  - name: SOS scraper
    resource: https://www.dailyfaceoff.com/nhl-weekly-schedule
    scan_interval: 3600
    sensor:
      - unique_id: hockey_strength_of_schedule
        name: Hockey Strength of Schedule
        select: '#__NEXT_DATA__'
        value_template: '{{ now() }}'
        attributes:
          - name: sos
            select: '#__NEXT_DATA__'
            value_template: >
                {{ (value | from_json)['props']['pageProps'] }}
  - name: Goalie scraper
    resource: https://www.dailyfaceoff.com/starting-goalies
    scan_interval: 3600
    sensor:
      - unique_id: sensor.nhl_starting_goalies
        name: NHL Starting Goalies
        select: '#__NEXT_DATA__'
        value_template: '{{ now() }}'
        attributes:
          - name: data
            select: '#__NEXT_DATA__'
            value_template: >
                {{ (value | from_json)['props']['pageProps'] }}

Using multiscrape and these in an included multiscrape YAML, you have the two sensors needed to render the tabs.

and

Hey,
I know you are throwing upgrade pieces here. But, are you changing your Github with all of these so someone can jump there and grab everything from scratch?

Just checking.

Thanks for all that you do!

@jeffcrum you are right on. I need to do exactly that …

BUT …

My implementation is already fill of using my “plugin” functionality that I hand-did in flex-table-card. It would be impossible to just upload without that functionaliy being implemented in flex-table-card.

I appreciate your promotion there, but so far I see crickets from the code owner. So I cannot just post it up for everyone because it requires a person to “hack” the source JS.

As I stated:

I will never go back so if it is not put into the core product, I will just reimplement on each update to it.

1 Like

firstly I’d like to say thanks for creating this. It’s pretty great!

the only issue I’m running into is that I can’t see any teams listed under pre, live, post. All the team sensors have been added and I can see them in their respective standings tabs, but I can’t see them in pre live or postgame. Any pointers?

Those are all from teamtracker, do you have all of that integration installed? Like you would have the teamtracker integration installed and have like this in an included sensor.yaml:

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

I only piggy back PRE, POST, IN from teamtracker into those tabs with really minimal changes. All the standings are taken directly from ESPN with my code but not specific game information.

Teamtracker = Games
My stuff = Standings plus some enhancements (more to come) like NHL Strength of Schedule and NHL Starting Goalies.

If you do and still get errors then possibly you do not have the red zone installed like others and I can help you either have that or remove it (it is only for NFL anyway)

I modified the SOS multiscrape today as the system now requires an input date (it used to just default to the week’s Monday). This will append the Monday of the current week to the query:

  - name: SOS scraper
    resource_template: "https://www.dailyfaceoff.com/nhl-weekly-schedule/{{ (now().timestamp()+(0-now().weekday())*86400) | int | timestamp_custom('%Y-%m-%d') }}"
    scan_interval: 43200
    sensor:
      - unique_id: hockey_strength_of_schedule
        name: Hockey Strength of Schedule
        select: '#__NEXT_DATA__'
        value_template: '{{ now() }}'
        attributes:
          - name: sos
            select: '#__NEXT_DATA__'
            value_template: >
                {{ (value | from_json)['props']['pageProps'] }}

I am still a little new tp Home Assistant. Does anyone know how to turn off the rest sensors in the offseason?

For example, how would I turn off the nfl/football after the Super Bowl and turn it back on right before the pre-season? I would like to avoid the rest calls to ESPN in the off-season.

Do you pay for data on your internet? If so, I can see the need. If not, no need.

But, you need to remove the sensor in the yaml to ‘disable’ it as far as I know.

@jeffcrum is exactly right. But if you insist, you can set the scan interval to some huge number like 360000 or more. Then create an automation that executes updating the entity according to the schedule you want.

Of course it will update on every restart of Home Assistant, but this would give you total control to update only when you want it.

So the logic would be …

Set scan_interval to once every 6 months
Then an automation that executes (daily or whatever you choose) … check the month is sep, oct, nov, dec … if yes, update the entity.

1 Like

I asked because it seemed like Home Assistant was getting sluggish with my sports API calls on (along with other sensors) on a ESXi VM on a QNAP NAS. I just thought the REST calls could be a possible reason. I am enjoying Home Assistant, but still trying to tweak everything to run more efficiently. I wish there was a performance advice category, but there are so many nuances to HA.

What do you recommend for the scan interval settings for the REST calls to ESPN?