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

@ritchierich there's a small bug if the app is syncing additional switches and the event is multi-day. In #poll, it won't set the syncValue value if the current value and the new value are already the same but then it syncs the child switch to an empty value and in the app, that results in turning it off (or on depending on the default - it falls into the else case). An easy fix that seems to work for me is to guard the syncChildSwitches call on line 110 in the driver. e.g.,

    if (syncValue) {
      logMsg.push("syncing child switch to ${syncValue}")
      syncChildSwitches(syncValue)
    }
2 Likes

@rvrolyk Thanks for letting me know! I have uploaded v2.5.3 to Github to correct this issue. HPM has been updated as well.

4 Likes

Does anyone have a simple example of how to capture the attributes of a GCal switch to use in a rule machine to help me get started? I would like to use the start and end date/times to to make various announcements between those times.
Thank you.

First off welcome to the HE Community. You don’t need the start and end values in a rule if you have the switch toggling based on the event times. Your rule just needs to check the switch state since it will only toggle if an event is found.

I would actually like to do do some preparation announcements slightly prior to the event. I suppose I cold have an additional switch, for that, but was hoping to be able to access those date/ times and not double the number of switches.

This is possible via offset setting where you can have the switch toggle X minutes before/after the event time. Then your rule can be set to trigger based in the switch toggling to make the announcement.

1 Like

I’ll give it a try.
Thanks for your help.

1 Like

Hi, I'm excited to start using this app! I installed it this morning and had some trouble with authentication. The Github instructions direct the user to select "Desktop app" as the application type when creating Credentials within the OAuth client ID. I did this and successfully generated a Client ID and Client Secret, but the app in Hubitat would not except them. When I looked at the Hubitat logs, I got the following error:

something went wrong: groovyx.net.http.HttpResponseException: status code: 401, reason phrase: Unauthorized, [error:invalid_client, error_description:Only clients of type 'TVs and Limited Input devices' can use the OAuth 2.0 flow for TV and Limited-Input Device Applications. Please create and use an appropriate client., error_uri:OAuth 2.0 for TV and Limited-Input Device Applications  |  Google Identity  |  Google Developers]

That suggested to me that the correct application type is "TVs and Limited Input devices" not "Desktop app." I went back to the Google Cloud console, generated a new set of Client ID and Client Secret with the "TVs and Limited Input devices" application type, and that got everything working. Unless I did something wrong, maybe the Github instructions need to updated to reflect this device type rather than Desktop app?

1 Like

Unfortunately Google has changed the console several times since I composed the instructions. Since mine is working I don’t often redo the setup to know that something has changed so I appreciate you letting me know. I will update the instructions in Github.

3 Likes

Thanks for this! Was completely DoA without this post. GitHub instructions definitely need to be updated as the sign up process simply halts if you don't select the correct device type.

I won’t be able to update this for another week, traveling for the holidays without my computer. If either of you have GitHub accounts and could submit a pull request with the update I can accept it. Otherwise I will get to this when I can get back in front of a computer.

2 Likes

I saw that you published the update, sorry to bother you on holiday! Thank you so much for the contribution to the community. This great addition will allow me to save significant amounts of energy and therefore GHG by not heating and cooling my trailer on days where it won't be in use now that I face returning to the office part time sometime during the new year.

1 Like

I found that the last item in a String Search with multiple items must end in a comma.

I use this feature on almost all of my calendar searches and don’t have to end it in a comma. The space between the comma and the next item might be causing the issue because I have a similar search setup for USPS mail holidays with no “, “ between the holidays and it worked just fine this morning for Christmas Eve.

I won’t be able to test this for another week until I get back home.

1 Like

Yes. You are correct. I just tested all these formats;

New Year's Day,Memorial Day,Independence Day,Labor Day,Thanksgiving,Christmas
New Year's Day,Memorial Day,Independence Day,Labor Day,Thanksgiving,Christmas,
New Year's Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, Christmas,
New Year's Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, Christmas

and they all work.
Don't know why I was having the problem earlier, but it works now.
Sorry for the inconvenience.

Can you look back in your last logs to see if you have any errors for the GCal Search Trigger app? Curious if that may provide a clue on what caused the issue. If not I will do some further testing when I get home.

Oh and see you used “Christmas”. You might want to change that to Christmas Day because I learned yesterday that my automation failed because there is a Google holiday for Christmas Eve too. Adding Day solved it.

I did not find any errors in the log, but it may be beyond the range now. I could only go back 48 hrs.

Thanks for that catch. I added "Day" to be sure to capture the right event.

1 Like

I have tried connecting to the Google calendar API as in the Guide, but my hubitat is failing at the Check Authentication Step.
Anyone had the same issue and resolved it?

thanks

1 Like

@justinrsteele and @afidel thank you again for letting me know about this edit. I have finally gotten around to updating the steps in Github along with a new screenshot of using TVs and Limited Input devices for the credential type. What is very strange is my production hub still uses Desktop and is working fine but when I changed the credentials on my dev hub to my test Google account I got the same error as you. So it forced me to create a new TVs... credential. I went ahead and updated my production hub too just to be safe since my family depends on this integration.

For anyone else reading this, please keep these updates coming. This is the second time the console was changed since I composed the instructions and with a working integration I don't often repeat the steps.

@mark.townshend very sorry for the delay I was traveling and away from a computer for the holidays. Did you ever get this working? Maybe you were caught up with the error mentioned above with the wrong Application type when creating your credential. I have updated step 13 of the instructions in Github to reflect this change. Please login to the Google Console and navigate to your credentials and see if the type is set to Desktop or TV and Limited Input. If the former, delete that credential and create a new one and try again as that is the cause of your issue. If not please let me know further and if there are errors in the log.

1 Like

Thanks for replying.
I did have it set to TV and Limited Input, only had the Hubitat a week.
Deleted the credentials and recreated, and it has this time authenticated.
I shall tinker further.

2 Likes