1 """Support for Minut Point."""
11 from .const
import DOMAIN, SIGNAL_UPDATE_ENTITY
13 _LOGGER = logging.getLogger(__name__)
17 """Base Entity used by the sensors."""
19 _attr_should_poll =
False
21 def __init__(self, point_client, device_id, device_class) -> None:
22 """Initialize the entity."""
25 self.
_id_id = device_id
30 device = self.
devicedevice.device
32 connections={(dr.CONNECTION_NETWORK_MAC, device[
"device_mac"])},
33 identifiers={(DOMAIN, device[
"device_id"])},
35 model=f
"Point v{device['hardware_version']}",
36 name=device[
"description"],
37 sw_version=device[
"firmware"][
"installed"],
38 via_device=(DOMAIN, device[
"home"]),
41 self.
_attr_name_attr_name = f
"{self._name} {device_class.capitalize()}"
44 """Return string representation of device."""
45 return f
"MinutPoint {self.name}"
48 """Call when entity is added to hass."""
49 _LOGGER.debug(
"Created device %s", self)
56 """Disconnect dispatcher listener when removed."""
61 """Update the value of the sensor."""
65 """Return true if device is not offline."""
70 """Return the representation of the device."""
75 """Return the id of the device."""
80 """Return status of device."""
81 attrs = self.
devicedevice.device_status
89 """Return true if sensor have been updated."""
94 """Return the last_update time for the device."""
def async_will_remove_from_hass(self)
def _update_callback(self)
_async_unsub_dispatcher_connect
def async_added_to_hass(self)
def extra_state_attributes(self)
None __init__(self, point_client, device_id, device_class)
datetime|None parse_datetime(str|None value)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)
dt.datetime as_local(dt.datetime dattim)