[RELEASE] GameTime - Pro & College Sports Schedules Integration

I updated and noticed the schedule tile in Hubitat admin page shows this:

image

I figured it had something to do with OAuth as mentioned above.. I wasn't exactly sure how to do this but figured out I could do it in the Apps Drivers section. So, I enabled for all 3 GameTime apps drivers (main, college, pro)

I went back and hit 'Done' for the high-level app and each child app too hoping that would 'refresh' things.

I do see a schedule now for NFL and MLB but NCAAF still shows that "browser doesn't support the object tag".. not sure why that one isn't loading.

Anyway, the other 2 (NFL/MLB) do display. I see the attribute is:

<div style="width:100%;position:relative; z-index:0; text-align: center;"><div style="width: 100%; height: 100%; z-index:1;text-align: center;"><object width=100% data="https://cloud.hubitat.com/api/CLOUD-TOKEN/apps/471/gametime/471?access_token=ACCESS-TOKEN&version=1"> Your browser doesn’t support the object tag. </object></div></div>

It displays but is in an embedded table

I understand the reason behind it -- 1024 character limit probably isn't enough for long schedules.

Not sure either. Will double check on my end.

Can you elaborate on why the 'but'? How does it compare to how well it displayed before? I can code the app to let the user select between the old way (direct html) or the new way (embedded object), but "complicating" configuration like that would only be needed if there's a practical difference between the two.

Sorry, I missed one line when duplicating the code into the college app. v1.4.2 fixes the issue so college works.

It's hard to describe without attaching a video (which I can't apparently). Basically, the schedule here is scrollable - but it only ever shows ~3 rows when there's actually 10 rows listed. So, the scrolling takes place inside of that little window (table) if that makes sense.

I did set the schedule to display 10 games FWIW

image

Update:

It looks like it might be related to that <object> tag which wraps the URL.. If I just load the URL instead I get back to seeing the full schedule

Hmm, still not working for me. I updated the app via HPM, and then Done'd out of both the parent and children apps. I noticed that, just like before the update, the Schedule does show up in the device details page exactly as I would expect. But when I put it on the dashboard tile (attribute/schedule), I get the dreaded "Please select an attribute". Weird. And I'm only using 3 games for the schedule, so it's short, wayyy shorter than the Dolphins example immediately above in the thread.

Is the schedule like the game result in that it needs one game after app is installed before it can behave properly? I only just installed this a couple days ago after Sunday NFL games were over for the weekend. I wouldn't think so, but I'm grasping at straws here....

Did you enable OAuth for the apps? Any errors in the log?

Duh, no. Didn't see any mention in the github readme or the first post, so I just assumed. You know what they say about that :slight_smile:. Should I enable OAuth for the parent or the kids?

Nope.

Sorry about that. I’ll update the instructions.

Kids

That did it. Always those damn kids.

1 Like

Hm. Ok, I see what you mean. I'll look into it.

1 Like

Pretty sure there is an OAuth setting in the HPM manifest file. You might be able to adjust and fix everyone’s installations. At least for those that use HPM.

1 Like

It's fine in my case (Hubtat Dashboard app) as I can just parse out the URL and use that without the container tags (<div><object>...)

FWIW - there's another driver that does something similar - gCalendar. It wraps a URL and I looked at the driver code and found this:

        theCal = "<div style='height:100%;width:100%'><iframe src='${gCal}' style='height:100%;width:100%;border:none'></iframe></div>"

At least with my app the gCalendar tile displays better than it does with that <object> tag.. but, I'm not an HTML expert so just relaying what I've seen

1 Like

Thanks @ritchierich . I updated the HPM manifest. Anyone who updates via HPM (from here on) won't need to enable OAuth manually.

2 Likes

Good find. Re-using that iframe approach seems to work well. It doesn't seem to include a full size table on the device page, but it does seem to display well on native dashboards. So that's what I'll update it to. I'm also trying to fix the varying row height issue....

1 Like

v 1.4.3 - Improved schedule tile display (iframe wrapper and consistent vertical height across rows)

Thanks for the feedback on the schedule tile! Let me know if you see any other issues with it.

1 Like

I was writing some simple RM rules today to notify when a game is about to start or to celebrate (eg, flash bulbs team colors) when there’s a victory.

I can access attributes of team device (like gametime or status) from a trigger, np. But when I try to reference a device attribute from an action, such as set variable, I get an empty list in the attribute drop down box.

Anyone know if this is a function of the device driver, or maybe I’m screwing something up?

A reproducible example: from RM5, try to set a number variable to a team’s current value for gametime (unix time) by selecting device attribute. No way to access gametime.

Stumped.

I wasn't able to reproduce the issue, unfortunately. Seems to work for me. Does it work for you in RM legacy?

Huh, so weird. What's the variable type (or connector type) of your num variable in the example above. Are you using RM4 or RM5? And is your num variable a hub variable or a local variable?

I can see every other attribute when setting variables but not gameTime. I wonder if it's because it's a Unix Time in milliseconds, which takes more than 32 bytes to store. Not sure.

Given that we now have DateTime variable types, would it be straightforward to have gameTime in that format, as well?

Here's a screenshot of mine fwiw. I'll try in RM legacy

EDIT: Sure enough, no problem with RM Legacy. Could this be a bug in RM5, or expected behavior?

It worked for me in both RM4 and RM5. Used local variable - worked no matter the type (tried both string and number).

I don't think it's possible to have a DateTime attribute in a driver.