Home Automation / v1.1.1 · Deployed

NHL Watcher

A Raspberry Pi that makes the room react to every Senators game

Video placeholder Clip — the room lighting up red, white and gold for an Ottawa goal

TL;DR

NHL Watcher is an always-on hockey appliance. It finds the next Senators game on its own, follows the live NHL feed, works out what actually happened (a goal for, a goal against, overtime, a shootout, a win or a loss) and gives each moment its own sound and light show. It runs as a background service on a Raspberry Pi, and nobody has to touch it.

The Short Interview

QWhat does it actually do?
A

It watches NHL data for one team, normally the Ottawa Senators, and turns meaningful game events into sound and smart lighting in my room. The point is to know what just happened in the game without staring at it.

QIsn't that just a score ticker?
A

No. A ticker reacts whenever the data changes. NHL Watcher tries to communicate meaning: an Ottawa goal is a celebration, a goal against is bad news, overtime is tension, and a shootout loss is its own kind of defeat. A repeated poll, a metadata change or a shootout attempt isn't a reason to make noise.

QWhat happens when Ottawa scores?
A

The room celebrates in red, white and gold: bright, fast flashes with a celebration sound, deliberately longer than the effects for anything else. When the other team scores, the room switches to that team's own colours in a shorter, more subdued effect. Every opponent looks different, so each game is unique and you can tell what happened from across the room.

QHow much babysitting does it need?
A

None. It runs as a systemd service, finds the next game itself, wakes up for the pregame warning, follows the game live, processes the final and goes looking for the next matchup. It survives restarts and reboots without anyone opening a terminal.

Every Event Means Something

The watcher classifies events by both circumstance and result. Each one has its own cue.

pregame_warning
Game soon. A subtle reminder 10–15 minutes before puck drop.
game_start
The feed confirms the game has actually started.
goal_for
Celebration: energetic Ottawa palette.
goal_against
Bad news: shorter and restrained, in the opposing team's colours.
overtime_start
Extra-time tension, with a cue of its own.
shootout_start
A special finish. Individual attempts stay silent.
regulation_win/loss
An extended victory, or a distinct, subdued loss.
overtime_win/loss
The definitive end of overtime.
shootout_win/loss
Kept separate from OT results and regular scoring.

Lighting With Intent

Celebrations

  • Red, white and gold only. No generic rainbow.
  • Faster, more animated flashes.
  • Goals for and wins run about twice as long as the first versions did.

Bad news

  • Goals against light up in the opposing team's palette, so every opponent looks different.
  • Subdued, and shorter than any positive effect.

Transitions

  • Overtime and shootout starts each get a distinct look.
  • They can never share the same white or yellow effect.

In the Room

Video placeholder Clip — goal against in the opponent's colours
Photo placeholder Photo — the Raspberry Pi appliance

Architecture

Observe the game promptly, work out what changed, decide whether a new event exists, then deliver the presentation safely.

NHL Data

Schedule

Next game, start time in UTC

Gamecenter

Live score and game phase

Play-by-play

Supporting context, replay

Watcher

Scheduler & polling

Dormant → pregame → live

Delta detection

Score changes across snapshots

Classification

Idempotent, scoped per game

Presentation queue

Optional broadcast delay

Effect arbiter

Priority and preemption

Room

Audio

Per-event cues

Govee lighting

Cloud + LAN, with restore

A Game, Unattended

  1. Dormant

    When the next game is far away, the watcher sleeps efficiently and refreshes the schedule at least every six hours, using absolute UTC times rather than the Pi's local clock.

  2. Pregame

    It wakes for the warning window, checks for schedule changes and plays a subtle reminder.

  3. Live

    It polls at a responsive cadence, compares snapshots and classifies new events.

  4. Final

    It decides between regulation, overtime and shootout and whether Ottawa won, plays the result, resets per-game state and finds the next game.

“Do not delay game state ingestion to delay the alert. The delay is a presentation policy, not a polling pause.”

The Spoiler Delay (v1.1.1)

The NHL API often runs ahead of the TV or internet broadcast, so an instant alert can spoil a goal before you see it. v1.1.1 adds a configurable delay between recognizing an event and playing its effect.

Default
About 19 seconds, adjustable from the command line.
Per game
Tune the current game's delay to match the stream you're watching. It resets when the game ends.
Locked in
Queued events keep the delay they were scheduled with, so changing the setting never moves alerts that are already queued.
Exceptions
The pregame warning skips the delay and plays immediately.
Corrections
A reversed goal can cancel its alert while that alert is still waiting in the queue.
Non-blocking
Polling, finals processing and next-game discovery carry on immediately. Only the presentation waits.

