1 """The lookin integration entity."""
3 from __future__
import annotations
5 from abc
import abstractmethod
8 from aiolookin
import (
16 from aiolookin.models
import Device, UDPCommandType, UDPEvent
21 from .const
import DOMAIN, MODEL_NAMES
22 from .coordinator
import LookinDataUpdateCoordinator
23 from .models
import LookinData
25 LOGGER = logging.getLogger(__name__)
29 """Convert a lookin device into DeviceInfo."""
31 identifiers={(DOMAIN, lookin_device.id)},
32 name=lookin_device.name,
33 manufacturer=
"LOOKin",
34 model=MODEL_NAMES[lookin_device.model],
35 sw_version=lookin_device.firmware,
36 configuration_url=f
"http://{host}/device",
41 lookin_device: Device, uuid: str, device: Climate | Remote, host: str
44 identifiers={(DOMAIN, uuid)},
46 model=device.device_type,
47 via_device=(DOMAIN, lookin_device.id),
48 configuration_url=f
"http://{host}/data/{uuid}",
53 """A mix in to set lookin attributes for the lookin device."""
56 """Set attrs for the lookin device."""
63 LookinDeviceMixIn, CoordinatorEntity[LookinDataUpdateCoordinator[MeteoSensor]]
65 """A lookin device entity on the device itself that uses the coordinator."""
67 _attr_should_poll =
False
69 def __init__(self, lookin_data: LookinData) ->
None:
70 """Init the lookin device entity."""
71 assert lookin_data.meteo_coordinator
is not None
72 super().
__init__(lookin_data.meteo_coordinator)
75 lookin_data.lookin_device, lookin_data.host
80 """A mix in to set attributes for a lookin entity."""
85 device: Remote | Climate,
86 lookin_data: LookinData,
88 """Set attrs for the device controlled via the lookin device."""
98 CoordinatorEntity[LookinDataUpdateCoordinator[Remote]],
100 """A lookin device entity for an external device that uses the coordinator."""
102 _attr_should_poll =
False
103 _attr_assumed_state =
True
107 coordinator: LookinDataUpdateCoordinator[Remote],
109 device: Remote | Climate,
110 lookin_data: LookinData,
112 """Init the base entity."""
123 """Send command from saved IR device."""
125 uuid=self.
_uuid_uuid, command=command, signal=signal
130 """A Lookin entity that has a power on and power off command."""
134 coordinator: LookinDataUpdateCoordinator[Remote],
136 device: Remote | Climate,
137 lookin_data: LookinData,
139 """Init the power entity."""
140 super().
__init__(coordinator, uuid, device, lookin_data)
150 """A Lookin entity that has a power on and power off command with push updates."""
154 coordinator: LookinDataUpdateCoordinator[Remote],
157 lookin_data: LookinData,
159 """Init the entity."""
160 super().
__init__(coordinator, uuid, device, lookin_data)
166 return self.coordinator.data
170 """Update properties from status."""
173 """Process an update pushed via UDP."""
174 LOGGER.debug(
"Processing push message for %s: %s", self.entity_id, event)
179 """Process an update pushed via UDP."""
180 LOGGER.debug(
"Processing push message for %s: %s", self.entity_id, event)
185 """Call when the entity is added to hass."""
187 self.async_on_remove(
195 self.async_on_remove(
None async_set_updated_data(self, _DataT data)
None _async_send_command(self, str command, str signal="FF")
None __init__(self, LookinDataUpdateCoordinator[Remote] coordinator, str uuid, Remote|Climate device, LookinData lookin_data)
None __init__(self, LookinData lookin_data)
None _set_lookin_device_attrs(self, LookinData lookin_data)
None _set_lookin_entity_attrs(self, str uuid, Remote|Climate device, LookinData lookin_data)
None __init__(self, LookinDataUpdateCoordinator[Remote] coordinator, str uuid, Remote|Climate device, LookinData lookin_data)
None _update_from_status(self, str status)
None _async_push_update(self, UDPEvent event)
None async_added_to_hass(self)
None __init__(self, LookinDataUpdateCoordinator[Remote] coordinator, str uuid, Remote device, LookinData lookin_data)
None _async_push_update_device(self, UDPEvent event)
DeviceInfo _lookin_device_to_device_info(Device lookin_device, str host)
DeviceInfo _lookin_controlled_device_to_device_info(Device lookin_device, str uuid, Climate|Remote device, str host)