Google Calendar, Task, and Gmail Search integrates Hubitat Elevation with your Google Calendar, Tasks, Reminders, and Gmail to automate triggers based on items found matching your search criteria:
- Optionally toggle a child virtual switch
- Send Push, SMS, and TTS Notifications
- Run Rule Machine rule actions
Gmail email notification devices can also be created with this application which will allow you to send email notifications directly from your Hubitat Elevation hub using the Google APIs without requiring a "middle man" server.
Special thanks to Mike Nestor and Anthony Pastor, members of the SmartThings Community, who originally created this app and @cometfish for porting their code to work on HE in 2019. I have taken this code and refactored it to make it simpler for my personal needs and hope it is useful for others. I have purposely published the code in the HubitatCommunity GitHub repository in hopes that this remains community code and others contribute to it as well.
Differences from SmartThings/Original Ported Version
- Simpler solution using a switch instead of presence and contact sensor
- Ability to set a default value of the switch that is used when there is no calendar entry. The switch will toggle from that value if there is a calendar event match. This is useful if you prefer the switch to be of a certain value in dependent rules and apps or viewing on a dashboard.
- Simple Automation, Motion Lighting, etc apps allow restrictions based on the state of a switch and the GCal Switch can be used for those restrictions.
- Original version uses Google Search features to find matching events and in my own use of it had many problems where an event was linked that shouldn't have been.
- This version moved the processing of the search string match to HE.
- Added ability to search location as well for a match.
- Ability to enter multiple search strings separated by commas for the same switch:
- By default the search string entered will be matched to the google calendar title/location using a starts with match
- A contains search can be entered by inserting an asterisk within the search string. For example to match both Kids No School and Kids Late School, simply enter Kids*School
This app allows you to create "search triggers" that will query Google Calendar, Tasks and Gmail for items that match a defined search string:
- Each Search Trigger child app will optionally create a virtual switch that will toggle based on results of the query
- Within the switch you can set a default value of the switch that is used when there is no calendar entry and the switch will toggle from that value if there is a calendar match. This is useful if you prefer the switch to be of a certain value in dependent rules and apps or viewing on a dashboard.
- Ability to enter multiple search strings separated by commas for the same search
- By default the search string entered will be matched to the google item using a starts with match
- A contains search can be entered by inserting an asterisk within the search string. For example to match both Kids No School and Kids Late School, simply enter Kids*School
- Set the search range of the query. By default, items from the time of search through the end of the current day are collected. Adjust this setting to expand the search to the end of the following day or a set number of hours from the time of search.
- Scheduling:
- Once Per Day at designated time
- Every N Hours
- Every N Minutes
- Cron Expression
- Utilize Rule Machine rules to invoke the "refresh" command on your GCal Switch by a set interval and perform the same action.
- Additional Actions
- Send notifications with dynamic content from the matched Google item
- Run rule actions based on the schedule of the Google Item. This is useful when you choose not to create a child switch.
- Dynamically control a defined list of switches from text within the Google item.
- For example: 'Turn off bedroom fan and turn on bedroom overhead lights, bedroom lamps, and bedroom tv' to turn off and on several switches
- Basically you set a list of switches that you would want to control via dynamic text and then in your Calendar Events, Tasks, or Gmail you can use text to describe the switches you wish to toggle. The app will match the name to your switch list and perform those actions.
- Added support for International users by entering the translations for "on" and "off"
- Dashboard Support
- The child switch driver includes the Pushable Button capability allowing you to add the switch to a Hubitat Dashboard via button template. Pushing the button will immediately query Google for new items matching the parent GCal Search Trigger's search criteria.
Example:
I have personally found this useful for the following scenarios:
- Kids School Holidays - where switches will remain off when mode changes to Day
- Parent Traveling - where the house will shut down differently based on one parent traveling
- Guests - guest room lights will not turn off if a guest is staying over
- USPS Holidays - mailbox alert to remind myself and neighbors that no mail will arrive today
Code and Installation Instructions:
- You must setup OAuth within your Google account to allow HE to access the calendar. Please follow the Google API Setup instructions in GitHub.
- Once you have the Google API credentials, you can either manually install the two apps and driver from the above repo or you can use Hubitat Package Manager for easy installation of the HE components.
- Then follow the Hubitat Installation and Setup instructions in GitHub.