vasqued2 / ha-teamtracker

Home Assistant integration that provides real-time scores in multiple professional (NBA, NFL, NHL, MLB, MLS, and more), college (NCAA), and international (soccer, golf, tennis, mma, racing) sports using ESPN APIs.
172 stars 20 forks source link

Kickoff Time an hour ahead #149

Closed tempus2016 closed 4 months ago

tempus2016 commented 5 months ago

I set up automations for football notifications but they always send 2 hours before the game, not 1 hour like I set. The game kicks off at 8pm UK time but shows kickoff in an hour. Any help would be great.

IMG_4442 IMG_4443 IMG_4444 IMG_4445 IMG_4446

vasqued2 commented 4 months ago

I use an external function to "humanize" the time so it is an approximation, not exact. Rather than checking for the exact value "in an hour" you should probably use a template to trigger when kickoff_time changes to contain the word "minutes". Or you could use the date attribute and compare it to the current time. If you do that, you'd have to localize it.

vasqued2 commented 4 months ago

It looks like the easiest way to get it to work they way you want is trigger it when it changes FROM "in an hour" to the minute countdown. This will happen sometime between 50-60 minutes before kickoff, which sounds like closest to what you want. See the thread below for more details on how everything works and there is YAML in the last post with an example.

https://github.com/vasqued2/ha-teamtracker/issues/93