1 """Representation of a cover."""
3 from __future__
import annotations
17 from .const
import DOMAIN, ZWaveMePlatform
18 from .entity
import ZWaveMeEntity
20 DEVICE_NAME = ZWaveMePlatform.COVER
25 config_entry: ConfigEntry,
26 async_add_entities: AddEntitiesCallback,
28 """Set up the cover platform."""
32 controller = hass.data[DOMAIN][config_entry.entry_id]
41 config_entry.async_on_unload(
43 hass, f
"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
49 """Representation of a ZWaveMe Multilevel Cover."""
51 _attr_supported_features = (
52 CoverEntityFeature.OPEN
53 | CoverEntityFeature.CLOSE
54 | CoverEntityFeature.SET_POSITION
55 | CoverEntityFeature.STOP
60 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"exact?level=0")
64 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"exact?level=99")
67 """Update the current value."""
68 value = kwargs[ATTR_POSITION]
69 self.
controllercontroller.zwave_api.send_command(
70 self.
devicedevice.id, f
"exact?level={min(value, 99)!s}"
75 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"stop")
79 """Return current position of cover.
81 None is unknown, 0 is closed, 100 is fully open.
83 Allow small calibration errors (some devices after a long time
84 become not well calibrated).
86 if self.
devicedevice.level > 95:
89 return self.
devicedevice.level
93 """Return true if cover is closed.
97 Allow small calibration errors (some devices after a long time
98 become not well calibrated).
100 if self.
devicedevice.level
is None:
103 return self.
devicedevice.level < 5
bool|None is_closed(self)
None stop_cover(self, **Any kwargs)
None set_cover_position(self, **Any kwargs)
None open_cover(self, **Any kwargs)
None close_cover(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)