I want to use my family calendar (Proton Calendar ICS, already added to Home Assistant, containing lots of events) to fill (at the moment) three date/time helpers related to garbage collection:
GFT (organic waste)
Restafval (residual waste)
Oud papier (paper and cardboard)
Additional info:
Each type of garbage has their own all-day event in the calendar starting with its name.
Each date/time helper should always contain a date in the future, unless this type of garbage is also collected today.
I’ve been looking through topics related to calendar.getitems and tried multiple AI buddies, but I was unable to get to a work solution. I’ve unsuccesfully tried automations, helpers and templates in numerous combinations. I’ve never been able to end up with a helper containing a date. I don’t understand why this is so hard for me, and I’m hoping a guru here has a simple solution for me to implement this.
I’ve noticed there are garbage related HACS add-ons, but I want to create helpers related to other event types in the future.
Share your automation or template sensor config and we can see where you went wrong.
Also calendar.getitems is not real… the action is calendar.get_events.
LLM bullshit engines are very hallucination-prone when it comes to HA; they make up actions, mix and match configuration syntax, fail to use proper indentation, and use template function that aren’t available in HA. Unless you are using very specific, strict, and detailed prompts with clear context you are just wasting your own time.
Thanks for getting back to me. I meant calendar.get_events; I think my brain has melted trying to piece this together.
Using an AI for this was indeed clearly a mistake. I’ve discarded everthing I had because it was either non-functioning, or complete garbage to begin with.
Frankly, I’m not even sure which tools to use for this (in my eyes, simple) use case:
Automations
Input helpers
Templates
A combination of these?
Could you perhaps point me in the right direction?
An Automation that saves the values to Input Datetime helpers.
Trigger-based Template sensors.
The main difference will be that using Input datetimes makes it easier to manually change the value, if you want to be able to do that, without any extra steps. Either of these options require templating to extract and evaluate the data that is returned by calendar.get_events. You will need some information:
Which of the options you want to use. If you choose to use the Input datetime helpers, you’ll need their entity IDs.
The entity ID of the calendar.
The values and fields you use to identify the garbage collection types.
Do you use the calendar event’s summary/message or it’s description?
What is the longest span between collections of a single type?
If “Oud papier” is only collected once every two weeks, then you’ll need to get events at least that far out.
Excellent questions. I totally forgot that the paper/cardboard pickup schedule is different from the rest (sometimes > 30 days between pickups). I chose 40 days as a safe value.
Okay, I would adjust the calendar.get_events action a little… it won’t change how it works with the 5am trigger but, if needed, it will let you add other triggers without having to make changes to cover edge cases.
I would then use a Repeat for Each to handle getting the specific events and setting the value to the Helpers:
In the above, I assume you are using a date-only Input Datetime Helper, if you are using one that has both date and time, you will need to add a time value like time: "00:00:00" in the data section.
I guess because not all garbage types have an event yet (?), which is a realistic scenario at the end of the year. How would error handling work (e.g. writing a date like 01-01-1970 or ignore the missing dates/events)?