1 """Representation of Idasen Desk buttons."""
3 from collections.abc
import Callable, Coroutine
4 from dataclasses
import dataclass
6 from typing
import Any, Final
15 from .
import DeskData, IdasenDeskCoordinator
16 from .const
import DOMAIN
18 _LOGGER = logging.getLogger(__name__)
21 @dataclass(frozen=True, kw_only=True)
23 """Class to describe a IdasenDesk button entity."""
25 press_action: Callable[
26 [IdasenDeskCoordinator], Callable[[], Coroutine[Any, Any, Any]]
33 translation_key=
"connect",
34 entity_category=EntityCategory.CONFIG,
35 press_action=
lambda coordinator: coordinator.async_connect,
39 translation_key=
"disconnect",
40 entity_category=EntityCategory.CONFIG,
41 press_action=
lambda coordinator: coordinator.async_disconnect,
49 async_add_entities: AddEntitiesCallback,
51 """Set buttons for device."""
52 data: DeskData = hass.data[DOMAIN][entry.entry_id]
60 """Defines a IdasenDesk button."""
62 entity_description: IdasenDeskButtonDescription
63 _attr_has_entity_name =
True
68 device_info: DeviceInfo,
69 coordinator: IdasenDeskCoordinator,
70 description: IdasenDeskButtonDescription,
72 """Initialize the IdasenDesk button entity."""
81 """Triggers the IdasenDesk button press service."""