Problems & Solutions

  1. 01

    A goal isn't always a play-by-play item

    ProblemDifferent parts of the live feed update at different times, so waiting on play-by-play made goal alerts slow and unreliable.

    FixLive goals are detected from score changes between snapshots, with play-by-play as supporting context. Processed scorelines are persisted, so repeated polls and restarts don't announce the same goal twice.

  2. 02

    Shootout goals aren't goals

    ProblemShootout attempts show up in the data looking like scoring events, so they could trigger ordinary goal celebrations.

    FixIndividual attempts are silent. The shootout gets its own start cue and its own final win or loss effect.

  3. 03

    Celebrating overtime twice

    ProblemAn overtime winner could play a full goal celebration and then immediately a second full win cue.

    FixOvertime endings now emphasize the terminal win or loss cue, and duplicate terminal notifications are suppressed.

  4. 04

    Lights that didn't come back

    ProblemA Govee API acknowledgement doesn't guarantee the light actually changed or recovered. Restoring raw on/brightness/colour values also can't recreate a dynamic preset scene like the light bars' everyday "Universe" scene.

    FixEach device has a restore target, and restoration is staggered with retries instead of firing every request at once.

    LessonAn API "OK" isn't proof of a visual effect. Raw values and animated scenes aren't interchangeable.

  5. 05

    A Pi that couldn't run modern Node

    ProblemThe Pi shipped with Node v10, which was too old. Upgrading ran into dead legacy Raspbian Buster repositories, NodeSource mismatches and a missing GLIBCXX symbol, and I didn't want to reimage the device.

    FixA Node 18-compatible arrangement that works on the existing Buster/ARM install.

    LessonWorking on a desktop isn't the same as working on the deployment host. Native binaries, linked libraries and audio devices all have to be checked on the real hardware.

  6. 06

    Ctrl+C that didn't quit

    ProblemEarly builds printed the SIGINT message but never returned the shell prompt. Timers, sockets or child processes were keeping the event loop alive.

    FixAn idempotent shutdown path for both SIGINT and SIGTERM stops new work, cancels timers, ends sounds and light effects safely, closes handles and child processes, and leaves the lights in a sensible state. That made the move to systemd possible.

Testing Without Waiting for a Game

Real games are intermittent and impossible to reproduce on demand, so the watcher can replay history.

Replay
Feed any past game through the full pipeline, with any team override and adjustable pacing, and watch the sounds and lights fire in order.
Once mode
Run a single poll-and-classify pass on demand.
Test suite
Classification for regulation, OT and shootout, effect mapping, RGB conversion and Ottawa-palette enforcement. It has grown to 72/72 passing in v1.1.1.

Version History

  1. v0.1.0

    Done

    Goal-detection proof of concept, with once and historical replay modes.

  2. v0.2.0

    Done

    Regulation, overtime and shootout classification, plus the expanded event vocabulary.

  3. v0.3.x

    Done

    Govee integration with tests for effects, colour conversion and the Ottawa palette. A scene-discovery tool for the light bars.

  4. v0.6.2

    Done

    Live baseline. A real-game field test on October 6, 2026 validated score deltas, event effects and preemption. v0.6.3 was discarded and its diagnostics moved to a standalone script to keep the baseline clean.

  5. v0.9.6

    Done

    Per-device restore targets, staggered restoration and retries.

  6. v1.0.0

    Done

    Unattended systemd service with start/restart validation and an event harness (69 tests). Deployed October 17, 2026.

  7. v1.1.1

    Done

    The per-game spoiler delay, non-blocking polling and a safe service reinstall that never touches config, audio or saved state. 72/72 tests. Deployed October 18, 2026, and the current release.

Where It Stands

v1.1.1 is deployed and is the current release. No new features are in development.

Confirmed

  • Live goals, effects and preemption (field test)
  • Unattended systemd operation
  • Per-game spoiler delay, active and adjustable
  • 72/72 automated tests

Yet to be seen live

  • A late score correction cancelling a queued alert
  • Animated-scene restoration

Not Part of MBC

NHL Watcher shares a room, and some of the same Govee lights, with my Midnight Broadcast Corporation streaming platform, but it's a separate application. It watches NHL APIs instead of Twitch, runs on a Pi instead of the streaming PC, and has its own game lifecycle, event classifier, tests and service operations.

Both can drive the same lights, but nothing is shared between them. If they ever need to act at the same time, that coordination will be designed on purpose.