Hello!
I am hoping for some help with templates I’m working on. One is to detect whether it’s a school night and another to detect if it’s a no school day. I have a calendar with an all day event titled No School. For some reason it is picking up the event from the following day. I appreciate any help anyone can provide.
If I have a no school event for today, No School is on and School Night is on.
If I have a no school event for tomorrow, No School is on and School Night is off.
If I have no no school events, No School is off and School Night is on.
I appreciate you taking time to help me out. I have temporarily changed my trigger to:
- trigger:
- platform: time_pattern
minutes: /1
This allows me to change my calendar and see the results a minute later. I have my iOS calendar linked to home assistant so that I just make changes on my phone and they’re reflected in the calendar right away.
If I have a no school event for only today, No School is on and School Night is on. This is expected
If I have a no school event for only tomorrow, No School is on and School Night is off. This is not expected. I would expect No School to be off since there’s nothing on the calendar for today.
If I have no no school events, No School is off and School Night is on. This is expected
Please let me know if there’s any other information I can provide!
I can’t reproduce what you are seeing, but I don’t use iOS. I’ve tested both HA Local Calendar and Google Calendar and they are returning the expected values for all three cases.
If you run the two services in the the Service tool are the contents of responses what is expected?
I’m seeing a mirror image of what school day & school night logic looks like in my brain. Monday is a school day, Sunday is therefore a school night. Conversely Saturday is a non- school day, thus Friday night is not a school night.
Swapping “no_school_agenda” with “school_night_agenda” in your binary_sensor should yield results reflecting the above logic & satisfy what I surmise you intend.
Looks correct to me. Saturday == No School as I see it. For clarity assume “2024-03-03” has “T00:00:00-…” tacked onto it You are seeing midnight to midnight.
Sorry, the internet went down last night and since it’s a CalDav calendar, it disappeared from home assistant.
I tried to add a no school event to my calendar for today and one for tomorrow.
Then, when I try to run the get events service, it gives me today’s and tomorrow’s event. It does this even if I change the start time to 01:00:00 and end time to 23:00:00. Maybe I just need to add logic to check if the start date is the date that I’m looking for and move on?
I fought with all day events for a long time and gave up for now. I just add entries on a particular calendar at 7am where I look for the description and then take action based on that. I just set them for 15 minutes generally.