📆 Calendar Notifications & Actions

The test was done using an all day event.

Blacky :smiley:

Hey @Blacky

Unfortunately, I can’t really get your blueprint to work. I have an iOS calendar in Home Assistant with imported events provided by our city for waste disposal. I also have a widget for displaying the calendar entries, so Home Assistant can see them.

The idea is that my hallway light will light up in the color of the trash bin to be emptied the day before as an indicator of which trash bin(s) will be emptied tomorrow. However, the automation has never been executed, I suspect it has something to do with the keyword? I use the name of the title instead of the description, as I would have to add it myself for each event.

alias: Gelber Sack Flurlicht
description: Flurspot geht an, wenn der Gelbe Sack am nÀchsten Tag abgeholt wird.
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.abfallkalender
    start_calendar_offset:
      hours: -13
      minutes: 0
      seconds: 0
      days: 0
    calendar_trigger: Gelber
    start_notify_device:
      - aeb08e5a1b3c21bcb3845a6587a3b58c
    global_conditions: []
    include_start_action_buttons: []
    end_action_button_1: Erledigt!
    include_end_action_buttons:
      - enable_end_action_button_1
    start_action_1:
      - service: light.turn_on
        metadata: {}
        data:
          rgb_color:
            - 255
            - 252
            - 65
          brightness_pct: 100
        target:
          entity_id: light.flur
    include_start_auto_actions:
      - enable_start_action_1
    end_action_1:
      - type: turn_off
        device_id: 186b94c750b5bc7b03f3d95be13555fd
        entity_id: 392f4c1b5e0c4ff07b2944401a2a6257
        domain: light

@Maky

Thanks for providing your YAML. There was a lot of YAML that was not getting used so I cleaned it all up. It was mostly the end action. The below YAML will turn ON the light for you at 11 am the day before. In regards to your key word, you can use the title (summary) or description so that is all good :+1:. Just check your keyword ‘Gelber’ note the CAPS ‘G’ as it is case sensitive. Copy and replace (paste) the YAML below into your automation and see if that works and check your keyword. I didn’t check the light colour but I assume it will be Yellow to line up with your keyword.

alias: Gelber Sack Flurlicht
description: Flurspot geht an, wenn der Gelbe Sack am nÀchsten Tag abgeholt wird.
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.abfallkalender
    start_calendar_offset:
      hours: -13
      minutes: 0
      seconds: 0
      days: 0
    calendar_trigger: Gelber
    start_action_1:
      - service: light.turn_on
        metadata: {}
        data:
          rgb_color:
            - 255
            - 252
            - 65
          brightness_pct: 100
        target:
          entity_id: light.flur
    include_start_auto_actions:
      - enable_start_action_1

Let us know how you go or if there are anything I missed.

Blacky :smiley:

Thank you very much for the prompt help and the revised code. With the End Action Button, I wanted to experiment and acknowledge and turn off the light after taking out the trash bin, but I’ll be satisfied once the light starts working properly.

I’ve now tried it with an event I entered myself, unfortunately, the light still does not turn on. I also set the offset to -1, which should start the light an hour before the event begins. I have also used different versions of the keyword and made sure it is spelled the same.

Even when I use the entire title, the light unfortunately remains off. Here is also a picture of the widget displaying the event:
image
I also tried it without any offset, but somehow it still doesn’t work. The light entity is the same one I use to control the light normally. Could the problem possibly be the 24-hour format?

If I should provide more information that might help, just let me know what you need. :slight_smile:

@Maky

I am going to update this blueprint to provide more options in the confirmation message. The YAML below is for the updated version 1.4. Please update the blueprint. You can do that by just clicking on the blue import button above. Once done copy and paste this YAML into your automation replacing all the YAML that is currently there.

I have included your end actions you you will get a message and in the message will be some action buttons. If using IOS then tap message and hold for a second and the buttons will be shown. If you don’t want that then just disable the end notify options.

This is not an all day calendar event. It has times so you need to work from the given times and your offsets. All day calendar event works from 12am to 12am. So for you the -1 would be 17:52. I will show you and set it up for you.

This is an all day calendar event. My calendar is called service and your one is called abfallkalender.

Before you can test it the calendar must be saved for min 15min. If you edit it then you have to wait 15min before you can test it. If you enter in an all day event then you can adjust the offsets in the automation and not effect the calendar event. If you don’t wait 15min after you save / edit the calendar event then it will not work.

The below YAML will turn the light ON to yellow at 11am the day before your calendar event. At 11:00:05am you will get a notification on your device. Please check the device is correct. You then have options to action via action buttons. When you press a button a confirmation message with be sent. If you fail to push a action button then at 8pm you will get a message reminding you to take the bin’s out. Once you get this message your action buttons will not work as it is a final reminder. This was done by setting the ‘End Notify - Time Delay’ to 9 hours, example 11am + 9 hours = 8pm.

