This detects an NHL hockey intermission using the Team Tracker/ESPN components. The example starts a Timer which can be used to expose time until the next period starts. Besides just showing time until the period starts, when the timer expires automations can be triggered.

Tip
I've found setting the timer between the 1st to 3rd period to 17:30
- 17 minutes and 30 seconds - works pretty well with the inherent delay in the original API, the inherent refresh delay of Home Assistant and the latency with my television channel. You may need to tune this to your use case.
Detecting intermission start is done by using the clock
field, which says End of 1st
for 1st intermission, End of 2nd
for 2nd intermission and when the score is tied and End of 3rd
it can start an intermission timer.
Years ago I'd built an Arduino box for a local bar to get the audio back when the intermissions were done by sending IR codes to the amp. The box would have to listen for a signal from a human using a special purpose IR remote to start the intermission. During intermission the audio would switch to music and the bar staff would get too busy to switch it back to the game, the box ensured the music switched back to game audio on time, or close enough. There was even a 90s button for commercials. None of this would be necessary with this automation, but it wasn't reliably avialable at the time.
With this we could switch to music or mute the non-game audio. We could also use the timer to resume the audio but I might use the clock advancing as an alternative unmute - maybe both?
- install HACS and restart
- install the team tracker integration from HACS
- (optionally) install the team tracker card from HACS
- and then restart
Note the team ID can be found by nagivating to the ESPN site and visiting your team's stats, e.g. The Oilers are edm
which is taken from after name
in their team URL: https://www.espn.com/nhl/team/_/name/edm/edmonton-oilers
You'll create three automations, one for each (regular season) intermission.
Note
Post-season multiple overtimes is not yet supported. Support would be trivial but we'd need the correct trigger string.
- configure the team you're interested in tracking
- I recommend re/naming it appropriately for the team to keep multiple teams distinct
- create a timer for the team intermissions
- I recommend naming the timer appropriately as well
- go to automations and create a new automation
- change to YAML mode and paste the relevant code below
- you can switch back to the visual editor after
Repeat configuring automations for the 2nd and overtime intermissions.
- multiple overtime support for the post-season
- using templates to reduce the automation to a single, more complex template
- or not
- ha-teamtracker/Automation-Examples for
- team tracker goal lights and
- syncing win probability with lights
If you use an Awtrix display I've also forked and then integrated this into the https://github.com/jlongman/Homeassistant_blueprints/blob/main/Awtrix%20NFL%20Team%20Scoreboard/awtrix_nfl_team_scoreboard.yaml - I should rename that to "sports team scoreboard.". You still need to create the timer separately.
I've also got code to create an Awtrix app which shows an intermission timer but from what I understand of blueprints, you need 2 separate blueprints, a separate automation (or blueprint if it makes sense to package that way) and the separate timer from above to get it going...