NHL API and Home Assistant Integration

Posted 2022-12-04

After adding some Phillips Hue bulbs around the house I wanted to make an automation in Home Assistant that would flash the lights red every time my team scored a goal, just like an actual goal light!

Thankfully the hard work of integrating Home Assistant into the NHL API was done by the great work over at the hass-nhlapi project by JayBlackedOut.

I used HACS and got it installed easily and setting it up was quick and simple.

From there I just had to create a HASS event watcher in node red

node red event node

Then, after realizing that I would get events for the other team's goals as well I added a switch statement to stop that immediately after.

node red switch node

Then all that is left is to hook up whatever stuff you want to happen after a goal!

The only real caveat I think I ran into with this was that, depending on how you watch the game, sometimes your TV stream might be way way behind what's actually happening and you'll see your goal actions happen before the goal actually happens.