alias: Gelber Sack Flurlicht
description: Flurspot geht an, wenn der Gelbe Sack am nÀchsten Tag abgeholt wird.
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.service
    start_calendar_offset:
      hours: -13
      minutes: 0
      seconds: 0
      days: 0
    end_calendar_offset:
      hours: -12
      minutes: -59
      seconds: -55
      days: -1
    calendar_trigger: Gelber
    include_start_auto_actions:
      - enable_start_action_1
    start_action_1:
      - service: light.turn_on
        metadata: {}
        data:
          rgb_color:
            - 255
            - 252
            - 65
          brightness_pct: 100
        target:
          entity_id: light.flur
    include_end_notify: enable_end_notify_options
    end_notify_device:
      - aeb08e5a1b3c21bcb3845a6587a3b58c
    include_end_action_buttons:
      - enable_end_action_button_1
      - enable_end_action_button_2
    end_message: Who is going to take the bins out?
    end_action_button_1: Bins Are Out!
    end_action_button_2: Turn Light OFF!
    end_action_button_stop: Cancel, leave light ON.
    end_time_delay:
      hours: 9
      minutes: 0
      seconds: 0
    include_end_action_button_confirmation: enable_end_action_button_confirmation
    end_action_button_confirmation_title: "{{ trigger.calendar_event.summary }}"
    end_action_button_confirmation_message: Yippee the bins are out!
    end_action_button_2_confirmation_message: Light has been turned OFF!
    end_action_button_stop_confirmation_message: Don't forget to turn the light OFF!
    end_time_delay_confirmation_message: Don't forget, we still need to take the bins out!
    end_action_1:
      - service: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.flur
    end_action_2:
      - service: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: light.flur

Let recap the steps for testing.

  1. Update the blueprint to version 1.4.
  2. Add a calendar event as shown above using your calendar for tomorrow, not for today. This is an all day event. If your calendar event is time based then you need to work out your offset based on the times of your calendar event.
  3. Wait 15 min.
  4. Add the YAML provided here replacing you YAML and click save.
  5. All day event v time based event
    • ALL DAY: If you added your calendar event before 10:45 am then the YAML will work and trigger at 11am. You can adjust the offset if you like to keep testing the automation but don’t edit your all day calendar event. As long as you save the automation before your offset should fire then it will trigger the automation.
    • Time Based: you will have to work out your offsets based on the time of the event. Every time you save / edit your calendar event you must wait 15min before it will work and trigger the automation. You can edit the automation within the 15min but your trigger must be after the 15min from the time you saved the calendar event.
  6. Update / change options and language to suit you.

Let us know how you go.

Blacky :smiley:

New Update 1.4

Upgrade Features :new:

  • Confirmation Message: You can now have a different confirmation messages depending on your actions.

Maintenance :toolbox:

  • Set blueprint to my new layout.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

Thank you very much for providing the new code. I tried it again, as I didn’t wait 15 minutes after entering the event during my test yesterday—I waited only about 2-3 minutes :stuck_out_tongue:

But unfortunately, I still can’t get it to work and I think it might be due to the calendar. I am using the CalDAV integration. It seems to work fine, just maybe not with the blueprint. :frowning:

I followed your instructions since I have a time-based event and not an all-day event, I removed the offset to make testing easier.
I deleted the old automation and created a new one with your code (initially setting the offset to 0), then I created an event in the calendar 30 minutes into the future. For example: Current time 9 am, new appointment at 9:30 am (same day, not an all-day event, no offset). Unfortunately, the automation is not triggered. :frowning:
image

@Maky

That could be the problem :+1:. It 100% works here as I was using that YAML and your keyword all day today testing the new features in the new release. Maybe try using the official HA calendar. Try it with this calendar.

Q: How do I install the Home Assistant Official Calendar as I can’t see one?

A: Please follow these steps Click Here.

I know it works with google calendar. If you are just looking for your rubbish reminder I use the official calendar and I have entered 2 events in once as our bins change every week. Then I just set the repeat interval of 2 weeks. Your key word will probably be the colour of your bin (@yellow) etc so you can control the light colour in the action in different automatons. Below are my calendar events that may help you set it up in the same way.

Maybe try using the official calendar it is really easy to use.

Let us know if this works for you.

Blacky :smiley:

Thank you very much for making your calendar entries available.

It actually works now! So, it was due to the CalDAV integration; with the local calendar, turning on the lighting in the corresponding color worked.

I’ll see if I can somehow import the waste collection calendar into the local HA calendar, which of course saves a lot of time, and if the waste collection shifts due to a holiday, I won’t have to pay extra attention to that. :slight_smile:

Thank you very much for your support.

@Maky

That is good news I am really glad you got it working now :partying_face:

Thanks for testing it with the CalDAV integration and letting us know it doesn’t work with this integration :+1:

