I have an automation that turns on external sirens and indoor lights when cctv cameras are activated at night when we are away. One of our children now stays intermittently for work, including when we are away. I want an automation to run so that the nights he stays the sirens will be activated but not the indoor lights.
I have set up a shared calendar in iOS that that he records the nights he stays. I have brought this into home assistant with the Caldav integration. The nights he stays are recorded as all day events.
If I link it to the calendar all day events then the 6 hours after midnight he will be in bed but the calendar will show him as absent if he is not staying that next night
How do I set a condition which covers up to 6 hours after the all day event has finished? I am new to Home assistant and looked at the calendar entity triggers but can’t seem to make this work
A calendar can contain different kinds of all-day events (birthday, holiday, etc). How are you identifying an all-day event for when your son is staying at your home?
Is there something in the title of the scheduled event?
Not sure if this is what you want. It triggers 6 hours after the ‘Bob at home’ all-day event ended.
alias: example
triggers:
- trigger: calendar
event: end
entity_id: calendar.bob_calendar
offset: '06:00:00'
conditions:
- condition: template
value_template: >
{{ trigger.calendar_event.all_day and
'Bob at home' in trigger.calendar_event.summary }}
actions:
... your actions ...
NOTE
When working with Calendar events, you should use the Calendar Trigger to determine when to start, or stop, doing something. You can’t simply write a condition that checks if “Is the current time within 6 hours after some calendar event ended?”
Thanks. Therefore do I set a trigger that activates the automation anytime within 30 hours of the start time of the all day event? Do I do this directly or via template?
I can’t answer that because it’s unclear to me what you are trying to do. Your latest requirement to trigger 30 hours before the event appears to be significantly different than your original requirement.
Can you clarify the requirements?
To be clear, a Calendar Trigger can trigger an automation when a scheduled event starts or ends with an optional time offset (plus or minus). So it can trigger at the start or end of an all-day event, or just before/after the start/end.
Sorry for the confusion. If he is staying the night of the 21st March, between the hours of 22:00 on the 21st and 06:00 on the 22nd March he will be in bed. During those hours I want the automation to run. In the calendar it appears as an all day event on the 21st March with no entry on the 22nd March as he isn’t staying that night.
You should know that the custom of this forum is to apply the Solution tag to the post that answered the question and/or solved the problem. In this case, it would be my post above. However you marked your own post which doesn’t contain any information that would be helpful to others who are looking for answers to similar questions.