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

Given its a LAN connection you may need to go through the Google API Authorization again. But before you do, open a search trigger and click the refresh button and check the logs to see if you get any errors. If no errors, add something to the calendar to make sure it is found.

If you do get errors, open the parent search app and click the Google API Authorization link and then click Reset and go through it again.

I get my C8 today but plan to keep this integration on my C7 LAN hub along with my other chatty LAN interfaces.

2 Likes

I think I had to do that to get it working when I migrated. To confirm I did as he said, go into one of the triggers and try to refresh it. It did not work on its own, I found out when the "No School" switch did not turn on and all the alarms went off in the morning. Kids were not amused.

1 Like

Funny, @jtp10181, I refreshed my searches and didn't see any errors in my logs...normal looking debug responses is all I see. It seems to work. I'm going to enter a calendar event and run a refresh and confirm it actually does something...

Seems to be working:

1 Like

Awesome glad to hear!

1 Like

Mine too, no need to re-authorize

2 Likes

@albertjmulder this might be possible, what do you have in mind? Are you logging data to a file on the hub? How large are these files?

The files are small, they are pictures from cameras, I want to be able to take a picture that is saved to the file storage and email it to myself using my Gmail account that I uses for hubitat stuff to send it and to my main email account. This way when I am not home and motion is detected I will get an email of the image to see if I should be concerned or not.

This would save me time from opening my camera app and scrub the data to fine the event, and incase the system becomes off line after the movement, I would at least have something to go by. (Basically incase they broke in and stole/destroyed the camera system)

How do you know which image to look at? And how quickly after motion is detected is the image on the hub?

In order to make this work the message would need to contain the file name that I could then navigate to the files and send that specific file along, thinking out loud here as I haven’t proven this can be done.

So I am using drivers that are already created for the grabbing of the pic,. and its almost instant that the file appears on the system, and the filename stays the same as it will overwrite the previous file when a new pic is taken. I use webcore to trigger the picture taken, and can easily add a 1 sec wait after taken before the next.

Not sure if your setup ties into webcore, but that would be ideal so I could say if camera x has motion take a pic, then use you setup to say send file x to email address x (Using gmail as the sender)

Hope you understand.

Got it that makes things easier.

I have never used Webcore, used the old CoRE on ST, but assuming Webcore can send a notification via HE notification device this should work.

Let me play around with the Google API to see if I can get this working.

1 Like

Despite reading and re-reading (and thinking I understand) this toggled option, which I've left in the Default == True configuration:

...I couldn't help notice that my test device ("Dining Room Light") turned on at GCal search runtime (6:23pm) rather than at the Calendar Event's Start Time (6:25pm). I had truly imagined the Turn On would be delayed a couple of minutes.

Maybe I'm old and/or dyslexic and/or have poor reading comprehension, but am I misinterpreting the screenshotted text above? THANKS!

Meanwhile, OMFG I love this app... THANK YOU FOR MAKING IT!

1 Like

@albertjmulder I found some resources online to send an email with attachment and unfortunately I cannot get this working. I used some code from @thebearmay to get the attachment from File Manager and used code from @Younes that he composed to send an image to Pushover modifying it to get the byte stream to send to Gmail API.

I successfully received an email with an attachment but when I open it is not a valid file. Groovy doesn't natively support MIME Messages which isn't making this any easier.

1 Like

Ok, I appreciate you trying. So question then, I have not implemented you setup here yes so I am not sure, but can I set it up to use my gmail address as the sender and use it to send email notifications and triggers events from the calendar and such? I was thinking to have my Alexa tell me when I wake up if there are any events like birthdays or anything on my calender for that day.

And hopefully one day Hubitat will support the MIME

Your understanding is correct you can create an optional Gmail notification device to send emails just like you would with push or SMS.

Then the calendar integration opens up a ton of opportunities for announcements or rule execution. My kids depend on this to wake up for school each day. My neighbors depend on it to announce no mail or trash holiday notifications. I also use it for Guest coming and turning off certain automations or even unlocking my crawl doors if Terminix or HVAC guys are scheduled to come over.

My family lives by our calendars otherwise we forget. Sad how these phones are making us dumber. :rofl:

+1 for an Attachment(s) option with outbound GMail messages, if that's what we're essentially talking about here.

Meanwhile, I plan to investigate creating really pretty Mail Merge forms using @thebearmay 's Tile Template Generator app, since ... why not?

1 Like

I tried but couldn’t figure out how to make it work unfortunately

1 Like

@albertjmulder @DubbyDad I have successfully sent an attachment from my HE dev hub via Gmail! I found a tutorial on doing this via Postman which helped me understand all the very nitpicky specifics like line breaks, etc which I believe was causing my failed attempts before.

I need to clean up the code and make things dynamic like allowing you to specify “File:filename.jpg” in the message so the code knows which file to grab from file manager. One thing I have run into with many tests is the job complaining about my Gmail device consuming a lot of busy resources so this is one known issue.

More to come in the next few days.

5 Likes

Version 4.0 has been posted to Github and HPM. Special thanks to @Younes for posting code to upload files to Pushover and @thebearmay for his file driver. I was able to learn from these contributions to make this update happen. Version 4 is a re-release of Gmail integration as I should have bumped up the version number when I created v3.5. This release includes the following:

  • You can now dynamically set the recipient (To) and Subject of a Gmail notification. Multiple recipient email addresses can be separated by a semicolon.
  • Files can now be sent from the HE file manager. Thank you to @albertjmulder for the idea and @DubbyDad for further encouragement to add this feature. Any file (haven't tested with a large file) can be called out in a notification message to be added to a Gmail notification. See the instructions within the GCal Search parent app on how to use:
  • The Search string is now optional for Gmail search triggers based on suggestion from @mboisson since labels are required...

Other items to follow up on...

Thank you for the feedback. Please keep that coming and ideas for improvements!

@DubbyDad You understanding of the "Delay to Calendar Event Start" is correct. I tried reproducing this couldn't. I created an event at 2:37 on my calendar to start at 2:40 and invoked a refresh and the child switch details were populated with the event details but remained off with a schedule job to turn on a few minutes later:
image
Could the clock be off on your hub?

3 Likes

Never you mind my tiny travails (zero impact on actual workflows)... Thanks for this!

Can't wait to update and put this thing through its paces! BTW, were you also the brains behind GCal3 back on another unnamed-brand's hub?

1 Like

I was not but used that version on that hub. @cometfish ported that version over to HE and I took that version and improved upon that version simplifying things such as Oauth setup and adding new features like Task, Reminders, and Gmail.

1 Like