1 """Representation of a doorlock."""
3 from __future__
import annotations
7 from zwave_me_ws
import ZWaveMeData
15 from .const
import DOMAIN, ZWaveMePlatform
16 from .entity
import ZWaveMeEntity
18 DEVICE_NAME = ZWaveMePlatform.LOCK
23 config_entry: ConfigEntry,
24 async_add_entities: AddEntitiesCallback,
26 """Set up the lock platform."""
30 """Add a new device."""
31 controller = hass.data[DOMAIN][config_entry.entry_id]
40 config_entry.async_on_unload(
42 hass, f
"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
48 """Representation of a ZWaveMe lock."""
52 """Return the state of the lock."""
53 return self.
devicedevice.level ==
"close"
55 def unlock(self, **kwargs: Any) ->
None:
56 """Send command to unlock the lock."""
57 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"open")
59 def lock(self, **kwargs: Any) ->
None:
60 """Send command to lock the lock."""
61 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"close")
None lock(self, **Any kwargs)
None unlock(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
def add_new_device(new_device)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)