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.
166 stars 20 forks source link

NCAA Time Remaining Updates #28

Closed jplandry908 closed 1 year ago

jplandry908 commented 1 year ago

I watched an NCAA game using 0.5.1 yesterday (I just updated to 0.5.2) and noticed that the time remaining did not update unless there was a significant change (i.e. a team scored, possession change). The play-by-play was updating after each play, and scores changes were reflected immediately, but the remaining time did not regularly update throughout the game. I'll be watching an NFL game later today and can let you know if it is NCAA only or NFL as well.

jplandry908 commented 1 year ago

FYI - The NFL game today appears to be updating. Although, I upgraded to 0.5.2 this morning.

vasqued2 commented 1 year ago

There was no change to the code that would have impacted this in 0.5.2.

The game clock is updated from the same API call as the other information. I watched games from several different sports today and confirmed the card is displaying the info the API is returning. The frequency ESPN updates the in-game info varies based on the info and the sport/league. The NFL API is the most robust/accurate. The timeliness for other sports vary and I expect that is what you ran into.

There is a page on the Wiki which contains a list of known defects/shortcomings w/ the ESPN APIs. If you track the issue down to specific sports/leagues, feel free to update the Wiki page with what you have found.

jplandry908 commented 1 year ago

Hi @vasqued2. Thank you for your feedback. I'll monitor the data being returned directly from the API and update the Wiki page with any findings. Thank you for your hard work supporting this.

vasqued2 commented 1 year ago

I appreciate it. I'll keep this thread open for a bit in case you find anything.

If you're looking at the JSON, you will find the following at both the event and competition level:

[status][clock]
[status][displayClock]
[status][type][detail]
[status][type][shortDetail]

An event can be made up of multiple competitions (i.e. a tennis tournament). For most sports (i.e. a football game or a basketball game), an event consists of a single competition (the game between the two teams) and the clock info at both levels is the same.

For single competition events like football and basketball games, I use [shortDetail] at the event level for the clock.

My initial thought was that the clock info from the event level and the competition level got out of sync - or [shortDetail] was out of sync w/ one of the other values, and that was causing the problem. But I tracked both sources across multiple sports today and they were all always in sync. Obviously I did not have a NCAAF use case so that could be an outlier.

I did see some delays in the clock updates - but not as egregious as it sounds like you saw - and the delays were always at both levels and for all of the values.

Hopefully this will save you some time and get you pointed in the right direction as you look into this further. Thanks for your help.

jplandry908 commented 1 year ago

Hi @vasqued2. Thanks for the additional info. I monitored the ESPN API and TeamTracker today as a test during the Ole Miss NCAAF game. The time is being updated correctly. I assume the time was just not being updated regularly via the API for the game I was watching last weekend. Thanks again!