Maybe this can be a feature request as I think a lot of people would like this feature. @allenporter is the main developer of this awesome HA calendar. Have a look at this feature request post and maybe jump in to the conversation.

Your welcome

Enjoy

Blacky :smiley:

1 Like

I have the blueprint “Calendar Notifications & Actions” in version 1.4.
I have a linked school holiday calendar in Home Assistant.
I have set the keyword “#ferien” in the blueprint for detection.

My problem is that when an event, for example, Pentecost holidays (all-day), is listed, it does not recognize the entry, but if, for example, Pentecost holidays are listed from 11:00 a.m. to 3:00 p.m., it is recognized and the status is “On”.
So far so correct, but why doesn’t it work for all-day events?
Do I have a misunderstanding, or do I need to enter something else?

Thank you very much for your support.

alias: "Schulferien Erkennung "
description: “”
use_blueprint:
path: Blackshome/calendar-notifications-and-actions.yaml
input:
calendar: calendar.schulferien
calendar_trigger: “#ferien”
start_calendar_offset:
hours: 0
minutes: 0
seconds: 0
days: 0
end_calendar_offset:
hours: 0
minutes: 0
seconds: 0
days: 0
include_calendar_trigger: enable_key_word

@bmause

Looks like your YAML has all the trigger set up but you haven’t set up your notification or action.

Blacky :smiley:

Okay, but it should actually work without the triggers as well.
If the calendar entry lasts for a few hours, it’s recognized correctly, but if the entry is for the whole day, it’s not recognized.
I also didn’t have success with the trigger.
Here’s the screenshot.

@bmause

Okay, let me have a look at it as I always use offsets for all day triggers. Give me a few days as I will runs some tests.

Thanks for your input and I will get back to you.

EDIT: Just looking at the code you need to have select one option for start or end to trigger the automation. They are listed below.

Start
Use The Start Notify Options (Optional)
Use The Start Auto Action Options (Optional)

End
Use The End Notify Options (Optional)
Use The End Auto Action Options (Optional)

All my tests are set up for tonight.

Blacky :smiley:

@bmause

I have tested everything and it all works. You must have enabled at least one option for start or end to trigger the automation otherwise there is no point. It was built this way for performance. Below are the options for the start or end. One must be selected. Example; If your would like it to trigger at the start then one start option must be selected. If you would like it to be triggered at the end then one end option must be selected.

Start
Use The Start Notify Options (Optional)
Use The Start Auto Action Options (Optional)

End
Use The End Notify Options (Optional)
Use The End Auto Action Options (Optional)

Hope this helps you.

Blacky :smiley:

Hello! It seems I cannot find a way to make it work.
I have create an automation, by using your wonderful job, that I only want to send me a mail when there is a match on an event on the calendar.
The automation starts correctly but everytime ends with:

Stopped because an error was encountered at May 17, 2024 at 9:15:00 AM (runtime: 0.05 seconds)
expected dict for dictionary value @ data['data']

( data and time varies, obviously ).
Can you point me to what I’m doing wrong, please ?
Here the blueprint config :

id: '1715029041738'
alias: Notifica rinverdente
description: ''
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.home_calendar
    calendar_trigger: '@rinverdente'
    include_start_action_buttons:
      - enable_start_action_button_1
    include_start_auto_actions:
      - enable_start_action_1
    start_action_1:
      - service: notify.mail
        metadata: {}
        data:
          message: Rinverdente
          title: Ricordarsi rinverdente
          target: [email protected]
          data: 1ml Flortis

Thanks in advance.

Try this.

service: notify.mail
data:
  message: Rinverdente
  title: Ricordarsi rinverdente
  target: [email protected]
  data:
    quantity: 1ml
    product: Flortis

Thanks for your reply.
How I’m supposed to try this ? I mean: I cannot edit the yaml by hand ( unless I modify the file in the shell and restart home assistant ). The “metadata” part seems to be there from the webui configuration ( but I cannt find it ).

Nevermind, I found a way ( on the "edit as yaml " in the config page )
Thx

If you copy and paste your YAML.

id: '1715029041738'
alias: Notifica rinverdente
description: ''
use_blueprint:
  path: Blackshome/calendar-notifications-and-actions.yaml
  input:
    calendar: calendar.home_calendar
    calendar_trigger: '@rinverdente'
    include_start_action_buttons:
      - enable_start_action_button_1
    include_start_auto_actions:
      - enable_start_action_1
    start_action_1:
      - service: notify.mail
        data:
          message: Rinverdente
          title: Ricordarsi rinverdente
          target: [email protected]
          data:
            quantity: 1ml
            product: Flortis

Did it work?

Blacky :smiley:

yes !!! Thanks a million.
This way it works correctly ( well kind of but at least it sends mail ).
So the problem was that “data” should be formatted differently ? ( I haven’t got those values in the mail BTW).