NFL game sensor (scores, possession, etc)

Can you post this code!

I’m getting UNAVAILABLE on the integration since doing the HACS update.

Yah, hit an issue where the odds field went away and broke things. It’s already fixed – just re-pull from the repo!

edit: Live debugging is fun, just fixed another issue with down distance only being present half the time.

I did a git pull, waiting for HA to reboot.

Yah wish it didn’t need to reboot. My test sensors have all been up for a bit now and issues are resolved (for now…).

@zacs It’s up and running. All good here.

It’s just static html right now. I’m working on turning it into a custom card for @zacs custom component.

edit: pretty happy with the layout, but I’m open to any suggestions
in game
image

pregame
image

I guess I’ll have to make a post-game layout as well.

1 Like

The win probability kept regenerating over and over and over. I need to figure that out. Man it looked pretty though.

you could remove animate: true from the probability card. I’m guessing it has something to do with the component refresh. It might still flash quick, but it won’t do the slow redraw of the graph.

I still seem to be getting some errors with downDistanceText which happens anytime a team scores. Using build ab614e6, tried reinstalling, restarting but still seems to be an issue.
Error fetching NFL data: 'downDistanceText'

Yep, that and possession both disappear in between possessions. I got a ton of errors as well, but once the game got going again it was all good. I know how to fix, but sadly haven’t been able to yet today. Should get to it tonight. Currently mourning my poor Seahawks defense.

1 Like

Yah, the component I based mine off resets all values to null in between refreshes. I’m going to experiment with not doing that while the MNF game goes tomorrow. Hoping to have all this buttoned up tomorrow so we are good for a bug-free next Sunday :).

Phew, what a nail biter. In other news, I got the static html/css into a card, and reworked the probability as I forgot to account for the tie percentage. Now I need to figure out how to define entities/attributes and if/else conditions.
image

4 Likes

That looks really nice

1 Like

This is awesome, Im kinda lost with all the information in this thread on where to begin. Could somebody condense all the changes with all the sensors needed to get this to work? Thanks again to everybody for the work you have put into this!

If anyone is feeling brave, I have the card on github now. https://github.com/D34DC3N73R/ha-nfl-card

I haven’t been able to test it out in game yet, but it seems to be working so far. It switched from POST to PRE, so I think all the other stuff should work. (famous last words I know)

A couple notes:

  • There is no card editor, so just use a custom yaml card with whatever your sensor is named from @zacs custom integration.
  • I don’t have alt colors integrated yet. I might set that up as a configuration variable, not sure yet.
  • I didn’t set up any responsive text/logo sizes, or test all the team names, so it might not look right in some cases where the card size is small.
  • There are no click actions, it’s display only at this time.
  • I really have no idea what I’m doing in javascript. I’m surprised this works at all lol.

Anyways, I’d love to hear any feedback. I’ll be out of town with work for the next two weeks, so I may be slow to respond or fix things if it doesn’t work right.

This is what the pregame card looks like on a default HA install.

1 Like

The easiest route, especially if you have HACS installed, is to add zacs ha-nfl integration as a custom repo, and install the integration. That’s going to give you a sensor with all the game info on it. From there, you can use the template sensors and lovelace entity card info from this post, or give my untested card a try. Install and config instructions on the github readme.

2 Likes

Yah I’d also love to get some of the automations folks have already built into the packages/ folder in my repo, just to show what is available. I’d probably need to tweak them since they’d now be looking at attrs and not actual sensors. Still working on getting a smart update in place. Hopefully the next day or two!

I’ll probably go back and edit my root post with pointers to the customer component, @D34DC3N73R 's card, and some of the posts with automations for now.

Thank you very much, just what I needed!

Trying to test out your custom repo, but every time HA restarts the ‘sensor.nfl’ goes away and is replaced by ‘sensor.nfl_2’, ‘sensor.nfl_3’ and so on. Just me?