[RELEASE] Google Calendar Search

Version History:

  • v1.0.0: Initial Release
  • v1.1.0: Added ability to search the location attribute of a calendar entry within a calendar search trigger.
    • Use case example: I have a motion sensor that turns on the lights in my crawl space and off after a set period of time once there is no active motion. Twice a year my HVAC company comes for preventative maintenance and they complain the lights are turning off on them. I now have a GCal Switch that queries my calendar for an entry where the location is "Crawl" and will turn on the switch that will disable this motion lighting app.
  • v1.2.0: Now support toggling switch at scheduled future time based on calendar event start and end times.
    • If a calendar event match is found and the start time is after the current time, a trigger will be scheduled to toggle the switch at the calendar event start and end times.
    • Each time refresh and poll are executed, any scheduled are removed and re-evaluated based on the calendar events and search criteria.
    • Only files you need to update are the parent GCal Search app and the GCal Switch driver
  • v1.2.1: Fixed a few bugs with scheduling of future events.
  • v1.3.0
    • Calendar names will now default to the "summaryOverride" value if available. This is a custom name applied to the calendar within Google. Based on request from @mikee385
    • Based on popular request, searches can now be periodic every N hours, every N minutes, or via Cron expression string along with previous once a day.
    • Only files you need to update are the parent GCal Search app and the GCal Search Trigger child app
  • v1.4.0: Added offset preference for start and end times so that the switch can toggle N number of minutes before/after event start and/or end dates based on @gertjan.deprez request.
  • v1.4.1:
    • Fixed bug and error in log when an offset was null in the search trigger app
    • Added ability to perform an exact match search where you prefix your search string with "="
    • Added ability to turn off case sensitive matching
    • Cleaned up help text within the GCal Search Trigger app
    • All files have been updated in GitHub
  • v2.0.0:
    • Added necessary files to integrate this with Hubitat Package Manager for installation and updates. Install and updates can now be done via HPM.
    • Added ability to configure the end date for the calendar query. Options include end of current day, end of next day, or a set number of hours from the current time. Request from @halfrican.ak
    • Improved UI formatting and instructional text within the parent and child apps.
  • v2.1.1:
    • Fixed bug with all day events and dates where calendar timezone doesn't match hub timezone. Thanks @mikee385 for the pull request!
    • Added logic to adjust the eventEndTime if there are sequential events that match the search string. This prevents the switch from turning off and on between events if periodic schedule is set. Thanks @mikee385 for the suggestion here.
    • HPM updated with new manifest so you should be prompted to update.
  • v2.2.1:
    • This release will require that you open one of the Search Trigger child apps and click done to save settings for caching purposes.
    • Fixed bug with Number of Hours from Current Time preference not showing.
    • Refactored caching functionality to work with Search range preferences.
    • Caching may have been used before that didn't contain all events. Reworded instructions a bit to be clearer.
    • HPM updated with new manifest so you should be prompted to update.
  • v2.2.2: Fixed a bug that @rakeshg reported with an error that occurred on a new install. HPM has been updated.
  • v2.2.3:
    • Fixed bug with caching of events.
    • Fixed bug with getting end date of search range and cast error. If required endTimeHours preference is not set for some reason, it will default to end of current day. Thanks @trevalex
    • Added toggle to hide offset preferences to help reduce confusion on this optional feature.
  • v2.3.1:
    • Added an option to use Google Query Matching. By default calendar event matching is done by the HE hub and it allows multiple search strings. Caching of events is not supported when using Google query matching.
    • Added ability to prefix search words with a "-" (minus) to exclude events with this word in the title or location. Thanks @neerav.modi
    • Added ability to exclude All Day Events (default is to include) Thanks @neerav.modi
    • Added ability to set whether sequential events will expand the scheduling of when the child switch turns off. If this is turned off, the switch will turn off 1 minute in advance of calendar event end time to ensure the toggle can happen. You can override this via the Event End Offset setting.
    • Added ability to toggle/sync additional switches. A list of switches can be designated to synchronize and a list of switches can be designated to reverse the switch state as the child calendar switch is toggled. Thanks @rakeshg
6 Likes

This is interesting. Didn't Google change things in regards to access to api?

Not that I am aware of. While creating the documentation I used a few of my gmail accounts to test this and all work fine. The app will never be officially published by Google and it’s used for personal use. My primary account has worked for over 5 years now.

1 Like

I'll have to check it out.

How does this differ from the one ported by @cometfish? I was using that before covid…

Summarized it here:

1 Like

Excellent work!

1 Like

Seems like I can finally shed my dependence on IFTTT now. I have been running that service for this purpose.

1 Like

Would this work for a public Google calendar rather than my own?

(The city of Columbus makes public their trash/recycling calendar, and I'd like to be able to integrate it with my Hubitat. I'm new, so I can't post links. Add a dot gov for the domain 311.columbus/AddrLookupnew.aspx)

If you can subscribe to that public calendar in your own google calendar you should be able to use it.

2 Likes

Hey neighbor! (Also a Columbus resident).
You can input your address on that page and get a calendar that can be added to your Google Calendar. Then you can use this like normal!

V1.1 posted to Github that allows querying the location attribute of a calendar entry. Please see details in post 2 above.

1 Like

Based in the UK I have been looking for this for ages, thank you to everyone who contributed to this.

I have installed the Driver code but cannot see how to add the Apps code, is it possible there is a video online to show the full process? I am happy to contribute ( pay ) for assistance.
Many thanks
Paul

Apps are similar process as Drivers but in a different section. Here is a Docs article on how to do it:
https://docs.hubitat.com/index.php?title=How_to_Install_Custom_Apps

There are two apps and here are the import URLs to make it easier:
Parent App: https://raw.githubusercontent.com/HubitatCommunity/Google_Calendar_Search/main/Apps/GCal_Search.groovy
Child App: https://raw.githubusercontent.com/HubitatCommunity/Google_Calendar_Search/main/Apps/GCal_Search_Trigger.groovy

Thank you Ritchie

I appreciate your time as will investigate this later.

Kindest regards
Paul

1 Like

I got as far as creating the Google API Client ID but could not see where to create the Google API Client Secret

I am happy to pay for someone's time on this, I want to be able to

  1. Read the diary for today
  2. Another routine reads it for 90 days from today
  3. Another reads it for 30 days from today and if keywords exist such as "reserved" or "wedding" then to have Echo Speaks ( installed and working ) to alert me to the content so I can take action.

The logic is that I have an online diary booking system that brings in our accommodation bookings, we mark off our accommodation in the hope of getting a wedding so the word "reserved" will appear in the diary. Within three months it's unlikely we will get a wedding booking in so I then want to release the room.

On the day I really want Alexa to notify me at intervals of the pending appointments.

Many thanks
Paul

Does this have a "power meter" like gcal. gcal takes up quite a lot of state size because of the power meter. All I need is a virtual switch. it's how I've always used gcal anyway. I just don't like the constant on/off power meter.

Sorry for being obtuse, but what are you asking? Not following the correlation between power and a calendar :rofl:

IDK but it is a thing lol.

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.

Download the Hubitat app