Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the To-do integration."""
2 
3 from __future__ import annotations
4 
5 from enum import IntFlag, StrEnum
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 TodoListEntity
14 
15 DOMAIN = "todo"
16 DATA_COMPONENT: HassKey[EntityComponent[TodoListEntity]] = HassKey(DOMAIN)
17 
18 ATTR_DUE = "due"
19 ATTR_DUE_DATE = "due_date"
20 ATTR_DUE_DATETIME = "due_datetime"
21 ATTR_DESCRIPTION = "description"
22 ATTR_ITEM = "item"
23 ATTR_RENAME = "rename"
24 ATTR_STATUS = "status"
25 
26 
27 class TodoServices(StrEnum):
28  """Services for the To-do integration."""
29 
30  ADD_ITEM = "add_item"
31  UPDATE_ITEM = "update_item"
32  REMOVE_ITEM = "remove_item"
33  GET_ITEMS = "get_items"
34  REMOVE_COMPLETED_ITEMS = "remove_completed_items"
35 
36 
37 class TodoListEntityFeature(IntFlag):
38  """Supported features of the To-do List entity."""
39 
40  CREATE_TODO_ITEM = 1
41  DELETE_TODO_ITEM = 2
42  UPDATE_TODO_ITEM = 4
43  MOVE_TODO_ITEM = 8
44  SET_DUE_DATE_ON_ITEM = 16
45  SET_DUE_DATETIME_ON_ITEM = 32
46  SET_DESCRIPTION_ON_ITEM = 64
47 
48 
49 class TodoItemStatus(StrEnum):
50  """Status or confirmation of a To-do List Item.
51 
52  This is a subset of the statuses supported in rfc5545.
53  """
54 
55  NEEDS_ACTION = "needs_action"
56  COMPLETED = "completed"