[BETA] GameTime - Pro & College Sports Schedules Integration

GameTime
Follow, and automate based on, the schedules of your favorite professional and college sports teams.

  • Display customizable dashboard tile(s) showing the next gametime for your favorite team(s). For example, I display this on the dashboard mounted next to our most-used door. Display one dashboard tile per team, or display a single tile that displays whatever game is next from among your favorite teams.
    image
  • Automate based on whether it's a game day. Switch turns "on" on game day. Off otherwise. Configurable per team or collectively across all your favorite teams. For example, use in conjunction with Dynamic Image Switcher to change your dashboard background to your favorite team's logo when it's a gameday.
  • Automate based on whether it's a scheduled game time. For example, set lighting specific to your favorite sports team when that team's game is scheduled to start. Or, turn on the TV when the game is scheduled to start.
  • Automate based on if/when your favorite team is playing its rival opponent. For example, set up rule machine to send you a push notification about the big game.

Example Team-Specific Device State
image

Supported Leagues

  • NFL
  • NBA
  • MLB
  • NHL
  • NCAA Men's Basketball
  • NCAA Men's Football

Requirements
Requires FREE API key per league obtainable from www.sportsdata.io. FREE API key allows 1000 API calls per month. Note this is termed a Free “Trial” but never expires.

Hubitat Package Manager (HPM) Install Instructions

  1. Find GameTime in HPM under the tag Dashboards
  2. Install GameTime
  3. Add GameTime as an app

Manual Install Instructions

  1. Install parent and child drivers
  2. Install Gametime App as well as the Gametime Pro Instance child app and the Gametime College Instance child app
  3. Add Gametime as an app

Post-Install Instructions

  1. Within the Gametime app, add one child app instance per team. When you select your team and click “Done” in the child app, a child device is created for that team.
  2. On the Devices page of Hubitat, devices for your teams are listed under the Gametime parent device. The GameTime parent device will display the tile for whatever game is next from among all of your selected teams, whereas the GameTime child devices are team-specific devices that will show only the tile for the associated team.

Non-Live This integration is intended to operate based on team schedules, so that you don't miss an opportunity to watch your favorite team and/or so that you can automatically set lighting scenes based on scheduled gametimes. The integration does not pull in live, up-to-date game stats (go watch the game on the TV, not your dashboard!). The integration does show the "current" time remaining in a game in progress, but it's delayed by 10 minutes in the free API. Although there is a paid API from sportsdata.io for live stats, it's not cost effective for individual use.

Potential Future Integration
There's potential for future expansion to Women's College Basketball, Soccer, Golf, Nascar, and more, if there's enough interest in the community.

BETA This integration is ripe for beta testing at this stage. Please take it for a spin and report any issues.
Known issues:

  • parent tile and in-progress games are not always updating properly

Enjoy!

5 Likes

Cool. Not something I would use myself but one of the more unique automation ideas I have seen. :+1:

Go Rangers!!!

2 Likes

I’m excited about this, and I’ll start playing around with it this weekend. I was looking into www.sportsdata.io, but I have a few questions that I had trouble answering on my own:

  • Am I correct that you have to sign up for a separate API key for each league?
  • Is it possible to get the win/loss status of the most recent game? I saw that some information was obscured in the free trial, but I couldn’t find detailed examples of the response for each API call.
1 Like

Yes that’s right. I think you can request a developers API key that can be used for all APIs but it’s easy enough to get keys per league.

What do you mean exactly? The win-loss record of your team? Or whether your team just won or lost the last game? I already get the former and you can choose to show it on the tile. As for the latter, I will have to look but at the very least it would be derivable from the record. Would you want that info just on the tile or have a separate attribute for it in the team device?

This, and with a separate attribute. My dream is to have a color-changing bulb (or an Inovelli Red Series switch) that signals the status of the game, e.g. blue when in progress, then changes to green if they won or red if they lost. I don’t get to watch many games, but I still like to keep tabs on how it went.

Working great so far!

1 Like

