[UPDATED 3/27/18] GCal Search

GCal Search

UPDATED gCal Event Sensor version 20180327.1 :

  • eventTime now works for all-day events
  • added eventTitle attribute
  • added Power capability (toggles between 0 and 1 on each refresh) - for use with webCoRE bc defined subscriptions to custom attributes of virtual devices don’t work

UPDATED gCal Event Sensor version 20180327.2

  • added startOffset and endOffset attributes;
  • these can be set by new commands setStartoffset() and setEndoffset()
    (Keep in mind that if you modify these attribute, they will always override the offSets in the gCal Trigger parent app!)

There are two smartapps:

  1. Gcal Search (latest version is 20170223.1)
  2. Gcal Search Trigger (latest version is 20170223.1)

and two DTHs:

  1. Gcal Event Sensor (latest version is 20180327.2)
  2. Gcal Presence Sensor (latest version is 20170306.1)

The GCal Search app works by creating Search Trigger sub-apps that in turn create a virtual device with either (i) Gcal Event Sensor: a virtual device with contact and switch capabilities or (ii) Gcal Presence Sensor: a virtual device presence and switch capabilities. This will allow you to select a single calendar per sub-app and also create a search string so that you can have it only look at events that match instead of all events. So you can have a first Trigger app that activates on a calendar event titled “Holiday” on a first calendar and a second Trigger app that activates on a calendar event titled “Son Here” on a second calendar.

I use this in combination with webCoRE and some Routines.

Examples: use to prevent Pistons/Routines from activating if the sensor/switch is open/close, present/not present, or on/off. And since the virtual devices also act as a switch/sensor, you can trigger other Pistons to happen as well. Also used for notifications (SMS, Push, AskAlexa).

Why not just use IFTTT?

  • More customization, more accuracy (IFTTT gives you a 15-minute window), 1 less link in the chain that can break, and because its freaking cool.

Installation with GitHub Integration:
To get the latest updates for GCal-Search, the best way is to enable the GitHub Integration in your IDE, and then:

  1. Go to My SmartApps in the IDE
    
  2. Click on Settings
    
  3. Click on Add New Repository
    
  4. Owner=infofiend, Name=GCal-Search, Branch=master
    
  5. Goto My Device Handlers in the IDE
    
  6. Repeat steps 2, 3, and 4 for both of the DTHs
    

Enjoy!
-Tony

Donations always welcome…

13 Likes

Yay! I just added you to my repo so you can merge the changes in for anyone that was pulling from mine so they don’t have to redo things.

Edit: I would transfer the repo to you but that would break everyone. Just not an easy way to do this! :frowning:

3 Likes

Awesome!
This is one of my favorite community apps, actually.

I put in all my sports team’s calendars as well as the UFC calendar. The switch goes on when the game starts (or main card starts for UFC).

I’ve thought about using this for presence by setting up my work schedule and adding in vacation and OT days. I think I may go ahead and do that now.

I’ll use CoRE for presence by taking my existing 4 presence sensors, adding a 5th from GCal, and matching at least 3 (sometimes my tasker one won’t switch and I’ll give myself some leeway in case my arrival sensor battery dies and I don’t notice it or I forget to change my work schedule) to get an actual presence.

2 Likes

I’m glad to see this one come back. I never got a chance to play with it.

Thanks!

1 Like

Time to set this up so that the student get a rude awakening if there’s no continuous motion in the bedroom when it’s time to get ready for school!

2 Likes

Glad to see it’s being worked on again. I had to make some changes to the code awhile back because it wasn’t killing scheduled events that were removed in the calendar. This is my most essential app i use.

1 Like

I am glad you decided to update and maintain this.

I currently use it for work schedule triggers. Works great except for repeating events on your calendar. That minor flaw is no biggie for me cause it still works for my use case.

So I got confused in the previous post, will I need to reinstal?or reset my github links?

If you use mnestor’s original code and wish to update: First, reset Github links to new repository. Then download and install the two new device handlers in the IDE. Finally, make sure that your existing GCal search devices (which are virtual contact sensors) are changed to the new GCal Contact Sensor DTH.

Little Confused??

OP says to do the device handlers (3 available) in Github.

Directions on Github readme say only 2 DTH to install with 3 available?

"Install and Publish the 2 DTHs: “GCal Event Sensor” and “GCal Presence Sensor”

Not sure where I said that there were 3 DTHs. There are two smartapps and two DTHs to install.

1 Like

Okay my mistake, I just was going by the repeat steps for DTH, there are 3 DTH files in the github.

I’ll do the 2 in the read me.

Thanks,

Actually, I now understand. I had briefly changed the name of the Event Sensor, but that caused the smartapp the fail. I will delete the Contact Sensor from Github.

Thanks for alerting me.

So I created the Google Project, enabled the Calendar API, installed the apps and the device handler and when I go to setup GCal Search I see this screen…

I realize by Oauth callback differs but my IDE differs.

Any advice on where I may have misstepped?

Did you also enable OAuth in the IDE for the GCal Search app?

Yes… is there a specific url I need to place in that particular screen or just leave it blank?

Blank. Just wanted to make sure you didn’t miss that step.

Did you copy your clientId and clientSecret into the settings portion of the gcal-search app.

I had an extra space in front once from my copy paste and it didn’t like it.

Are the settings supposed to be pasted somewhere into the code? I don’t think they are, so in answering your question I could not get to the point where I could paste my clientId and clientSecret into the app because that screen appears after I am asked to verify my credentials.

It’s not in the mobile app, you go to the IDE and put it in the app settings.

Let me get on my computer and post some screen shots to show you where.

Log into your IDE
Click the My SmartApps Tab on top
When that open scroll down to Gcal Search
Then Click on the icon with the pen thing in it.

When that opens the next screen scroll down to the setting tab and click on it.

Paste your ClientId and ClientSecret here.

Then scroll down and select update at the bottom.

I am not sure if you’ll have to click save on the code screen and republish. I doubt it.

Hope that helps.

1 Like