GameTime
Follow, and automate based on, the schedules and game results 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. Configurable to hide or show game result, team name, or team record/rank.
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.
Send notifications to your devices and/or push a button when there's a configurable amount of time left until gametime (or at gametime)
Automate based on whether a game gets canceled, or delayed due to weather.
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.
Automate based on whether your team won or lost the game. For example, change a color bulb or a light switch’s led strip to different colors depending on if they won or lost.
Display tile with your team's upcoming schedule (# games customizable)
Example Team-Specific Device State
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, which I've found is sufficient even for MLB which has a lot of games. Note this is termed a Free “Trial” but never expires.
Install Gametime App as well as the Gametime Pro Instance child app and the Gametime College Instance child app
Enable OAuth for the Gametime Pro Instance child app and the Gametime College Instance child app
Add Gametime as an app
Post-Install Instructions
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.
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 is not primarily geared towards pulling in live, up-to-date game stats (go watch the game on the TV, not your dashboard!). The integration does however show the "current" time remaining in a game in progress, and is configurable to also pull in the score of the game, but sportsdata.io states that information is delayed by 10 minutes in the free API (maybe even a bit more than 10 minutes in practice). 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.
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.
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.
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.
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.
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
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…
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.
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)