NFL game sensor (scores, possession, etc)

My NFL Integration started erroring out recently. If I try to follow the link for documentation or known issues on github, it fails. The best I can tell is that it is trying to get to ha_nfl instead of ha-nfl (underscore vs. a dash). Would this also lead to the integration not loading with the following log entry? Or is this just normal at this point in between seasons?

Error setting up entry Green Bay Packers for nfl
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File “/config/custom_components/nfl/init.py”, line 66, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: ‘ConfigEntries’ object has no attribute ‘async_setup_platforms’

Some work needs to happen on the integration. See this for details. hass.config_entries.async_setup_platforms is scheduled to be removed in 2023.03 · Issue #37 · zacs/ha-nfl · GitHub

Should be fixed now, thanks for the PR @D34DC3N73R! I’ll cut a release shortly.

I’m not sure why the pytest is failing. Ran out of time to work on it today, but the actual async issue is resolved with that PR.

No worries. If you have time to look into it that’s appreciated. Otherwise I can take a look one night this week.

If anyone’s interested, I made a dashboard with dynamic cards for the whole league to follow all the games.
In addition to ha-nfl and ha-nfl-card, the custom card auto-entities is also needed.

2 Likes

I have a issue setup the NFL Game Score Light Color Flasher
I ran a test via the Automation and got a error of :
Stopped because an error was encountered Error rendering data template: UndefinedError: 'dict object' has no attribute 'entity_id'

here are some of the screenshots

Can someone please assist me on what I am doing wrong
thank you

You can’t test via the automation editor because the automation depends on trigger data that has to come from actual entity changes. Once it’s set up, it’s possible to manipulate the entity attributes via the States tab in Developer Tools to test. The sensor state has to be set to IN first (it is most likely PRE at the moment of writing this). Then you can change the team_score attribute of the nfl entity (and opponent_score if you’re also activating on it).

Thank you!

I see this error occasionally in my logs:

This causes the entity to show as offline when it occurs. Anyone else run into this?

Leads me to think maybe the ESPN JSON went away temporarily. It shows up now for me. Did it fix itself for you?

Yes, it’s intermittent. Looking at the logs it’s happened 75 times in the past 2 weeks. I first noticed when I went to view the score in my dashboard and it wasn’t available. I wasn’t sure if it’s something in my system or the ESPN API.

i have hyperhdr rooted in my LG tv. can I use hyperhdr with the blueprint or any automation out there for hyperhdr wled?

Not super familiar with that. It’s like Hyperion right? If they have a json api, you can check out this post to see an automation and shell command I used with Hyperion.

That would work for any team (and opposing team) using the RGB colors from the team sensor, make sure to change team_colors_rbg to team_colors_rgb as that was corrected after I made the automation.

I personally don’t really use it anymore, but call a custom effect in hyperion as well as some WLED strips. If you run into problems I can post the automation I use.

Please post the automation you use. Hyperhdr is just hyperion just enhanced for HDR. what i’m looking for is when my Cowboys play hyperhdr does team colors and effects when they score. Then when game done. go back to normal HyperHDR

Sure, I made a custom effect with the colors I wanted in the hyperion backend. And then I use a shell command to call it in Home Assistant.

in configuration.yaml

shell_command:
  hyperion_gpg: curl "http://192.168.0.231:8090/json-rpc"   -X POST   -d "{\"command\":\"effect\", \"effect\":{\"name\":\"Go Pack Go\"}, \"duration\":10000, \"priority\":1, \"origin\":\"Home Assistant\"}"
  hyperion_stop_effect: curl "http://192.168.0.231:8090/json-rpc"   -X POST   -d "{\"command\":\"clear\", \"priority\":-1}"

and this is the automation (which also triggers a LIFX bulb and WLED strips)

