1 """LCN parent entity class."""
3 from collections.abc
import Callable
11 from .const
import CONF_DOMAIN_DATA, DOMAIN
12 from .helpers
import (
17 get_device_connection,
23 """Parent class for all entities associated with the LCN component."""
25 _attr_should_poll =
False
26 device_connection: DeviceConnectionType
31 config_entry: ConfigEntry,
33 """Initialize the LCN device."""
36 self.address: AddressType = config[CONF_ADDRESS]
38 self._name: str = config[CONF_NAME]
42 """Return a unique ID."""
49 """Return device specific attributes."""
50 address = f
"{'g' if self.address[2] else 'm'}{self.address[0]:03d}{self.address[1]:03d}"
53 f
" ({get_device_model(self.config[CONF_DOMAIN], self.config[CONF_DOMAIN_DATA])})"
58 name=f
"{address}.{self.config[CONF_RESOURCE]}",
60 manufacturer=
"Issendorff",
70 """Run when entity about to be added to hass."""
80 """Run when entity will be removed from hass."""
86 """Return the name of the device."""
90 """Set state/value when LCN input object (command) is received."""
None async_will_remove_from_hass(self)
None input_received(self, InputType input_obj)
None __init__(self, ConfigType config, ConfigEntry config_entry)
None async_added_to_hass(self)
DeviceInfo|None device_info(self)
DeviceConnectionType get_device_connection(HomeAssistant hass, AddressType address, ConfigEntry config_entry)
def generate_unique_id(device, metric)