[RELEASE] Google Calendar, Task, and Gmail Search and Gmail Notification Device

Yes the Google API can be tricky to setup and I am definitely no expert, just documented the steps that work for me.

Seeing you are in UK and know that @Cobra does some level of IT support, unsure if he or knows someone willing to help locally.

Interesting. I tried to use the ST ported code and got tons of errors and just decided to write my own switch driver. This is a simple on off switch where you can designate which state you prefer for that switch based on calendar entry. No power, contact, presence, etc :grin:

If you already have things working you can reuse the Google API with this app and give it a try and leave your existing devices in place.

Not the 'walk in the park' setup...
It has a few more steps then a 'plug and play' thing :stuck_out_tongue:
But the instructions helped me... A LOT
I'm pretty sure that if I din't screw around in the 'google cloud console' it would worked like a charm.

If I may be so 'rude', the only thing that is missing,
Help for when it's installed. I'm not that good in english as you may read :stuck_out_tongue: (sorry for that).
so,

  1. you pick a 'calendar' that you want

  2. you type in what it has to look for 'string'
    If I typ "ScHooL" but the should be "school" wil it still work or how sensitive is it?

  3. you set time to run
    *so after the time it wil switch back to 'default state?*
    *Is there a way to set a "-" time? example: -30min (meaning 30min before event for like warnings to get ready)*

  4. you pick your 'default state' of the switch.

  5. you can change the search from 'in title' to 'location'

  6. names...
    what's the difference between device- and trigger name?'

  7. the quote...

Set Switch Default Value to the switch value preferred when there is no calendar entry. If a calendar entry is found, the switch will toggle.

It's pretty close to the "Device name*" maybe you could drop it a line so it looks more to go with "Switch Default Value", just saying it to make it look top quality...

  1. are all ppl so a pain in the @§*&! like me? :smiley:
    sorry about this... pls don't come and hunt me down, skin me alive or worse... delete my rules in hubitat...
1 Like

Just to confirm you got it setup and working?

It shouldn’t be case sensitive or it can be changed to not be as the app is looping through the events for a match.

Correct if no match is found it will go back to the state set in preference. If match found it will toggle from that state.

Current version simply runs once a day as that is all I have needed. Hoping others contribute to this as well. But you can easily set a Rule to call the refresh command on your switch to make it run as often as you want.

Device is the name of the switch that gets created. Trigger name is the name of the child app.