- id: '1607306431209'
  alias: NFL - Go Pack Go
  trigger:
  - platform: state
    entity_id:
    - sensor.nfl
    attribute: team_score
  condition:
  - condition: state
    entity_id: sensor.nfl
    state: IN
  - condition: template
    value_template: '{{ (trigger.to_state.attributes.team_score | int) >= (trigger.from_state.attributes.team_score
      | int + 1) }}'
  - condition: template
    value_template: '{{ (trigger.to_state.attributes.team_score | int) <= (trigger.from_state.attributes.team_score
      | int + 6) }}'
  action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - data:
      mode: strobe
      brightness: 255
      rgb_color:
      - 3
      - 171
      - 0
      period: 0.5
      cycles: 20
    target:
      entity_id: light.lamp
    action: lifx.effect_pulse
  - data: {}
    action: shell_command.hyperion_gpg
  - type: turn_on
    device_id: fbbc7b604f8cd4f13d8fbf1eb656d6de
    entity_id: 9c7e3d05cf771f816a3974c19e823716
    domain: light
    brightness_pct: 100
  - type: turn_on
    device_id: e8b124eaae74dfc33158bc0bdfeaec57
    entity_id: f6b2a26d93d1906a7b609cf2e5fbd7d0
    domain: light
    brightness_pct: 100
  - device_id: ede6522057e1a6336b15b9c326292d2f
    domain: select
    entity_id: f27d7a8c72655fa2917c7ba3e94e819c
    type: select_option
    option: Go-Pack-Go
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - data: {}
    action: shell_command.hyperion_stop_effect
  - type: turn_off
    device_id: fbbc7b604f8cd4f13d8fbf1eb656d6de
    entity_id: 9c7e3d05cf771f816a3974c19e823716
    domain: light
  - type: turn_off
    device_id: e8b124eaae74dfc33158bc0bdfeaec57
    entity_id: f6b2a26d93d1906a7b609cf2e5fbd7d0
    domain: light
  - type: turn_off
    device_id: ede6522057e1a6336b15b9c326292d2f
    entity_id: 48a682787486ac0673a704168522e697
    domain: light
  mode: parallel

The first delay is set up in case the sensor is ahead of the broadcast. The second delay is so the effects terminate after 10 seconds. You can adjust the conditions so they only happen for touchdowns or field goals. They’re currently set so every point triggers the automation.

This is a version with the LIFX and WLED effects stripped out.

- id: '1607306431209'
  alias: NFL - Go Pack Go
  trigger:
  - platform: state
    entity_id:
    - sensor.nfl
    attribute: team_score
  condition:
  - condition: state
    entity_id: sensor.nfl
    state: IN
  - condition: template
    value_template: '{{ (trigger.to_state.attributes.team_score | int) >= (trigger.from_state.attributes.team_score
      | int + 1) }}'
  - condition: template
    value_template: '{{ (trigger.to_state.attributes.team_score | int) <= (trigger.from_state.attributes.team_score
      | int + 6) }}'
  action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - data: {}
    action: shell_command.hyperion_gpg
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - data: {}
    action: shell_command.hyperion_stop_effect
  mode: parallel

Is go pack go the effect you custom-made? I’ll have to make my own effect?

Yeah you can make your own, or use a default one and define colors. I started with the police light effect and changed a couple settings and colors for my go pack go effect.

Hello folks!

I just installed this today, and as simple as the setup appears to be, it is erroring out on me when I restart HA:

Log details (ERROR)

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:361
integration: Sensor (documentation, issues)
First occurred: 3:12:20 PM (1 occurrences)
Last logged: 3:12:20 PM

Error while setting up nfl platform for sensor

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 361, in _async_setup_platform await asyncio.shield(awaitable) File “/config/custom_components/nfl/sensor.py”, line 40, in async_setup_platform config.entry_id = slugify(f"{config.get(CONF_TEAM_ID)}") ^^^^^^^^^^^^^^^ AttributeError: ‘NodeDictClass’ object has no attribute ‘entry_id’

Hmmmmm. My config in configuration.yaml is super simple:

# Follow the Kansas City Chiefs
  - platform: nfl
    team_id: 'KC'

This is in the ‘sensor’ section of my configuration.yaml. I’m a solid user of HA but I’m not very familiar with troubleshooting it… I don’t see any sensor created. I’m happy to provide any information that may help if you let me know how to gather it. Thanks so much!

Geez, never mind, I was confused about configuring this. I followed the instructions more closely and it’s working just fine. Sorry for the noise. :slight_smile: And thank you for a great integration!

2 Likes