NFL game sensor (scores, possession, etc)

I believe I set the cutoff day as Wednesday… so as long as a game doesn’t get pushed past that, things should work. If the sensor shows unavailable, it means that the team acronym isn’t in the feed (eg. PHI), so if you want to file a bug on GitHub, it would help to include the contents of the ESPN JSON file. That way I might be able to put in a workaround, depending on what the data looks like.

Once the playoffs start, I’ll probably need to patch the component since (if I remember right) they change the format of the JSON slightly at that point.

1 Like

Sorry, I noticed it was unavailable this morning right before I went in to work, and by the time I got a chance to dig in to check the json feed and the forum here, it had resolved itself. If I see it happen again, I’ll try to grab a copy of the json right then to share with you. Thanks once again for all the work on this all season!

No worries at all, I appreciate the report. I’m curious if there is ever a point during the week (it seems like Weds at 8am is when they cycle the feed) when neither the games from last week or the games for the following week show up. If that’s the case I could suppress the “unavailable” at that specific time of the week or something.

i just sent an alert to check next week at that time to see if i can catch it. ill report back next week

1 Like

Hey Zacs, I sent you an email in regards to this plugin. I also believe I have a way with how I did something that might help with this.

Just wanted to bring this up as well. It shows the Giants score as the winning score…
Was wondering why my automation didn’t trigger

nfl

What version of the card are you running? I thought I fixed that in v0.3.5.

But it does seem to be an issue with the Bears score. However, CSS opacity would have no effect on whether or not automations trigger.

update to v0.3.6 and the score opacity should be fixed. :crossed_fingers:
image

However, that only fixes the card itself. It won’t affect automations triggering.
edit: v0.3.7 is the “correct” way to fix this issue.

I was on 0.3.5 but now am updated to 0.3.7

alias: NFL - Input Boolean Control - Turn On/Off Win Input Boolean
description: Turns on input boolean for five minutes when team wins
trigger:
  - platform: state
    entity_id: sensor.nfl
    from: IN
    to: POST
condition:
  - condition: template
    value_template: >-
      {{ state_attr('sensor.nfl', 'team_score') > state_attr('sensor.nfl',
      'opponent_score') }}
action:
  - service: input_boolean.turn_on
    data: {}
    entity_id: input_boolean.nfl_win_detector
  - delay: '00:05:00'
  - service: input_boolean.turn_off
    data: {}
    entity_id: input_boolean.nfl_win_detector
mode: single

Do you see anything wrong with this? I cant figure it out. I have used developer tools to change game to IN and then to POST. Sometimes it will trigger and sometimes it wont. I’m also changing the Bears score

edit: I’m finding that I need to set it to IN and then change the score to something higher than I just tested while changing to post in order for it to fire.
Why wont it fire on any team score over the opp score?

So, the issue with the card might be the same issue you’re running into. We see numbers, but they’re technically strings, not integers. Try this and then change the state from IN to POST in dev tools to see if it works

{{ state_attr('sensor.nfl', 'team_score') | int > state_attr('sensor.nfl', 'opponent_score') | int }}

I just tested it out with the bears and it seemed to work for me.

It worked but when I turn off the boolean and try again nothing. Shouldn’t it fire each time it is changed to post and bears score is greater than opp?

The automation could still be on the delay step of the action. You could change the mode to parallel for testing, but it wouldn’t make much of a difference in a real-life scenario.

Just thought of that myself - realized that was it. Thanks for the help

no problem. thanks for reporting the issue with the card.

@zacs looks like we now have playoff data to work with. Everything pre-game seems to work fine. However, it doesn’t appear that bye teams are included in the json, but that really only affects two teams. Also, the NOT_FOUND state doesn’t appear to be working. Instead, the sensor is in an unavailable state.

Thanks for the heads up. There was some logic that assumed bye week properties would be present. This is now fixed in v0.3!

Yeah really surprising the bye teams aren’t listed. Can’t really think of any way to change that though…

edit: upgrade works for NOT_FOUND state

The good thing is, assuming they do get included, the component will just work automatically. At least unless they decide to change the name of the bye properties, which they might do.

I’m sure the Titans and Packers will be there next week, but I’m pretty doubtful they add the 1 seeds to the wildcard week json. Notice how they list bye teams on the bottom (week 14) but not for the playoffs: NFL Football Scores - NFL Scoreboard - ESPN

1 Like

So long, see you next year… Thanks for sharing and all the hard work you put into the component and Lovelace card!!

3 Likes