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

Doesn’t require a different calendar - just use whatever calendars you already have.

I use it (with Rule Machine) to trigger a virtual presence sensor for my son. I have it open / closed on calendar events indicating he is at home or not.

Do you know what capability that would be? Happy to add it if we can figure it out.

Good to hear it’s working well for all of you. Been worried the scheduling issues would come back and kill this.

That would be really nice!

@Luvien, @kurtsanders
Can you expand on this a bit more?

Adding in the event description shouldn’t be a problem. It will make that tile a bit bigger though. Perhaps there’s a way I can adjust the size of it when that’s empty.

For the other part you want the description and/or title/dates to be available to other apps? If that’s the case I’m not sure what capabilities would work out for that. I could do timedSession but the sessionStatus on that I’m not sure I could set to whatever I wanted. I do think we need to stay within the confines of the capabilities created so other apps don’t have to code specifically for us, even for extra data.

Perhaps @Mike_Maxwell has some ideas, he certainly seems to have gotten to know the entire capability reference page :slightly_smiling:

I’m not aware of a standard attribute capable of displaying arbitrary text.

Ok, I’ve got this set up and running. My initial, small test worked as advertised. Now I’ve got a couple of questions…

  1. I work shift work, so on my calendar my work days are listed without a time, but rather as ‘All Day’. One would assume that ‘All Day’ starts at 0000 (maybe 0001) of the day in question…is that the case here? That is, will my using ‘work’ as a trigger turn on the switch at midnight of the day the entry shows on the calendar?

  2. If I have multiple words in the title of the Calendar event (for example: OT 24h @ 65). If I set a GCal search trigger to look for #OT is it going to find that event? further, will it find ANY event with the letters ‘ot’ in it, or just, specifically ‘ot’ as a stand alone word?

  3. Last, does capitalization matter at all with any of this?

thanks!

If the description would be avaliable in RM, maybe we could use it in some rules. I would love to send the description on the speaker for TTS for example. We are far from there, but that would be great. I know that with Big Talker we can use variables.

LJ

  1. Yes
  2. In the example it will ignore the # unless you put double quotes around it so “#OT” instead. I have found that if you only have #OT as the title it won’t match. Putting that in the description works better.
  3. Nope

To expand on this. All day events that span multiple days will trigger an off/on at midnight as the system treats multi-day events as multiple events. So an event starting Monday and ending Wednesday will be 3 all day events instead of 1 event.

After some thought on this RM would need to know of our special device when it connects with it and query for extended information we aren’t yet providing. So this would be more than just a mod to GCal. But by offering up this extra information RM and others would be able to act on that information in whatever way you wanted.

Thanks for the feedback. I still have questions about my second question:
In my example ‘OT 24h @ 65’, how should I go about titling the GCal search to find those instances, given that both the 24 and 65 change each time? You mentioned ‘putting That in the description’, what do you mean by that?

Thanks!

You mentioned #OT. If you have other stuff in the title just do your search with the double quotes for “#OT” and you’ll only match those. You could also just put #OT in the description field and do the same search. Kinda use the description to hold onto hashtags and set your search for the double quoted hashtash value. I have just run into issues where I had titles that were only the hashtag not being found until I put extra data in the title field.

So
Title: #OT
Would not be found by a search: “#OT

Title: #OT 24h @ 64
Would be found by search: “#OT

I think it works out better in the Description and that issue won’t come up though.

1 Like

Sorry, I’m not understanding. What do you mean by ‘Description’. On my calendar, I’ve got a field for Title and another for Location. I’m not seeing anything for description.

I’m also not sure I’m reading correctly. If my title is OT 24h @ 64
do I just search for “OT”, using the quotes? I was only referencing the # since that, as I understand it, allows a search for any title with OT in it. My concern with doing this is if I had another title like Other would the # mean the letters ot are being searched for as part of a word, or does it need to be the stand alone letters Ot to be found using that search?

Does this make sense at all?

Just create a test case and play with the search. As long as you don’t tie the test device to any actions nothing will happen in your system. Easiest way for you to get an understanding of what it’ll do. As the search is purely on Google’s side I really don’t have any control over it.

This is the API I’m calling: https://developers.google.com/google-apps/calendar/v3/reference/events/list

And the search item is ‘q’ this is the description of it they provide:
q: Free text search terms to find events that match these terms in any field, except for extended properties. Optional.

I’ve tried some of the stuff here: https://support.google.com/websearch/answer/2466433
But the hashtag thing doesn’t work like I’d expect.

I just created a test device in smartthings and play with a test event on the calendar renaming them and refreshing to see if it finds what I want. I suggest you do that.

There really isn’t any good documentation sadly.

Ok. Cool. Thanks!

So, I’ve been playing around and found something strange.

When I enter an event on my calendar that is an ‘all day’ event, the GCal search finds the start time as either 12:00AM or 1:00AM, depending on which of two searches is used. More confusing, an all day event that starts at March 12th, 2016 @ 1:00AM doesn’t close until March 14, 2016 at 12:59AM. By my count, that’s two days, not one.

When given specific times to open and close, the search records the correct times.

Any idea why this might be?

Check gCal / mobile app to see if you are forcing a time zone change.

The Google Calendar Event API is documented here and has a “Try it” section where one can see what the “q” search term returns for their Google calendar(s) along with other API properties.

The “singleEvents” property determines whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. The default is False and therefore might be suspect in your results.

What timezone is your hub set for? What tz is your calendar and what tz are you actually in?