Yes I did. The only thing that was hard to do, was fix the mess I made before in that cloud console.
I had to do later steps first etc... totally my fault (i'm pretty sure)

jeppie... a other thing to look for :stuck_out_tongue: most of the times 'once per day' should be enough but for 99% coverage i would need it to 4 times a day or maybe even more.
Maybe I can find it on my own but all input is welcome... :innocent:
Maybe somebody... looks at the entire community... could add a 'option' in the app setup to select how often it should look for...

@ritchierich thanks for the hard work and guide to set things up... you took the time... and it pays (in gratitude)

2 Likes

Hey @ritchierich this is great but I must be doing something wrong.

I have setup OAuth and Used Rule Machine so do a Voice Annoucment when a meeting starts (will be using lights later) but this was a simple way to test the Rule is working.

The Rule Works - Tested that

If I look at the Switch it has the state like so:


But it never switches on at the time the event starts.

If I hit Poll or Refresh the Switch turns on even though the current time (on my hub) is not aligned to the start time on the Meeting.
Ends up like:

Is this a timezone mismatch or something..

Thanks in advance

Actually you are doing nothing wrong, unfortunately current version doesn’t include this feature. In my simple use of this app I use mostly all day events so the switch toggles at the time of query of calendar. Your use case is interesting and something I hadn’t considered. Thinking a schedule within the switch device could take care of things. Give me a few days and I will see what I can do.

When the Event Starts toggle the switch,
When the Event Finishes toggle it off.

Not sure how overlapping events might be handled unless each Calendar Event has its own Handle..that it subscribes to..

I have 3 apps for different types of meetings.. each with their own actions in RM.

Eventually I will have a LED light outside my door so kids know when they can and cannot come in :slight_smile: Red (Busy), Amber (You can come in but I am kinda busy), Green (Come in then)..

PS although I have a Subscribed Calendar (which this is running off) it always shows in the List of Calendars as 'Calendar' and not the name I gave it when I setup the Subscription to the calendar in Google.

This is how I get notifications with Office 365 (which is what my work uses) I subscribe to my Work Calendar Public URL, with Google then use this app to get the events off it.

Look forward to seeing what you can do in the Event Driven Triggers as it were.

2 Likes

@trevalex I just posted an update to GitHub to hopefully address your use case. I will admit that I don't use this app for the particular use case so hopefully my changes will work for you. Only files you need to update are the parent GCal Search app and the GCal Switch driver. The child GCal Search Trigger app remains the same.

4 Likes

THANK YOU! I’ve been trying to do something similar to this for a while now, but I was unable to make much progress. I had been trying to pull my status from Microsoft Teams to check whether I’m busy, but I got fed up with all the security restrictions (both Microsoft’s and my company’s) that I had to deal with to make this work. Your suggestion to use the Office 365 calendar is so much simpler and easier, and it works great! Not quite as accurate as using my Teams status, but it’s close enough.

I’m excited for this as well. I really want to control my Roomba’s behavior based on whether or not I’m in a meeting, e.g. if I’m busy, delay starting or resuming until I’m done, or if currently running, pause right before my next meeting. This change should help me accomplish this goal. Thanks!

2 Likes

@mikee385 @trevalex I just posted v1.2.1 on GitHub to fix a few bugs I found this morning from my update yesterday.

  • Found a parsing error in the log from an edit I made to the parent GCal search app. Dates are always so much fun to deal with in code but this is now fixed.
  • I realized I neglected to schedule an event to toggle the switch if a calendar event is found that is occurring at the time of the poll/refresh.
  • Also cleaned up code within the switch driver

Only files you need to update are the parent GCal Search app and the GCal Switch driver.

1 Like

Very good of you to do so
I will do a test this week and let you know how it goes
Appreciate your contribution here

i'm also testing with the 'new' driver and app...
I work 3 shifts 'Late, Night, Early' and always for 8hours.
I set up the search string 'Late, Night, early' and have 2 switches 'workDon' and 'workDoff'.
Don or Doff is the default state of the switch is on or off :stuck_out_tongue: just testing :stuck_out_tongue:

now i figured it out how much i want to have the app "searching" but i don't know how to edit or change the code for that. every 6hours would be the minimum but best would be every 4hours.

hope somebody could help me with that. Or make it a option that ppl can choose for example '2,4,6,12 or 24' hours between searches...

You can set a periodic trigger in Rule Machine to call Refresh on your switches.

2 Likes

I worked through setting this up this morning, and it worked great. The instructions you have here were very, very helpful.

I did get confused by the names of the calendars in the app. In Google, I see this:

But in the GCal Search app, I saw this:

I initially thought that it wasn't pulling in all of my calendars correctly, but when I started to dig into the logs, I realized that it simply wasn't using the same names that I see in Google. Several of my calendars have a summary attribute and a summaryOverride attribute:
Calendar Attributes

Google displays the summaryOverride value, whereas the GCal Search app seems to display the summary attribute. Would it be possible to use the summaryOverride attribute as the calendar name when available? Not all of my calendars have this attribute, so in those cases, it can fall back to the summary attribute.

1 Like

Awesome great to hear you got it setup!

Sure I can look into this. I basically took the code that gathers the calendar list from the SmartThings port and I haven't ever created an override so I didn't know it existed. I can easily set the override as the primary and fall back to summary if it is not set.

Based on recent requests I am also exploring how to setup periodic querying of the calendar vs once a day.

1 Like

Thank you!!!

That would help me out too, although it's not critical for me. I don't mind setting up a periodic refresh on my own. The time-based switches worked great earlier today, although I noticed that it only triggers for the next upcoming meeting. That makes sense, and I think I can make it work for my use case with a periodic refresh.

Thanks again for all the hard work!

FYI, if anyone is interested, this is the rule I'm using to refresh the switches. These are for my work calendar, so everything starts at either :00, :15, :30, or :45. I set up a Cron schedule to refresh the switches 5 minutes before each of those times, so :55, :10, :25, and :40.

Cron string

2 Likes

what a good idea... I kinda like that :stuck_out_tongue:

My test are doing good and finally (kinda) knows how it works now etc.
Now going to set up "fase 2 enslaving huma..." I mean... get a outlet to turn on and off when needed (appointment) etc
fase 3 would be to trigger a outlet X time before a appointment
example: 1h before event 'atomic bomb launch' start the cooler

*'atomic bomb lauch' = work
*'cooler' = electric heater in bathroom
just wanted to soften the horror of 'work' :stuck_out_tongue:

1 Like