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

Yes the next time the search trigger executes it will toggle the switch based on calendar events. I manually adjust mine pretty frequently and the once a day trigger will set it back.

1 Like

So upgraded to 2.2 via HPM which worked great.
Seems like my triggers are working although i am seeing the following errors:

app:10172021-06-10 17:29:15.434 errororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 586 (setCacheDuration)
app:10172021-06-10 17:28:53.932 errororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 586 (setCacheDuration)
app:10172021-06-10 17:28:16.194 errororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 586 (setCacheDuration)
app:10172021-06-10 17:25:00.313 errororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 586 (getNextEvents)
app:10172021-06-10 17:20:00.377 errororg.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead on line 586 (getNextEvents)

I am no developer.. but is it ok in Groovy to set variables as null rather than declaring them first?
(I am leaning on coding experience of many years ago :wink:

But these are the only errors I am seeing, and had no memory issues since upgrading. Yet.

Based on the line number, it is complaining about your Search Range setting. Here is an example what is yours for this search trigger instance?

And if you have Number of hours from current time, it uses the preference below where I have 12. So curious that value too if you do have this set as it should be required.

@trevalex I just uploaded v2.2.3 which has additional code to prevent these errors in case the endTimeHours preference is not set for some reason, it will default to end of current day.

1 Like

Love the app! I have played with it for a few days, connected it to a lamp, and it works great as a "do not disturb, I'm in a meeting" indicator for the wife and kid.

I discovered this app because of another use case.

What: I’m thinking to repurpose a Hue bulb and have it turn on at 10 minutes before the end of a meeting on yellow and progress through orange and red over the next 10 minutes and finally blink frantically at the end.

Why: I’ve been WFH for years. There has been an increase in back to back to back meetings and so many inexperienced people in virtual meetings. As a result, it’s too easy to lose track of time when there is an intense discussion or a ton of questions and the meeting ends up running over before i can step in and end the meeting.

Would it be possible to add/modify the following features?

  1. unlump back to back meetings so the offsets can be used per meeting.
  2. have ability to filter out events using "-" or google-search-like commands, e.g. "* -personal -lunch -focus" where those 3 terms would be ignored.

Thank you for the feedback. Glad you are finding this app useful.

Curious your search terms and meeting titles. Are they all generic like “work” thus all events are found which is why you need to filter out?

Regarding the “unlump” how often are you querying the calendar? This will be tricky because the current version sets the start and end scheduled jobs at the same time. In other words if you are querying say every 15 minutes it would set the end time time because an event but start time isn’t reset until after the current event ends. This type of thing would only apply and work for more frequent queries.

Those that need to be filtered out are placeholders, or personal events, or administrative tasks - not actual meetings where I need the "meeting is ending in 10 minutes, wrap it up" indication. They are "busy" on the calendar, but don't need them for do-not-disturb status or warnings that it is about to end. Focus Time is Microsoft's feature to auto schedule/block periods of time on the calendar to focus on work tasks without interruption - email, administrative, phone calls, reading, and such.

Line 331 of your app does have a query (q) option, but a quick look at the api help page doesn't convince me that using google-like searches with "-" would work as expected.

Another thought is to filter by categories. For example, my search could be "*", but only in Category A, C, D, and uncategorized. Or exclude by category - ignore Category B, E. Unfortunately, Outlook to Google loses those categories anyway.

I wonder if a search for "webex.com,zoom.us,teams.microsoft.com" would just give me meetings that have conference info. And then I just discovered a meeting invite for links.quickhelp.com. This could be never ending, but could cover a vast majority of actual meetings. But I can't search the body of events, just the title and location, so that won't work either.

As for unlumping, right now, I'm querying every 30 minutes. I don't mind querying every 15 minutes or whatever your recommend, if it will work.

I figured out a query on Google Calendar with 5 "-" terms that ended up giving me only the events of actual interest. Maybe the q option might work, for me?

@neerav.modi I have uploaded a "beta" version of the GCal Search Trigger code that hopefully addresses the "-" terms. I wanted to get it in your hands to test out if you don't mind. You can access it via this link and just replace your existing GCal Search Trigger app code. It doesn't address the "lumping" of events and I will work on that next. I am traveling the next several days so won't be able to get to it for a bit.

@ritchierich Thanks. Wow! Appears to work quite well. I added additional exclusions to the search for the 2nd meeting tomorrow and the end time adjusted correctly. Excluded the first 3 meetings and the start time was correct.

I did it with * and without * in the search. Both resulted in the same start and end time.

Only feedback so far: I tried using Google-like searches. Using quotes, e.g -"focus time" did not work. The end result in the virtual switch was that everything was blank. Kept it to one word and it worked again.

Take your time. I really appreciate that you were able to do even this so quickly. Your travelling will give me a chance to test and push this more. My schedule for the next couple days is ridiculously packed. Would have been a great test for de-lumping! :laughing:

The exclusions stopped working, I think after midnight. I've tried to exclude the 2nd meeting to test the triggering of the light sequence. Instead of the end time getting set to 9:30 am (9:20 with offset), it's behaving as if the search was just * and the end time is 12:30pm, adjusted to 12:20 pm with offset.

I moved the event matching logic to HE with my version and it’s my code that matches which means I have to account for each of these use cases. I did this because I had many false positives using the Google API to match plus I wanted multiple matches within one search trigger. I won’t be able to replicate everything Google has and allowing an option to use their query logic might be best for you and others that want advance features. I will explore that when I get home.

Can you please provide steps to reproduce? I will need to create similar calendar events with same durations and also an example search string. Thanks!

I will get to this when I get back. Thinking it will only work if you have a periodic query, vs once a day, and you must enter an end time offset so it has time to toggle. I plan to default this to say 30 seconds just in case if you choose to “de-lump”.

Thank you for considering. In the meanwhile, I have done a workaround by categorizing some of the events in Outlook that I don't want in this app and then set the Outlook to Google sync to ignore those categories. Can't categorize all events to be excluded, but currently works for most events for me because I'm already using 3rd party software to do Outlook/Google syncing.

I wish I could. I cleared cache and forced resyncs before I posted last night. However, this morning, it's straightened itself out. I'll keep watching and gather more details if it happens again.

Looking forward to it. You recommend the period, and I'll do it. My plan is 10 minute offset anyway, to trigger the lighting sequence that starts as an end-of-meeting warning and gets more dire closer towards the end time. Then is starts blinking! The sequence worked perfectly this morning. For some reason, it triggered at the end of the meeting instead of the -10 minute offset. Will keep testing - extremely likely user error!

Let me know after you return and then I'll post my findings. Until then, safe and happy travels!

@neerav.modi I have posted another Beta version, this time updates to both the parent and child apps, driver remains the same. You will find a few new settings within the child search triggers to set whether you wish to use Google API for querying and also a preference for sequential events. You can download this version by clicking here.

Please let me know how this works for you. I would also welcome feedback on the instructional text for these new preferences if it makes sense. Thanks!

@ritchierich - quick question. Is there any way to use an existing virtual switch (and change the driver)? I already had a couple of Node-RED flows that were triggered by virtual switches but with this app, it's easier to just create a calendar entry and have them triggered. For now, I just changed the flows to use the new virtual switch but wanted to see if it was possible.

I guess the same would apply if anyone had defined a virtual switch in HE and used that as a trigger.

@rakeshg I looked into this for a bit and I don't believe this is possible or at least I don't know how to do it. Issue is that the GCal Switch driver uses "parent" functions which refer back to the parent app that created the switch that gather the calendar events. When selecting an existing switch there is a link from the app to the child switch but no link from the child switch to the parent app to access these functions. In my testing I was getting errors so unfortunately I don't know how to solve this.

If others know how to link an existing switch to call parent app functions, I am open to ideas and happy to explore more.

2 Likes

Thanks so much for checking this out. It's not a big deal and the app is great as is!

2 Likes

I don't know how to do it, but this would be a great feature to have, if it can be done. In the switch, it would be great to have a button to resync the calendar. Right now we have to go back and forth between the parent and child apps.

Just to be clear, there are 2 apps to update to 2.3.0, and the driver is still at 2.2.3. Correct?

I've updated the apps and will continue playing.

Since I know what the options do, the instructions seem fine. I'll try to comment if it can be simplified for other users.

The beta version for you is v2.3.0 yes and I didn't update the driver yet to the new version but its code didn't change anyway. Once you validate the changes work I will publish v2.3.0 to the main branch and to HPM.

What do you mean by this? Thinking the only work around I have to @rakeshg's request is to allow the toggling of additional switches in the trigger app. So as the GCal Switch toggles, it could toggle a set of other switches too. Thoughts?

1 Like