Configure Google calendar sensor using the search term Clarinet?
Then in your automation add a condition that checks if it starts today.
Would be the direction I would be checking out
Configure Google calendar sensor using the search term Clarinet?
Then in your automation add a condition that checks if it starts today.
Would be the direction I would be checking out
Thanks… so far so good.
I’ve got a calendar item that shows the next ‘clarinet’ event with a start and end date\time.
I have an automation that runs at 06:30, and I’m now struggling for the logic for a condition to check whether the next event in this calendar is ‘today’.
The entity and attribute I’m after are calendar.clarinet and start_time, it’s format is ‘yyyy-mm-dd hh:mm:ss’, but I can’t see how to compare this to ‘today’.
Any pointers?
If I understand your problem correctly I accomplish this by using the calendar state as a trigger. When the calendar start time is met the state turns to on. The time is triggered from the calendar event.
trigger:
- platform: state
entity_id: calendar.clocktalk_google_1
to: "on"
I don’t think that is what he’s looking for. He wants it to trigger at 6.30 when the clarinet thing is actually later that day.
Yep, you’re right. Since only 1 event at a time is seen in HA, I’m thinking the clarinet thing will need to be in it’s own calendar.
Not necessarily, since he is using a search term.
I found this topic: Google calendar no sensors created
The second post shows an idea for a value template you could perhaps adapt?
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?