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

That's actually what I have done. It also has the advantage of not cluttering up my regular calendar (particularly if I have full day events spanning multiple days).

2 Likes

Incredible upgrade documentation @ritchierich. I upgraded both my HE's without a single issue. Thanks for the great work, and the great app too.

2 Likes

Another big update to this app was just uploaded to Github and HPM updated too.

  • Added ability to dynamically control a defined list of switches from text within the Google Calendar event, task and reminder. For example: 'Turn off bedroom fan and turn on bedroom overhead lights, bedroom lamps, and bedroom tv' to turn off and on several switches
    • You will find a new toggle under Additional Action Preferences for this
    • You will find instructions within the app to explain how to use this feature
    • Basically you set a list of switches that you would want to control via dynamic text and then in your Calendar Events, Reminders, or Tasks you can use text to describe the switches you wish to toggle. The app will match the name to your switch list and perform those actions.
    • The Notification feature added in v3.1 can also include the match switches
    • At the very top of the child GCal Search Trigger apps you will find details on which switches matched and whether they will turn on and off.
    • Descriptive text logging can also be enabled so you can track these too.
    • With this feature the linked task and reminder will automatically be marked completed
  • Added description text logging to child GCal switch - @rakeshg you had asked about this this last year and finally got it added.
  • Additional error handling if OAuth hasn't been enabled on the parent GCal Search app
  • Added ability to rename the parent GCal Search app in case multiple instances of this app are installed for different Google accounts - @phrankc
3 Likes

Tks for keeping grooming and improving this app, Ritch!

Maybe you can give me some tip on some work around I am trying here. Imagine the following:

-You have recurring tasks / reminders, let's say, do the dishes. This is a repeating daily reminder.
-Imagine you missed doing it for a few days. When you finally do it (and therefore toggle the linked switch to signalize that) the switch will be toggled but immediately be toggled back because there are pending reminders from previous days.

In this scenario, if you haven't done the dishes the last few days and today you do them all, it doesn't make sense to have the same task showing up multiple times to compensate missed reminders.

I am trying to tweak this by updating the UpdateTask function in the Driver Code with the following:
-1. Mark the task as done and pool the switch (as done today)
-2. Check if the new state of the switch has a reminder attached to it, if so, repeat #1.

I tried to solve #2 by simply trying to recursively calling UpdateTask again, but I got stuck in an infinite loop, it seems that the TaskID is not being updated with what supposed to be the following task/reminder.

What do you suggest to be the easiest way to fix this?

You are using reminders now right and not tasks?

So you want the complete to mark all past reminders with the same title complete?

I just setup a few daily reminders to test. It won’t let me start one in the past so will need a few days to see how this works.

1 Like

Yes, mark all pending reminders with that title as done until the present date.

I believe you could also reproduce the behavior by creating multiple reminders in the same day, all of them with the same title and slightly different start times.

1 Like

@maxnet21 I just uploaded v3.2.1 that should address this use case. Please let me know the results of your testing.

1 Like

@maxnet21 I thought about an edge case and uploaded v3.2.2 to address it. I did a little more testing and reminders have an attribute named recurrenceId which will be the same across multiple days of repeating reminders. Basically I added logic to ensure the task ID's that are matched have the same ID and also ensure that the due date is less than the current time when the search trigger runs either by schedule or if you click Refresh.

I ran a test where I set the search range of the app to end of next day and it was also completing tomorrow's occurrence of the reminder. With the new change, today's and any past reminders will be completed and then tomorrow's will be matched but the switch will be turned off with a scheduled job to turn it on tomorrow.

1 Like

Cool that you spot this!
I am updating the code now! Tks a lot!

I assume I just need to update the Driver code and can keep using the devices and apps I created, right?

Changes to all 3 - parent and child app and driver. Just code updates and it won't affect your current setup other than fix the issue.

If you aren't using HPM you should consider it as it makes updating them so much easier.

1 Like

I'm not entirely sure how to add a second instance of the app. I set up a separate instance, but get this error when adding a new search:

I just installed another copy of the app on my dev hub with no issues. I have seen that error once when I was updating the parent GCal Search app and not the child GCal Search Trigger app. Make sure both are on the latest v3.2.2 version and when on the GCal Search Trigger app click Save at the top as it resyncs with the parent app again - that was how I resolved this issue before.

After a lot of clicking, deleting, reinstalling, and more clicking, I was able to get the second instance up and running. (Don't ask me to reproduce those steps.)

1 Like

I appreciate help from those in the know on GCal Search:
After working on this most of today I believe I am back up and running from an upgrade that went south. I had the 'Authorization Error, Error 400 redirect_uri_mismatch'. Could not sort it out, deleted, and basically started over. which included another update to 3.2.2. Anyway, I believe we are 100% now. I use two Child GCal Search Triggers: Flag Half Staff and Flag Back Up. The app runs about 0500 hr, reads my Google calendar and see's an event at 0700 let's say, called "Flag Half Staff" and another event at 1700 hrs called "Flag Back Up". So each of the triggers are "set" for the day and when 0700 hrs comes, a virtual GCal switch called "Flag Half Staff Switch" is triggered and through Rule Machine the flag lowers. The same thing happens in reverse at 1700 hrs and the flag is raised. So once the calendar is read at 0500 hrs, and events are "set" for later, is there a way to have visibility on whether the system is "set" for a future trigger that day?

Sorry to hear about a botched upgrade. I spent a ton of time testing various upgrade scenarios and added tons of error handling in the code. If you have any suggested instructional or error handling suggestions please let me know. That redirect error means the setting in your Google credential wasn’t matching what the app is using. The Google API side is so manual and error prone I wish I could automate it, unfortunately not an option. This will hopefully be the last time we need to touch it for a long while.

V3.x provides visibility of the matched event at the top of the search trigger child app. Details of its title, dates, etc are below the Pause button. In the middle is the last time the app queried for events and there is also a refresh button to invoke a manual check.

Is this what you are looking for? Otherwise you could expose the switch attributes on a dashboard tile.

Yes, OUTSTANDING!!! Thank you so much. I love this app! I scheduled a couple events then did a refresh. Here is the result.
Flag Half Staff Refresh

Flag Back Up Refresh

Each event is like pressing a button to raise and lower your garage door, hence the two separate events, one to lower the flag, and one to raise the flag.
So please help me understand "...expose the switch attributes on a dashboard tile". I created a dashboard tile for both switches (Flag Half Staff Switch and Flag Back Up Switch), but those tiles do not change state until the time comes and the system "presses" the appropriate button. Is it possible to have a tile show when the triggers are "set"?

Full disclosure I really don’t use dashboards though it’s my understanding it is possible. Maybe @sburke781 or @bptworld have some thoughts on exposing the eventTitle attribute of the GCal switch on a tile. I am happy to make adjustments to the driver if something can make this easier.

@nfd0800 - From looking at the driver, I expect what you want to do is setup a tile on your dashboard that uses the Attribute Template, then choose the eventStartTime attribute. See how you go, otherwise I can try and get a few screenshots together for you.

1 Like

Hi Michael - I had an all day event scheduled for today but it was not picked up. I was wondering if you could take a look at my set up and see why it was missed?

When I looked at the state variables this morning, they were blank except for lastUpdated (yesterday at 11:55 PM) and switch (off). In the device settings, I pressed "poll" and the settings were updated.

After pressing "poll" on device settings:
image

Thanks!

Any errors in your logs? I can attempt to replicate later today. I have the exact same Holiday setup for my mail notifications and mine picked up Presidents Day though I have mine run daily at 12:30 AM.