1 """Base entities for the Motionblinds Bluetooth integration."""
5 from motionblindsble.const
import MotionBlindType
6 from motionblindsble.device
import MotionDevice
13 from .const
import CONF_BLIND_TYPE, CONF_MAC_CODE, MANUFACTURER
15 _LOGGER = logging.getLogger(__name__)
19 """Base class for Motionblinds Bluetooth entities."""
21 _attr_has_entity_name =
True
22 _attr_should_poll =
False
31 entity_description: EntityDescription,
32 unique_id_suffix: str |
None =
None,
34 """Initialize the entity."""
35 if unique_id_suffix
is None:
38 self.
_attr_unique_id_attr_unique_id = f
"{entry.data[CONF_ADDRESS]}_{unique_id_suffix}"
43 connections={(CONNECTION_BLUETOOTH, entry.data[CONF_ADDRESS])},
44 manufacturer=MANUFACTURER,
45 model=MotionBlindType[entry.data[CONF_BLIND_TYPE].upper()].value,
46 name=device.display_name,
50 """Update state, called by HA if there is a poll interval and by the service homeassistant.update_entity."""
51 _LOGGER.debug(
"(%s) Updating entity", self.
entryentry.data[CONF_MAC_CODE])
52 await self.
devicedevice.status_query()
None __init__(self, MotionDevice device, ConfigEntry entry, EntityDescription entity_description, str|None unique_id_suffix=None)