Sports Scoreboard (American Football for now)

tiles

#1

Summary:
Below is a set of pistons designed to create a tile based weekly scoreboard in WebCore. By design, the tiles are intended to change dynamically based on game status. This set of pistons can be used for either NFL of NCAAF games. Since NCAAF has significantly more games than the NFL, NCAAF scoreboard is limited to one conference. The data is pulled from a relatively undocumented but public facing version of ESPNs API that does not require registration or a key.

Note: Some data points below are assumed based on current documentation relative to the current API that does require registration. As more data becomes available and we see how/when the API updates, the pistons may need to be updated in future.

Aesthetics:
Due to the way WebCore arranges tiles, I decided to add a blank tile to give a visual break between games. Additionally, to maximize data usage and add some traditional scoreboard effects (e.g. color change with score change), each team is designated its own tile. Final design resulted in three tiles per game with the last being blank (until the game is final, see below).

Tiles below are examples of what you will see as data is updated. Note: data is not real time and is only true at the moment of the last API call which should update every 5 minutes as long as there is a game in progress. The last block in Piston A controls this frequency. Decreasing the wait time will increase frequency of updates but there is a risk of overloading the API. I do not know if there is a call limit.

Initially, while games are in pregame status. You will see this:


As data is updated with exact game time and/or TV broadcast information, the data will adjust:
pre-broad-date
Once games are live, the view will change to this:
in
Including a visual alert if score changes:
in-score-change
Post game changes once again, graying out the losing tile and displaying the winning teams logo in the previously blank tile.
final

Logic:
The data is pulled from the API once a week (currently set to Tuesday to get current week’s schedule) and at the next game time which the piston calculates. The piston can be manually executed/tested at any time to update data. Due to the large amount of data and processing, the initial piston was split. Piston A is only for data gathering/processing (19 chunks). Piston A executes and sends the formatted data attached as arguments to Piston B. Piston B is only executed by executing Piston A. Piston A is also designed to repeat execution every 5 minutes if any game is currently live.

Implementation:
It is recommended that you create Piston B first. WebCore limits each piston to 16 tiles and we are using 3 tiles per game. Due to this limitation, we will have multiple copies of Piston B, with each iteration drawing 15 tiles covering 5 games. In order to complete a full slate of games, 4 iterations of Piston B will be required. As you create each copy of the piston, you will need to update the sequence number variable and name them accordingly. To maintain order I have named my NCAAF setup: 1 - NCAAF Tiles (sequence #1), 2 - NCAAF Tiles (sequence #2), etc. Do not update any other variables in Piston B as those variables are populated from Piston A.

After setup of all four Piston Bs, Piston A can be created. WebCore will most likely ask you for URL which can be ignored as it is set by variables. Within Piston A you will need to link each Piston B to Piston A (hence the reason we created Piston B first) see lines 101-104 in the snapshot. Additionally, you will need to link Piston A back to itself on line 110. This creates the repeating every 5 minute update when games are live.

You can update any of the first 5 variables in Piston A. 1) NFL vs NCAAF: set NFL boolean to true for NFL, false = NCAAF. 2) If using for NCAAF, update the espnGroup to the respective conference #. The other three variables are related to color of the tiles. Background colors will be automatically assigned based on team colors. 3) It is recommended to leave the Tile Text as white. 4/5) score alert combination: gold/black looks great personally but any contrasting combination will work.

Piston A

Piston B

Edit: Piston A was updated to correct the date time calculation formula, thanks @SergL for pointing out the issue. Not sure if I mentioned before, but all calculated dates should be relative to your local time. The formula will also inherently adjust for day light savings.

Additionally, I updated a check to see if the time if scheduled time is real or the arbitrary 0400 UTC. Real times will display, 0400 UTC will be hidden. My initial piston was checking for my 12:00am local time which obviously doesn’t work for everyone.

Thoughts/Questions?


#2

This sounds very similar to the custom app for NHL scores and notifications


#3

I did see that but if I recall was limited only to NHL. Eventually, I want to put a generic piston together where you could select any team and retrieve their schedule, scoreboard for current game, with notifications. Do you use the smartApp? Is there much of a delay in notifications? I see that it is designed to increase polling frequency pending on status, every 5 seconds when live, wow! Wondering if it ever hits a call limit.


#4

I do use the smart app, and I had changed the refresh when game is occurring to limit the delay since it triggers sirens and music. I was trying to figure out how to build a scoreboard or ticker using this service but never had the time.


#5

Out of curiosity, what data points would you be interested in seeing? What notifications? For any sport that interests you. Obviously each sport will have unique items, per API availability, the trick will be how to squeeze into a tile.

Tile Data:
Football: score, qtr, time clock, down, distance, and possession are what I chose.
Basketball: score, half, time remaining, possession, team fouls, last shot (player/make/miss)
Baseball: score, inning (top/bottom), outs, runners on base, pitcher vs batter, balls/strikes
Hockey: score, period, time remaining, possession, power play, last shot (player/make/miss)

Notificaitons:
Score Alerts: lights, sound
End of period?


#6

You have highlighted more data than I would have even used.


#7

pretty cool, imported and see how it goes once it all starts back up, thanks!


#8

For “nextGame” variable, are you seeing “Invalid Date”


#9

I would expect it to be invalid until after the first run…you can test to execute the full piston

Interesting note, if game time has not been released, ESPN assigns 4am UTC.


#10

I have not used Tiles yet in web core, where would the tiles be visible? Also would we be able to expose the tiles in ActionTiles?


#11

Tile view is found under settings–>catergories
For each category, there is a dropbown (default is Details, which is the single line usually displaying piston title and state)…I’d recommend Medium Tiles for these

Edit: Might be best to put all these pistons into there own category, leaving everything else as Details

Well said


#12

ActionTiles excels at displaying the status of devices…
but is not so good at displaying other data…

On the other hand, webCoRE’s Dashboard excels at displaying nearly any information.
(but may take 10 seconds to update the display for device changes)


#13

Next game variable in Piston A seems to be populating correctly. 9/10/2020 8:20PM.

The piston B tiles are not showing games times on the bottom though, not sure if that needs more time to become accurate


#14

It should be displaying correctly. I think I found the error. Line 62 that calculates datetime uses a global variable @timeoffset. I intended to replace it with the formula before posting. I will post a new screenshit tomorrow with the update.

So you dont have to go through the import again the replacement formula is (($localnow - $utc)/1000) . Corrects for timezone.


#15

$localnow errors out for me

edit; fixed it, the correct syntax is “$localNow”


#16

Now it appears to have properly populated the first B piston, but not the subsequent ones


#17

Yes you are correct, typing on my tablet late at night, bad idea.

It doesn’t appear that all of your subsequent pistons executed or are still in process of drawing new tiles? The clue is that they are still gold, usually indicating a score change. When you first run the piston the score goes from blank to 0 so it thinks there was a change. Your subsequent B pistons have not run a second time.

Did you receive any error when executing Piston A?


#18

Pretty sure I did not but I will run it again to verify


#19

The only other issues I could see
Piston Bs got paused somehow?
Piston A is no longer pointing to each Piston B
Piston A isn’t sending all the desired arguments
*I know the last two are very unlikely as you woul dnot have gotten the tiles initially but just brainstorming here, hopefully that section still looks like this:


#20

Just ran it again and it populated the rest of the tiles. Maybe I was too itchy on the trigger the first time to reset the time interval? Not sure. Eitherway, looks good now!