@cometfish thank you very much for porting over this solution from ST! I have enjoyed using it over the past many months since you posted the code. I have been able to automate my home based on school holidays, family member being sick, parent traveling, and guest staying.
I mentioned to @sburke781 and @neonturbo that I made some edits to this app in this thread:
I wanted to post my version in case anyone is interested. My use case is much simpler and I removed some of the complexity from the ST/ported version to address the following features and use case:
- Simpler solution using a switch instead of presence and other sensor
- Ability to 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.
- Moved the processing of the search string match to the calendar title to HE. I had problems depending on Google's search to match the search string to the calendar title. Many times a wrong calendar entry was matched.
- 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 using a starts with match - calendar enter starting with search string will 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
- Caching of the day's calendar entries for a set period of time. This is useful when you have many switches checking the calendar for entries that run near the same time. For example I have 5 different search trigger apps that I set to run at 1 AM so instead of querying the calendar 5 times, the first one will cache the results so the others can leverage the cache. Default cache is 5 minutes.
My forked version can be found here: