1 """Support for YoLink Device."""
3 from __future__
import annotations
5 from abc
import abstractmethod
7 from yolink.client_request
import ClientRequest
8 from yolink.exception
import YoLinkAuthFailError, YoLinkClientError
16 from .const
import DOMAIN, MANUFACTURER
17 from .coordinator
import YoLinkCoordinator
21 """YoLink Device Basic Entity."""
23 _attr_has_entity_name =
True
27 config_entry: ConfigEntry,
28 coordinator: YoLinkCoordinator,
30 """Init YoLink Entity."""
36 """Return the device id of the YoLink device."""
37 return self.coordinator.device.device_id
47 data = self.coordinator.data
53 """Return the device info for HA."""
55 identifiers={(DOMAIN, self.coordinator.device.device_id)},
56 manufacturer=MANUFACTURER,
57 model=self.coordinator.device.device_type,
58 model_id=self.coordinator.device.device_model_name,
59 name=self.coordinator.device.device_name,
65 """Parse and update entity state, should be overridden."""
68 """Call device api."""
71 await self.coordinator.device.call_device(request)
72 except YoLinkAuthFailError
as yl_auth_err:
75 except YoLinkClientError
as yl_client_err:
None async_added_to_hass(self)
None __init__(self, ConfigEntry config_entry, YoLinkCoordinator coordinator)
DeviceInfo device_info(self)
None _handle_coordinator_update(self)
None call_device(self, ClientRequest request)
None update_entity_state(self, dict state)