Thanks! I'll take a look later today. I'm thinking that for some uses, the IFTTT integration might still be more useful but I will definitely use this for others. I have several calendars set up so having one for all-day events isn't too difficult either. Thanks again!
Did you put this in a "release" topic yet? I think it deserves one.
*edit: Also, if you click on the home link after you successfully validate authentication the app crashes. Something is wrong with that link.
I haven’t and honestly a little gun shy because I am no expert on the Google API side to help folks with setup there. But will consider.
Not following here. Mind providing steps to reproduce or errors from log?
Thank you for the effort, but this seems like a LOT of setup for something that in theory should be quite simple since Google Calendar can generate public "secret" ical feeds... Why is the API and cloud app project necessary?
How does the "Time to Run" feature work? It seems that if it finds a string match within the cache period it will turn the switch ON right away even if the event is not scheduled to occur until later.
That is the time when you want the app to run each day. For my use case I check once a day and I have it run just after midnight.
If you need it to run more often you could create a Rule Machine rule that runs a custom command on your virtual switch that calls Refresh which causes the app to query the calendar again.
I'm a newbie to Hubitat and wondering how can I setup a virtual switch based on my calendar events. I'm basically trying to setup my kids alarm based on their school calendar.
This is the exact reason I am looking for this as well. Are you looking to have the alarm go off M-F unless one of those days is marked with a No School all day event?
This may work for you:
It’s a little rough as I got about half way through and found another way to do what I wanted, but in short it’s a small device driver that allows you to store up to 12 days, and tests those dates at midnight to turn on a isHoliday attribute which could be tested by RM or webCore to do other things.
Wouldn’t take too much for me to add the Switch capability so that you could tie it to a tile if you like.
Thanks for sharing your script. Does it mean I need to manually create next 12 days everytime?
The way it's setup now you'd have to manually enter up to 12 "holiday" exceptions (can add more easy enough too) to flag. What sort of input were you looking for? (No guarantees, but certainly willing to look at it to see what I can do.)
Honestly, I don't even know how to create Virtual Switch using your virtual driver. I admit that I'm very new to Hubitat and still learning lot of new things. I added your code as Device Driver but don't know where to go to edit the calendar events.
Once again appreciate you for offering your help in this regard.
It's a little rough and I'd need to add the switch capability if you want it, but RM and webCore can test the isHoliday attribute just as easy as a switch on/off. If you click on the device you created you should see something similar to:
To store a holiday enter the slot number (1-12) and the date string desired (YYYY-MM-DD format) as parameters under the Store Holiday button, and then click the button. After you do that it should show up on the right and be checked against today's date to determine whether or not to set the isHoliday flag; thereafter the check is performed every night at midnight. Dates can be entered into the slots in any order; to change a slot just enter a new value for it.
This is my exact setup. I am usually the first up and once out of bed my hub changes to Day mode, alarm disarms, and if a weekday lights may turn on based on switches that are updated via Google calendar integration. For example yesterday was a school teacher workday so lights turned on in our bedroom, but remained off in my kids rooms and today all lights turned on since we had work and school. I also have automations if we are having a guest sleep over and I recently setup a reminder for my mail alert to let me know it’s a mail holiday so I don’t expect mail.
The setup of the API access on the Google side are somewhat tricky and something I had done years ago that I leveraged when setting mine up. But once setup the HE side is pretty straightforward with a parent app, child app, and driver. I have never looked into Hubitat Package Manager but that could automate the HE installation. I just need to find the time to get that done and installation of Google side documented.
@neonturbo posted some steps of the Google setup here:
You may want to approach the issue somewhat differently.
I wanted to designate several dates in the year as a holiday, so I used the event engine (from Hubitat Package Manager) to do that. Bryan put in the capability to use a fixed date in the future, and I set a switch based on that:
Thanks for pointing me to this thread where they discuss in detail on debugging the Google Connection.
I was able to get GCal Search installed today and it appears to be pulling the correct information. How I did it if people are still having issues with creating a credential:
Create credential. Type = desktop app. Can use an external oath and don't need to publish the app.
Add yourself as a test user in the oath consent form page.
Install GCal Search app in HE. Enter ID and secret. Look for the authentication code at the top of the screen and copy it.
Hitting authenticate button should ask for the device code you copied, then ask you for your username.
Proceed to unsafe when prompted.
@nicholas.carl.willia, I have finally released a more polished version of my code here:
That's awesome, thank you! Great integration!