Add `DELETE_EVENT` Service to `Calendar` Integration

It is nice to be able to CREATE_EVENT with a service call using the Calendar integration, but I would also like to be able to automate deletion of events as well. I’m imagining a DELETE_EVENT service that would at least be compatible with the relatively new Local Calendar if not also compatible with other calendars.

Either delete or modify the existing event is needed.

1 Like

I can’t believe this is still not a thing 4 years later.

Edit: Sorry, saw “May 17” and assumed it was may of 2017.

This is also relevant for calendar entities, like helpers.

I have read that the feature is implemented and the services just need to be exposed

Where? Can you maybe send a link?

Found this: Calendar Entity | Home Assistant Developer Docs

I think the “just” here is likely relevant. Of course the code to delete calendar entries exists, or we couldn’t delete calendar entries. However, that doesn’t necessarily mean that it is trivial to create a service that can delete by matching to a specific entity that you want it to delete.

Hi. I get that ‘Just’ is a big word here, but it really would flesh out the ability to manipulate HA if it were also made available through the service too. I definitely have use cases where this is needed. and I’ve seen it can be done through the calendar UI. so, +1 to the list of people wanting it.

I think it all depends on the needs.
We have a service that can list events using start date, end date, and duration.
In my case, I need to remove events using start and end dates and add new events.
I get an updated trash day calendar and I want to automate the process.

According to the spec (Calendar entity | Home Assistant Developer Docs) each event has uid, so one could list events, then search for the one that needs to be deleted and remove them one by one.

where could we ask for this feature, I’m not familiar with the process

This thread is the request for this feature. It has 36 votes, you ask for it by voting for this thread, if you haven’t already.

1 Like

Is this something you’ve been able to implement? If so, can you share your code? This is just far enough outside of my grasp that I can’t figure out how to get started.

Sadly not.
I don’t want to manipulate HA internal files.
I’m waiting for Add read-only calendar from url by zeehio · Pull Request #126862 · home-assistant/core · GitHub. This should allow us to create a read-only calendar that will auto-refresh from a given URL.

I’d also like to avoid manipulating internal files. When this is implemented, can you explain the workflow to get around the delete event gap? Would you be creating a temporary calendar with the events to keep and then use an internal URL to overwrite the existing/old calendar? Very curious as I’d love to get around this gap with something that’s built into core.

I imagine that when you set up the new read-only calendar integration, you will have to provide a URL to the ICS file (or an API that generates such a file) and a time interval. Then, the integration will download the ICS file, remove all events from the calendar, and add new ones.

My use case is quite simple: a trash day calendar. The company that takes the trash in my neighborhood publishes PDF files with a calendar for the next two months.
I’ve created an Azure function that parses that PDF and exports the dates as calendars. So when the integration is available I finally won’t have to manually add events to calendars manually.

With a DELETE service, this could be done already.
@allenporter any chance this can be added? I think many users will like the ability to delete a specific event or even clear the entire calendar from events

Hi, please don’t talk folks that aren’t participating Should I tag people

Sorry about that. Won’t happen again

Thank you. To clarify, what type of calendar is the Azure function creating? A simple .ics or into HA? From your description, it seems like the former. Is it hosted somewhere?

Apologies for the multitude of questions. I think your use case is interesting, and this is the closest I’ve come to having a solution.