1 """Support for MotionMount sensors."""
5 from typing
import TYPE_CHECKING
15 from .const
import DOMAIN, EMPTY_MAC
17 _LOGGER = logging.getLogger(__name__)
21 """Representation of a MotionMount entity."""
23 _attr_should_poll =
False
24 _attr_has_entity_name =
True
26 def __init__(self, mm: motionmount.MotionMount, config_entry: ConfigEntry) ->
None:
27 """Initialize general MotionMount entity."""
40 manufacturer=
"Vogel's",
41 model=
"MotionMount SIGNATURE Pro",
42 model_id=
"TVM 7675 Pro",
46 self.
_attr_device_info_attr_device_info[ATTR_IDENTIFIERS] = {(DOMAIN, config_entry.entry_id)}
49 (dr.CONNECTION_NETWORK_MAC, mac)
54 """Return True if the MotionMount is available (we're connected)."""
55 return self.
mmmm.is_connected
58 """Update the name of the associated device."""
63 device_registry = dr.async_get(self.
hasshass)
64 device_registry.async_update_device(self.
device_entrydevice_entry.id, name=self.
mmmm.name)
67 """Store register state change callback."""
73 """Remove register state change callback."""
79 """Make sure there is a connection with the MotionMount.
81 Returns false if the connection failed to be ensured.
84 if self.
mmmm.is_connected:
87 await self.
mmmm.connect()
88 except (ConnectionError, TimeoutError, socket.gaierror):
95 _LOGGER.warning(
"Successfully reconnected to MotionMount")
None __init__(self, motionmount.MotionMount mm, ConfigEntry config_entry)
bool _ensure_connected(self)
None async_added_to_hass(self)
None async_will_remove_from_hass(self)
None async_write_ha_state(self)