mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-27 11:16:28 +00:00
Add update APIs for Calendar Entities (#1590)
This commit is contained in:
parent
3c8bdb422a
commit
f46b511dba
@ -35,6 +35,7 @@ and are combined using the bitwise or (`|`) operator.
|
|||||||
| ------------------- | ------------------------------------------------------------------ |
|
| ------------------- | ------------------------------------------------------------------ |
|
||||||
| `CREATE_EVENT` | Entity implements the methods to allow creation of events. |
|
| `CREATE_EVENT` | Entity implements the methods to allow creation of events. |
|
||||||
| `DELETE_EVENT` | Entity implements the methods to allow deletion of events. |
|
| `DELETE_EVENT` | Entity implements the methods to allow deletion of events. |
|
||||||
|
| `UPDATE_EVENT` | Entity implements the methods to allow update of events. |
|
||||||
|
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
@ -92,6 +93,29 @@ class MyCalendar(CalendarEntity):
|
|||||||
"""Delete an event on the calendar."""
|
"""Delete an event on the calendar."""
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Update Events
|
||||||
|
|
||||||
|
A calendar entity may support deleting events by specifying the `UPDATE_EVENT` supported feature. Integrations that support mutation must support rfc5545 recurring events.
|
||||||
|
|
||||||
|
There are three ways that recurring events may be deleted:
|
||||||
|
- Specifying only the `uid` will update the entire series
|
||||||
|
- Specifying the `uid` and `recurrence_id` will update the specific event instance in the series
|
||||||
|
- Specifying `uid`, `recurrence_id`, and a `recurrence_range` value may update a range of events starting at `recurrence_id`. Currently rfc5545 allows the [range](https://www.rfc-editor.org/rfc/rfc5545#section-3.2.13) value of `THISANDFUTURE`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
class MyCalendar(CalendarEntity):
|
||||||
|
|
||||||
|
async def async_update_event(
|
||||||
|
self,
|
||||||
|
uid: str,
|
||||||
|
event: dict[str, Any],
|
||||||
|
recurrence_id: str | None = None,
|
||||||
|
recurrence_range: str | None = None,
|
||||||
|
) -> None:
|
||||||
|
"""Delete an event on the calendar."""
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## CalendarEvent
|
## CalendarEvent
|
||||||
|
|
||||||
A `CalendarEvent` represents an individual event on a calendar.
|
A `CalendarEvent` represents an individual event on a calendar.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user