1 """Library for working with CalDAV api."""
9 hass: HomeAssistant, client: caldav.DAVClient, component: str
10 ) -> list[caldav.Calendar]:
11 """Get all calendars that support the specified component."""
13 def _get_calendars() -> list[caldav.Calendar]:
16 for calendar
in client.principal().calendars()
17 if component
in calendar.get_supported_components()
20 return await hass.async_add_executor_job(_get_calendars)
23 def get_attr_value(obj: caldav.CalendarObjectResource, attribute: str) -> str |
None:
24 """Return the value of the CalDav object attribute if defined."""
25 if hasattr(obj, attribute):
26 return getattr(obj, attribute).value
list[caldav.Calendar] async_get_calendars(HomeAssistant hass, caldav.DAVClient client, str component)
str|None get_attr_value(caldav.CalendarObjectResource obj, str attribute)