[Support WITHDRAWN] GCal-Search: Google Calendar Event contact sensor/switch

Hub is America/Los Angeles. Calendars are Cupertino. I’m near Sacramento, so Pacific.

How would I go about checking to see if there’s a time zone force change?

First make sure the location of the SmartThings hub is accurate. You can do that in the mobile app or in the IDE. Second, log onto Gcal in your browser and click settings. You should be able to see where the time zone setting is.

Yes, I’ve done this, they are all correct. I thought perhaps there was something else to look at…

The only thing you can do is move to that time zone.

1 Like

I guess I’m not understanding what you’re saying. I do live in the time zone that all three of the involved apps use.

So, really, no one knows why the times are all screwed up in this app when selecting ALL DAY or why it adds an extra day beyond what the calendar says? @mnestor

Unfortunately, this is kind of make or break for me. Any help would be appreciated.

I have an idea but I’m traveling and haven’t had the time to look yet. Time zones are a pita with what they give us so it’s kind of hackish. I can’t really get to this until Friday. I’m sorry for the delay.

If someone wants to look I think I’m not doing the timezone conversion for all day events correctly. I can at least accept a pull request from my phone if someone works it out before Friday though.

I appreciate it!

I understand the Gcal search creates a contact sensor, then records it as open or closed, which shows as a switch being on or off (correct?). That being the case, if I create a rule to turn that switch off, while the contact sensor is still open, will the switch stay off or will it revert back to on until the contact sensor closes?

It will stay open until the event on your calendar is over. So if you turn it off the next time the switch updates from the calendar it will open back up if the event hasn’t finished yet.

I thought as much. Thanks. So much for my work around.

Update the device handler and see if that works for you. It appears that all the work I had to do to adjust for timezones isn’t needed.

I’ll give it a try tomorrow. Thanks!

Ok, I updated the device handler. The good news is, the all-day event is now showing as only 24 hours. The bad news is that it appears to be converting the time to UTC. Unfortunately, 00:00 UTC is 5pm here in California. While this inaccuracy isn’t effecting my specific use case, I can see it being an issue in other cases. Maybe it’s something that can be fixed with an in-app time adjustment? @mnestor

I’m using GCal to search my work days on my calendar, which I list as an all-day event for ease of viewing in the calendar app for me and my wife, and then use the GCal switch to arm my morning alarm clock Rule on work days. With all the platform issues going on, I’m not sure where the problem lies, but the alarm rule has been firing on days that it shouldn’t be, even with other constraints put in place that should be preventing it. I just rebuilt the Rule, since the platform seems to be a little more stable these days, so we’ll see if a combination of the new GCal device handler and the rewritten rule fixes it.


Are you parsing the time with the date? I assume the API returns a start and stop time? I looked at the code really quickly and I think you’re parsing to a date only without the time returned with the date? If i’m way off please disregard, but I think that’s it.

@slagle For all day events you only get the date from the api.

@Rigging65 When I set the date of an attribute it’s using built in date format which stores it in UTC. Could you open the Log tab in your browser and hit refresh on your device and send me the results the device is logging please? If you could put that in a new issue on github I would appreciate it as it’ll make it easier for me to keep track of.

Done, posted the description and a pic of the live log to ‘issues’ for you.

Thanks, I’ll try to get to this in the next few days. Sounds like I should have left the timezone stuff in. sigh either way works for my setup. I really wish this was easier to figure out without breaking everything I have setup with it. :frowning:

I’m not much of a programmer. I receive an error of '401. thats an error the OAuth client was not found. I copied and pasted the the clientId and the clientSecret, but not sure if the right format.

) {
appSetting "clientId=223764872890-ahfp5n3r7sveceoeds92atfv5jdifuk9.apps.googleusercontent.com"
appSetting “clientSecret=mVEs6Br4b7_RX1DDUx8fQ0Pi”
}

any help would be greatly appreciated.