Not sure I am following what happened. Are you trying to update the child GCal switch device that was automatically created by a search trigger? If yes just update the label of that device directly within the device record and you should be good to go.
Sorry - I should have been clearer. I made the mistake of previously editing the Switch Device Name in the app, not checking the device, and assuming it was updated. This led to a situation where everything got a little confusing as I had a series of devices created by rules that were very similar in name and I lost track of what was connected to what.
Your response prompted me to look further and I remembered that the device has the Parent App field and I was able to clean everything up. Thanks.
This app is great. Very useful for my case. 2 questions if you could help me.
- Is the Gmail search feature capable of extracting a line in the body of an email example below and create a scheduled job to toggle x switches just like the gcal search trigger does ?
Start Date Friday September 26, 2025
Start Time 9:30 PM
Time Length 30 minutes
- Using the Gcal trigger this works very well for all but 1 device I am also trying to control on trigger which is WOL (Wake On LAN). This is actually 2 devices as you send the WOL MAC Address packets in normal sequence to turn on the PC and the MAC in reverse to send a signal to shutdown. Your app trigger allows the "toggle" on and off at the end of the job that is created but i need to "toggle" the WOL ON switch when the event starts and WOL OFF switch when the event ends.
I hope i missed something in the documentation but needing some assistance with this.
Great job !
Claudio
My suggestion is to write a routine that does the on thing if the virtual switch turns on, and triggers the off sequence when the same virtual switch turns off. Or the virtual switch on/off can turn your On and Off switches.
That’s exactly what I ended up figuring out last night would make sense so one of my physical switches I created a routine to monitor it and if it got turned off, it would send the weight on land in reverse so thank you for that.
Assuming the text format is always the same then it should work. Other community users are parsing AirBnB emails to set lock codes as an example. See the additional actions section of the search trigger for details. Information parsed would set hub variables. Now from there on scheduling at the email specified time that is outside the scope of this app and maybe you can parse the hub variable values in Rule Machine, I am no expert there unfortunately.
Thanks @neerav.modi for the suggestion on the other question.
I managed to update my process via Google AppScript so it is parsing the emails without issue. Thanks for a great app !
Claudio
I've recently started using this app but find that periodically it loses authentication (refreshAuthToken - caught exception refreshing auth token: groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request). I've enabled debug auth logging so should hopefully have more info when it happens next time. Would it be possible to have the app set another switch when it fails to refresh a search for any reason? I'm using it to trigger a reminder via Alexa based on my shift start time so I could do with having a notification when it fails. If it set a switch on failure then I'd be able to use that to trigger an alert. Thanks for all the work you've put into this by the way.
Strange you are getting Bad Request. I’d like to see the additional logs when you get them. I have been testing a few changes to attempt a retry if there is a timeout exception which I get occasionally but I haven’t gotten a bad request.
OK it failed again.
2025-10-12 01:00:00.413 error refreshAuthToken - caught exception refreshing auth token: groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request
2025-10-12 01:00:00.416 debug [refreshAuthToken - state.refreshToken: <refresh_token>, Existing state.refreshToken = <refresh_token>, refreshParams: [uri:https://www.googleapis.com, path:/oauth2/v4/token, body:[refresh_token:<refresh_token>, client_secret:<secret>3, grant_type:refresh_token, client_id:<client_id>]], returning false]
2025-10-12 01:00:00.421 debug [authTokenValid - fromFunction: Work Schedule Child App-getNextEvents, authToken expired (Sat Oct 11 01:59:59 BST 2025) - calling refreshAuthToken: false, returning false]
2025-10-12 01:00:00.423 debug [apiGet - fromFunction: Work Schedule Child App-getNextEvents, isAuthorized: false, Authentication Problem, apiResponse: null]
2025-10-12 01:00:00.425 debug [getNextEvents - appName: Work Schedule Child App, watchCalendar: <calendar_id>@group.calendar.google.com, search: *, endTimePreference: 24, queryParams: [orderBy:startTime, singleEvents:true, timeMin:2025-10-12 01:00:00+0100, timeMax:2025-10-13T01:00:00+0100], events: null]
It could be because I added the credential to an existing dev project, rather than setting up a new one. According to Using OAuth 2.0 to Access Google APIs :
A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days, unless the only OAuth scopes requested are a subset of name, email address, and user profile (through the userinfo.email, userinfo.profile, openid scopes, or their OpenID Connect equivalents).
Since it first failed on the 12th and had last been reset on 4th it seems to fit the 7 day expiration. I've set up a new project and have new client Id and secret - is there a way to change them in Gcal hubitat app without recreating it?
Gotcha
Open the parent GCal Search app and click Authentication and you will find a reset option where you can change the ID and Secret and then re-authenticate.
Thought those were read-only for some reason (I'm full of a cold so that's my excuse!). I've now switched to the new credential, authenticated and refreshed the child app, we'll see if that fixes it. My original project does have some additional scopes so it's possible these caused the refresh token expiry.
Thanks for the quick response.
No worries they are hidden unless you reset it again. Going through the setup again should get you going again.
If you are adding additional scopes and functionality that would be useful for others please reach out. I purposely put this into the HubitatCommunity repo and would love to see community contributions.
Well this app has been fantastic. For those who want an idea of what can be done here is my use case.
I have clients whom own unmanned facilities that allow customers to reserve 24/7. The issue was all the technology in the space is on 24/7 to accommodate this causing issues like $6k projectors to die prematurely etc. So what I am building for them is a hubitat controller --> Gcal search app --> monitor a calendar and powers on the equipment 5 min before their start time and power off 5 min after end of time. To get the data into the calendar I have scripts that parse the emails and format the calendar event properly for hubitat to interpret. Its working fantastically ! I have added a fun little video of me messing around with a bunch of plugs for an order I just finished for your entertainment ![]()
Thank you for all to contributed to this app !
Claudio
@ritchierich As I posted this app has been fantastic and have adapted it to do a lot of things. I am running into a scenario that I cant fully grasp how to accomplish. I have laid out how I have it setup and hoping you can direct me on how to get this last piece to work.
I have a Gcal search that monitors a calendar for events like expected. When there is an event --> Turn on the lobby lights with a -10 offset. This works just fine.
What I am after is to have the lights on from 9am - 9pm and ignore the Lobby Light Gcal search actions. After or before 9pm it should go back to following the events monitored by Lobby Light Gcal search.
I have tried multiple rules to change a boolean and virtual switches with many variations and cannot get this to function smoothly. Any help / direction would be greatly appreciated.
Thank you
Claudio
I have always tried to keep things tight and combine rules but as Bruce has always said “rules are free”.
Setup a rule in one of the many inbuilt apps to manage the 9-9 schedule - keep that separate.
For this I would suggest setting up a search trigger that runs during the off hours. You can setup a cron schedule for this scenario. Then have it manage the lights based on the events.
Hi!
About mapping variable, it is possible to search for a specific keyword and if found, then set the variable to a specific value?
Ex: look the sender email (From:) then if noreply@amazon.ca then set variable to Amazon.
In that way I can obtain a proper notification message than a message that include the whole email address.
@pgagne the challenge implementing this is the UI within the app and how to present this without creating confusion or breaking changes. I believe the best solution would be an external rule that fires in your variable change and update it accordingly.
@ritchierich: One quick question, I would like hubitat to read out all events from my calendar (one day) in the morning (via Sonos) combined with my morning routine. What I currently am able to acive is to read out the first event with start time and title. But that's it. If I do have an event at 10.00 am and a second at 1 pm and a third at 3 pm is it possible to read out all these events put them in one string variable and work with the data in webCoRE?
Sorry if this was already described in this thread, but I'm not done scrolling through the long list of postings. Thanks in advance
In the child switch settings there is a next event preference where another state variable will be populated with the next event after the first matching event. Give this a try.
If you wanted to send out a notification with all matching events there is a setting in the Notifications additional actions that was added: