📆 Calendar Notifications & Actions

Thanks for this great blueprint :clap:
Just little feature request which I added to your code

1 Like

@Blacky was kind enough to send me detailled instructions as I am not the world’s best programmer (in fact very far from it :slight_smile: ), I noticed that he uses all day events and I had been looking for time-specific events as triggers.
.
I have been using my own construction based on all-day events, so I am not sure that I need this blueprint.
.
This is my own construction:
I created 20 sub-calendars in my Google Calendar: several with different wake-up times (6:30 am, 8 am and one that I named wake-up once), cleaning lady day, club meeting, trips etc.
.
On the days that I want HA to trigger an automation, in my Google Calendar I create an all-day event with the specific sub-calendar. Example: I have a Friday weekly all-day event named Susan with sub calendar cleaning lady. It happens that she asks to change the day and then for that week I move he event to, let’s say, Thursday.
.
My wife’s work is almost always Monday to Friday, so her wake-up event is entered accordingly in the Google Calendar, with the specific sub-calendar. I have a reminder in the Google Calendar on the weekend to make any changes needed for the following week. As an example, next week Monday is a holiday, so I need to delete her wake-up entry for that day.
.
All these calendars show up as entities in HA.
.
For the wake-up automations I first created 2 scripts, one for my wife’s wake-up (lights on, curtains open, Alexa announcements) and one for myself (as I usually get up earlier, only blue lights so as not to wake up my wife).
As there are different wake-up automations, I do not need to repeat the actions and just use one of the scripts.
.
As trigger I select one of the calendars, let’s use the example of wake-up SB 6:30 am:


As these are all-day events, meaning the event starts at midnight, I entered 6:30 off-set (after).
.
For action I use the relevant script that I created earlier.
.
Because we sometimes wake up at a non-regular time, I also have a calendar wake-up once and for that I will have to set the off-set every time it is needed, but I can use the existing script.
.
For other calendars, like cleaning lady day and trips I do not need a script and have specific actions for each.
.
I am not, in the slightest, claiming that my construction is better than @Blacky 's. In fact, his Blueprint is way more sophisticated and detailled. But with the use of all-day events, my construction works for me and is an alternative.

@EndUser

You don’t have to use all day events you can just set a time with no offset and it will trigger on time. I see you have also PM me so I will reply to you there.

Blacky :smiley:

1 Like

Hey @Blacky first of all great work on that bluieprint. It is awesome and works perfectly with Google Calendar.

I hope you can help me refine my setup. I use a calendar for the pickup of the waste bins (calendar is prepared by our municipality and i just import it into Google Calendar once a year).

I got everything working fine and receive a notoficatipon one day before pickup at 4pm. Great.

Now they include the info about which of the bins is to be picked up in the “message attribute” like this:

message: Bioabfall
all_day: true
start_time: 2024-01-17 00:00:00
end_time: 2024-01-18 00:00:00

How can I get this “message” into my notification? I tried this in the “Start Notify Message” but it does not work:

Morgen wird {{ trigger.calendar_event.message }} abgeholt

Thanks
Rick

@rickgardner077

Hi Rick,

I don’t use google calendar so I can’t test or see what is going on but you could try this

{{ trigger.event.data.summary }}

or

{{ trigger.event.data.description }}

EDIT: These are the HA calendar triggers you can use Click Here. If someone has found the way to add your data from a Google Calendar into the message then please jump in and let us know.

Let us know if this works.

Blacky :smiley:

I have a simple solution for you.
In your Google Calendar, create another calendar Abfall (Garbage Pickup in my example)

(*)

and then that calendar will automatically show up in HA (afer 15 minutes or after a reload of the Google Calendar Integration).
When you upload that yearly garbage schedule, do that in the Garbage Pickup calendar as a all-day event, and voila !! Now you can create the desired automation with the Garbage Pickup calendar as trigger, using the appropriate time offset.

(*) In this example Casa Aventura is the Google Calendar used for the HA Integration and the Garbage Pickup calendar is basically a sub-calendar that will show automatically in HA.

hi blacky,

First of all, thank you very much for your blueprints. - they help people like me a lot who aren’t quite good at juggling code yet.

I am currently using the blueprint for my garbage collection. - Now that I’ve finally figured out where to find the action buttons, the whole thing is a bit too fiddly for me. At least it often happens to me that the whole notification is gone. Unfortunately, from this moment on, I’m stuck in an automation process that I can no longer complete in a meaningful way.

alias: MĂźllerinnerung
description: ""
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.mullabfuhr
    calendar_trigger: RestmĂźll
    start_calendar_offset:
      hours: -8
      minutes: 0
      seconds: 0
      days: 0
    include_start_notify: enable_start_notify_options
    start_notify_device:
      - d0a474exxxx709f02091axxxa339bbe0
      - 31a9561xxxx26464a7xxx9a3bf9c6d37
    start_message: Bitte die schwarze Mülltonne an die Straße bringen.
    start_title: "MĂźllmann sagt:"
    include_start_action_buttons:
      - enable_start_action_button_2
    start_action_button_2: Erledigt!
    start_time_delay:
      hours: 3
      minutes: 0
      seconds: 0
    include_start_action_button_confirmation: enable_start_action_button_confirmation
    start_action_button_confirmation_title: "MĂźllmann sagt:"
    start_action_button_confirmation_message: Mülltonne steht an der Straße.
    start_time_delay_confirmation_message: Mülltonne muss noch immer an die Straße!
    include_start_auto_actions:
      - enable_start_action_1
    start_action_1:
      - repeat:
          sequence:
            - service: tts.cloud_say
              metadata: {}
              data:
                cache: false
                entity_id: media_player.flur_homepod
                message: Bitte die schwarze Tonne an die Straße stellen!
                language: de-DE
            - delay:
                hours: 0
                minutes: 30
                seconds: 0
                milliseconds: 0
          until:
            - condition: state
              state: "on"
              entity_id: input_boolean.mull_restmull_an_der_strasse
    start_action_2:
      - service: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.mull_restmull_an_der_strasse
    include_end_notify: disable_end_notify_options
    include_end_action_buttons: []
    end_time_delay:
      hours: 0
      minutes: 0
      seconds: 0
    include_end_auto_actions:
      - enable_end_action_1
    end_action_1:
      - service: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.restmull_morgen

So I trigger 8 hours before the calendar event and notify myself and my friends on my cell phone first. If one of the two of us uses the button to indicate that he has taken the bin to the street, everything is done.

If this doesn’t happen, after three hours the HomePod should ask the hallway to take the bin out to the street every 30 minutes. - and that until that happened.

So I can’t choose any auto action because I want to keep annoying myself until the garbage can is actually on the street.
But if I have lost or closed the notification, what is the most user-friendly alternative to the action button? Is it possible to use an input_bool as an alternative? That could be “everything” without me even having to pick up my cell phone when the HomePod and my wife are screaming at me.

In the future, I can also imagine that the “Bin at the street” entity will be switched, for example, by a device tracker attached to the garbage can.

Do you understand what I mean, or am I still so clueless that I just don’t recognize the obvious solutions yet?

Of course, everyone else can help me too - thank you in advance.

Alex

It will send you a reminder once but not every 30 min and currently there are no action buttons for the reminder. So it is best to then call a script in the action.

In your actions you will need to call service / and script turn on. So when it times out after 30 min after doing nothing the action happens and then calls your script annoying you until it is done.

The script / blueprint I recommend for this is below. It is nicely done, easy to follow and the developer @samuelthng supports it to date if you have any questions regarding his blueprint. Link is below.

Hope this helps you.

Blacky :smiley:

2 Likes

what about adding data to notification service? So iOS sticky does not work, but critical: works, could be nice to add these

@Trilis29

Thanks for your suggestions, we will add this to the list.

Blacky :smiley:

Thank you so much for sharing this blueprint, I’m still learning and this is so helpful!

I’m struggling to get one of my notifications to work… I set up a reminder for every birthday. It works great, except when there is more than one birthday on a day… they are separate calendar entries, but I only get one notification. I’m sure it’s user error, just can’t figure out what I’m doing wrong.

@VT_HomeAssistant

Firstly welcome to the community.

Thanks for the heads up. I will need to look into this as I can see what you are saying. I have put this on my list to do.

Blacky :smiley:

Thanks for this blueprint, it helped me a lot!
I want to close the notification when I press an action. Is there a way to add a tag to the notification? So I can send a “clear_notification” as an action on the button?

The cancel button also doesn’t seem to close the notification, but possibly I’m doing something wrong.

I use IOS. so the cancel is there for that.

This is the information in the docs for Android.
When a notification is cleared Android will notify the Companion app of the event. A notification is considered cleared if you either manually swipe it away from the notification status bar or if you click on the Clear All button.

Blacky :smiley:

I saw that also on the documentation, but that didn’t look correct.
On Android it can be cleared with a tag. I made an example that clears the notification after 30 seconds (But in my case I would perform that as an action when the button is pressed).

alias: Notification Test
description: “”
trigger:
condition:
action:

  • service: notify.mobile_app_home_samsung_s21
    metadata: {}
    data:
    title: Test
    message: Test notification
    data:
    tag: testnotificatie
    actions:
    - action: URI
    title: Open Url
    uri: https://google.com
  • delay:
    hours: 0
    minutes: 0
    seconds: 30
    milliseconds: 0
  • service: notify.mobile_app_home_samsung_s21
    metadata: {}
    data:
    message: clear_notification
    data:
    tag: testnotificatie
    mode: single

So for it to work on Android, the cancel-button would have to send the clear_notification - message with the tag (or just be invisible so one of the action buttons can be setup for it).

Thank you for this incredible blueprint!

Is there a way I can configure this to send me a notification for each event on that particular day, at a particular time?
For example, let’s say I have 3 events today and at 10h00 I would receive 3 different notifications, or even a single notification with all relevant information.

Thanks!

Thanks for this information I will look into it.

Blacky :smiley:

Hi Ricardo, welcome to the community.

Yes you can do this. It is really up to you if you would like to use key word or on every calendar event. If you use key word you can have one automation an you may choose your key word to be @notifications and use the same key word in the events you would like to be notified of or you can use multiple automation and or different key words it is totally up to you.

Please note that I do have an item on my list to look at calendar events at the same time only sending the first event. So for now you may have to adjust the time of the events to be slightly different.

Blacky :smiley:

Can you add a trigger key word option is similar to “don’t use key word” but will trigger on ANY word EXCEPT a string I specify? Basically “Always trigger except for “key word” in calendar”.

My use case: Fantastical for Mac leaves events on my calendar that are “cancelled”. They show up as “Cancelled:”. I want your automation to trigger in ALL events EXCEPT for the ones that start with “Cancelled:” in them.

Thank you!

@DuckDuck25

Have you tried using the global conditions. In a template maybe something like this.

{{ is_state_attr('calendar.YOUR_CALENDAR_ENTITY_ID', 'description', 'Cancelled:') }}

Blacky :smiley: