[RELEASE] Google Calendar, Task, and Gmail Search and Gmail Notification Device

I run it on two hubs.
Is that an issue?
If so, I could use another gmail id for each hub.

Have a great vacation!

Quick question: what type should be hub variable be - string, decimal, or number?

I'm just putting Arrive 10 in the description and hoping to pick up the 10, as per the screenshot. The update screenshot shows that it picked up the 10.

Update: of course both number and string work now, AFTER I ask for help! :smiley:

For my testing I used a string type variable and in my description also entered Arrive 10 and my string variable was populated with 10.

OK glad it now works. Was hoping something wasn't up with setting a number since my test was with a string. There are a few community members using this feature for AirBnB rentals parsing the emails to set a lock code so know this was working. When you said it wasn't working I was a bit concerned because this code hasn't changed in so long I had to remind myself how things worked LOL.

I think it might be the causing conflicts where one hub gets a refresh token that then conflicts with the other hub. If you can please disable on one hub for a period of time and see if the errors go away. If they do one solution if you want to keep using the same Gmail account is to setup another project within Google Console where an additional set of API keys are generated for the other hub.

v4.7.7 has been published to Github and HPM:

  • Added this app to the Integrations menu in the new UI Navigation in Platform v2.5.x

Are there special considerations when running the Google Calendar, Task, and Gmail Notification app on more than one hub?

My first attempt to set this up went perfectly, but when I tried it on another hub at a different location, I got the infamous "redirect_uri_mismatch" error, preventing me from installing the integration on the second hub.

I came across something in this thread that seemed to suggest it would be best for each Hubitat hub to have its own Google account for this integration. I set up two of my hubs at different locations using this integration, each with its own Google account.

I am using the URI provided in the GitHub instructions, "https://cloud.hubitat.com/outh/stateredirect." I've gone over all the setup parameters, and everything seems correct.

I'm stumped. Any suggestions?

From Google documentation:

redirect_uri_mismatch

The redirect_uri passed in the authorization request does not match an authorized redirect URI for the OAuth client ID. Review authorized redirect URIs in the Google Cloud Console Clients page.

The redirect_uri parameter may refer to the OAuth out-of-band (OOB) flow that has been deprecated and is no longer supported.

Refer to the migration guide to update your integration.

I believe it would be best to setup 2 different API tokens for each location/hub within the same account. I haven’t tried this myself but had suggested it to @jtmpush18 and curious if it resolved his issue.

Yes it did.
I apologize for not getting back to you earlier.

@jtmpush18 thank you for confirming!

@scott.sr within the Google console setup another API credential so you have one for each hub and you should be good to go.

@ritchierich - hey Michael - I just got a notification from Google that they are going to delete my OAuth client because it has been active. I think I originally set this up in 2020/2021 for this app. Any suggestions on what I need to do?

UPDATE: I think I'm good - that email was related to some OAuth credentials that I had set up as a test from Node-RED and then I discovered your app! All around the same time in 2020/2021 :wink:

So the following schedule settings:

Later in the app i have notifications set up. This works....however, not exactly as I would like.

If I have an All Day event tomorrow, I don't get the notification until midnight. I want to get the notification at 5:52pm as a heads up "xxxx is happening tomorrow". Instead the notification is sent out at midnight when the event starts.

Is my desired "pre-notification" of pending event possible?

Yes this is possible via the bottom offset setting in your screenshot above. For example set it to a negative “-5” hours and it will fire at 7PM the evening before.

Thank you. So here is what I have: I have it run once per day at 5:52PM, And then I have an offset for -240min

So in my scenario....it will run at 5:52, but for a 24hr/full day event I get an alert at 8pm (4 hours before midnight).....is this correct?

Actually thinking about it more as I didn't notice your trigger start time before, easiest way to solve this is to turn off the "Delay to Calendar Event start" setting. This way if you want the alert at exactly at the time this trigger runs, it will fire then. If you go this route make sure you remove the offset you just entered and turn off Set Offset.

Sorry for the back and forth here.

Ahhhh......of course. Thank you.

Happy to help! Just make sure to leave your Search Range to only End of Next Day because if you expand it and other events are found more than a day out, the notification will fire.

Is there a way to allow formatting in the Gmail messages? I'm not talking about anything crazy, but just line breaks for example?

I had created a new Gmail Notification Device, and then in rule machine created a new rule where I used the "Send Message" option as the Action. I filled in the message in the text box there, and I chose my Gmail Notification Device to use as the Notification Device.

This works fine, but the contents of the email are all on one line. I tried adding <br> tags in the message in rule machine, but they were immediately stripped out.

HE made a decision many years ago to strip out HTML from UI commands and Rule Machine actions likely for security reasons. I added the ability to do this, see this post and the one just above for more details:

Thank you! This is exactly what I was looking for. I can't believe I forgot about trying '\n'! :man_facepalming:

After only about 2 weeks I get

I can do the re-authentication process, but again, doesn't last long. What am I doing wrong?