Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for calendar components."""
2 
3 from __future__ import annotations
4 
5 from enum import IntFlag
6 from typing import TYPE_CHECKING
7 
8 from homeassistant.util.hass_dict import HassKey
9 
10 if TYPE_CHECKING:
11  from homeassistant.helpers.entity_component import EntityComponent
12 
13  from . import CalendarEntity
14 
15 DOMAIN = "calendar"
16 DATA_COMPONENT: HassKey[EntityComponent[CalendarEntity]] = HassKey(DOMAIN)
17 
18 CONF_EVENT = "event"
19 
20 
21 class CalendarEntityFeature(IntFlag):
22  """Supported features of the calendar entity."""
23 
24  CREATE_EVENT = 1
25  DELETE_EVENT = 2
26  UPDATE_EVENT = 4
27 
28 
29 # rfc5545 fields
30 EVENT_UID = "uid"
31 EVENT_START = "dtstart"
32 EVENT_END = "dtend"
33 EVENT_SUMMARY = "summary"
34 EVENT_DESCRIPTION = "description"
35 EVENT_LOCATION = "location"
36 EVENT_RECURRENCE_ID = "recurrence_id"
37 EVENT_RECURRENCE_RANGE = "recurrence_range"
38 EVENT_RRULE = "rrule"
39 
40 # Service call fields
41 EVENT_START_DATE = "start_date"
42 EVENT_END_DATE = "end_date"
43 EVENT_START_DATETIME = "start_date_time"
44 EVENT_END_DATETIME = "end_date_time"
45 EVENT_IN = "in"
46 EVENT_IN_DAYS = "days"
47 EVENT_IN_WEEKS = "weeks"
48 EVENT_TIME_FIELDS = {
49  EVENT_START_DATE,
50  EVENT_END_DATE,
51  EVENT_START_DATETIME,
52  EVENT_END_DATETIME,
53  EVENT_IN,
54 }
55 EVENT_TYPES = "event_types"
56 EVENT_DURATION = "duration"
57 
58 # Fields for the list events service
59 LIST_EVENT_FIELDS = {
60  "start",
61  "end",
62  EVENT_SUMMARY,
63  EVENT_DESCRIPTION,
64  EVENT_LOCATION,
65 }