One thing I noticed tonight is that I will have to think about how to better handle updates during a game in progress. That's one issue with this beta version that might not be quite right yet and will need some real-world testing to see how timely the sportsdata.io data actually is during a game.

What’s the difference between the parent and child devices that get created?

The GameTime parent device will display the tile for whatever game is next from among all of your selected teams, whereas the GameTime child devices are team-specific devices that will show only the tile for the associated team. So you'll notice that if/when you create child devices for multiple teams. In my case, for example, I like to just display the parent device on my dashboard. It takes up a single "spot" on my dashboard and dynamically adapts to all of my favorite teams. I have also made it to where the tile disappears if there's no game scheduled so as not to muck up your dashboard if nothing is scheduled.

1 Like

Awesome, that’s a great idea. Thanks!

One thing I could use some feedback on is how the app should handle the following game statuses that sportsdata.io can report:

Final - once a game is over, should the tile switch to showing the next scheduled game, or keep the now-over game displayed to show it is over? If the latter, for how long should the tile show a game that is finished? Keep in mind it's not possible with this API to show the final score, so all that would be shown is the fact that the game is over. I will have to see how quickly the API updates the team record, though. If the record is updated right away, I could deduce the winner and show that at least.

Suspended, Delayed, Postponed, Canceled - same sort of questions for these statuses.

My initial idea is that the team-specific tiles should indeed show these statuses, say for an hour after the game ends or perhaps even the rest of the day, since no team (that I know of) has multiple games per day. Thoughts?

Not sure if it helps, but the MLB app shows the result of the previous game until 9AM the following morning. For NFL and college football, the ESPN app shows the previous game through Tuesday and then switches to the next game on Wednesday. I don’t follow the other sports closely enough to know how they’re handled, so hopefully someone else can comment on them.

MLB has doubleheaders :slightly_smiling_face:

The parent app will be the trickiest one here when multiple teams are playing on the same day. When no games are in progress, the ESPN app switches back to the first game from any team that day. I can’t stand that behavior, as the game I’ve been tracking disappears as soon as the game ends, leaving me hanging whenever it’s a close game…

Yup that helps. I will explore doing the same.

I’m impressed with how much data is available in the sportsdata.io API. I haven’t explored the output yet, but I’ve been going through the dictionary. I don’t see a direct way to get the winning/losing team of the game with the free API, but it does look like you can get the WinningPitcherID for MLB games and then look up which team they play for. For NFL, it looks like you can get the score by quarter/overtime and add them up by team.
...This may be more trouble than it’s worth. I think your idea to use the team record will probably be the most straightforward.

Ok sounds good. I should have some time in the next week or so to add this feature.

Btw, the latest update addresses an issue with the parent device not updating properly. Should be fixed now.

I vote to add soccer as well.

Thank you, Looks good

I don't see a SportsDataIO API key for WNBA? I tried the NBA one in hopes but it just causes an unknown error.

P

Hmm. That is strange. The API is documented but there's no way to subscribe. Might need to contact them and ask about it.

I contacted them and they set up an account with WNBA. I went to enter in the new key setting up WNBA and got an error "Error: Resource Not Found" and here are the logs.

app:17072021-05-05 08:45:32.281 pm errororg.codehaus.groovy.runtime.InvokerInvocationException: groovyx.net.http.HttpResponseException: Resource Not Found (mainPage)

app:17072021-05-05 08:45:31.893 pm debugApi Call: [uri:https://fly.sportsdata.io/, path:v3/wnba/scores/json/Standings/2021OFF, contentType:application/json, query:[key:21f1316f45fc4062aef9d77dd53369fc], timeout:300]

app:17072021-05-05 08:45:31.798 pm debugApi Call: [uri:https://fly.sportsdata.io/, path:v3/wnba/scores/json/teams, contentType:application/json, query:[key:21f1316f45fc4062aef9d77dd53369fc], timeout:300]

app:17072021-05-05 08:45:31.630 pm debugApi Call: [uri:https://fly.sportsdata.io/, path:v3/wnba/scores/json/CurrentSeason, contentType:application/json, query:[key:21f1316f45fc4062aef9d77dd53369fc], timeout:300]