1 """Parent class for every Overkiz device."""
3 from __future__
import annotations
5 from typing
import cast
7 from pyoverkiz.enums
import OverkizAttribute, OverkizState
8 from pyoverkiz.models
import Device
14 from .const
import DOMAIN
15 from .coordinator
import OverkizDataUpdateCoordinator
16 from .executor
import OverkizExecutor
20 """Representation of an Overkiz device entity."""
22 _attr_has_entity_name =
True
23 _attr_name: str |
None =
None
26 self, device_url: str, coordinator: OverkizDataUpdateCoordinator
28 """Initialize the device."""
31 split_device_url = self.
device_urldevice_url.split(
"#")
33 if len(split_device_url) == 2:
49 """Return True if device is a sub device."""
54 """Return Overkiz device linked to this entity."""
55 return self.coordinator.data[self.
device_urldevice_url]
58 """Return device registry information for this entity."""
66 identifiers={(DOMAIN, self.
executorexecutor.base_device_url)},
70 self.
executorexecutor.select_attribute(OverkizAttribute.CORE_MANUFACTURER)
71 or self.
executorexecutor.select_state(OverkizState.CORE_MANUFACTURER_NAME)
72 or self.coordinator.client.server.manufacturer
77 OverkizState.CORE_MODEL,
78 OverkizState.CORE_PRODUCT_MODEL_NAME,
79 OverkizState.IO_MODEL,
81 or self.
devicedevice.widget.value
85 self.coordinator.areas[self.
devicedevice.place_oid]
86 if self.coordinator.areas
and self.
devicedevice.place_oid
91 identifiers={(DOMAIN, self.
executorexecutor.base_device_url)},
92 name=self.
devicedevice.label,
93 manufacturer=
str(manufacturer),
97 self.
executorexecutor.select_attribute(OverkizAttribute.CORE_FIRMWARE_REVISION),
99 hw_version=self.
devicedevice.controllable_name,
100 suggested_area=suggested_area,
101 via_device=(DOMAIN, self.
executorexecutor.get_gateway_id()),
102 configuration_url=self.coordinator.client.server.configuration_url,
107 """Representation of a Overkiz device entity based on a description."""
112 coordinator: OverkizDataUpdateCoordinator,
113 description: EntityDescription,
115 """Initialize the device."""
116 super().
__init__(device_url, coordinator)
124 elif isinstance(description.name, str):
None __init__(self, str device_url, OverkizDataUpdateCoordinator coordinator, EntityDescription description)
None __init__(self, str device_url, OverkizDataUpdateCoordinator coordinator)
DeviceInfo generate_device_info(self)