Thanks for that find.
I have something set up, so let’s wait until Wednesday morning to see if it works!
Thanks for that find.
I have something set up, so let’s wait until Wednesday morning to see if it works!
Yup, got the notification this morning as expected. Thanks for the pointers.
That is good to hear. Thanks for posting your success
Can you share your solution? Thx!
I’m just about to embark on creating a similar automation - albeit with an ‘all-day’ event rather than a specific timed calendar entry.
Did your automation prove itself over time? as @Gladz0r also requests, is there any chance we could review your automation? Your leg-work could prove helpful
Ok, hopefully this’ll help. I have configured the google component and added entry in google_calendars.yaml:
- cal_id: ************
entities:
- device_id: clarinet
name: Clarinet
track: true
search: clarinet
This creates a sensor called Clarinet that has a start_time and an end_time attribute showing when the next event on that calendar that matches the search term is.
I then create an automation that runs at a specific time in the morning (7:45) that checks if the start_time is today, I know that this particular event will only be during the daytime, so will be in less than 43200 seconds (12 hours) but also after now (I had a few false triggers before adding this).
My action here is to announce at breakfast time to remember to take the clarinet that day.
alias: 'Clarinet Today'
trigger:
- platform: time
at: '07:45:00'
condition:
- condition: template
value_template: "{{ ((as_timestamp(states.calendar.clarinet.attributes.start_time) - as_timestamp(now())) < 43200) and ((as_timestamp(states.calendar.clarinet.attributes.start_time) - as_timestamp(now())) > 0) }}"
action:
- service: media_player.alexa_tts
data: {"entity_id": "media_player.dot", "message":"It looks like today is clarinet day"}
Hi everyone. I know this topic has already been solved, but as of June 2021 (Probably before this date), this is really easy to set up in the UI so I wanted to share it here in case someone needs help in the future.
In the UI for Automations, I set up a trigger when the state of my calendar is on. Next, under Conditions, select State, then the calendar entity that your event is created under. I just typed in “cal” & all of my options showed up. For the optional Attribute, I selected Message & for State I wrote the name of my event (i.e. School Day).
The Message tells HA that you are searching for an event with the name. The field for the state shows HA what to search for. I shared an example picture below. I hope this helps.
Thanks for the post…
Have you tried a condition set by any other Attribute? I have set my attribute to Description and my state is a single work (or phrase) and HA does not seem to be catching it. Only catching the Message attribute.
Would anyone have ideas?
I have not tried any other attributes other than the message, so I will not be of much use here. I’ll admit that it took me a while of trial & error to figure it out above. It helped me to use the Developer Tools tab & search for the calendar there. It will show you what sorts of attributes HA is reading from the calendar event, & maybe that can help point you in the right direction for what to try.
@atv Hmm, I’m not sure. This is probably where understanding the code would make this easier, but I never did figure out how to make this automation work without the UI. Have you already given this a try? If not, I would try it. My post above was just the first thing I tried that got the automation to run successfully, but it’s not to say that other variations won’t work.
What I know is that when I checked my calendar under the Developed Tools I noticed the message section had the “School Day” message, so I tried what I could to work that in. If I remember correctly, the trigger did not work for me without this condition being set the way it is shown.
I hope this could help some. Maybe someone else has a better answer.
I think i remember it reading somewhere the way you did it as well, i’m sure it’s correct. I have an appointment setup this afternoon so i’ll know soon. Thanks again.
why does this not trigger ?
alias: Glue værksteds dør kalender åbner døren
description: ""
trigger:
- platform: calendar
event: start
offset: "-0:0:0"
entity_id: calendar.faelles_kalender
condition:
- condition: state
entity_id: calendar.faelles_kalender
attribute: message
state: åbendør
action:
- service: script.glue_varkstedsdoren
data: {}
- service: notify.mobile_app_rhmobil
data:
message: Døren er åbnet via. kalenderen.
mode: restart
What’s that condition for?
It should only trigger when the calendar appointment include the word <åbendør>
Did you have another calendar event overlapping at the same time?
See examples here Calendar - Home Assistant
I would suggest using trigger data instead of the entity state
no i dont have
I have now created a spec. calendar in googlecalendar.yaml and it seems to work.
I thought I could do it from UI
Yes you can do this via conditions in the trigger data as described in the example automations Calendar - Home Assistant
(Search can’t handle overlapping events and has caveats and doesn’t work on all calendars so I don’t recommend it generally, but glad you have a solution)