1 """Support for covers connected with WMS WebControl pro."""
3 from __future__
import annotations
5 from datetime
import timedelta
8 from wmspro.const
import (
9 WMS_WebControl_pro_API_actionDescription,
10 WMS_WebControl_pro_API_actionType,
17 from .
import WebControlProConfigEntry
18 from .entity
import WebControlProGenericEntity
26 config_entry: WebControlProConfigEntry,
27 async_add_entities: AddEntitiesCallback,
29 """Set up the WMS based covers from a config entry."""
30 hub = config_entry.runtime_data
32 entities: list[WebControlProGenericEntity] = []
33 for dest
in hub.dests.values():
34 if dest.action(WMS_WebControl_pro_API_actionDescription.AwningDrive):
41 """Representation of a WMS based awning."""
43 _attr_device_class = CoverDeviceClass.AWNING
47 """Return current position of cover."""
48 action = self.
_dest_dest.action(WMS_WebControl_pro_API_actionDescription.AwningDrive)
49 return 100 - action[
"percentage"]
52 """Move the cover to a specific position."""
53 action = self.
_dest_dest.action(WMS_WebControl_pro_API_actionDescription.AwningDrive)
54 await action(percentage=100 - kwargs[ATTR_POSITION])
58 """Return if the cover is closed."""
63 action = self.
_dest_dest.action(WMS_WebControl_pro_API_actionDescription.AwningDrive)
64 await action(percentage=0)
67 """Close the cover."""
68 action = self.
_dest_dest.action(WMS_WebControl_pro_API_actionDescription.AwningDrive)
69 await action(percentage=100)
72 """Stop the device if in motion."""
73 action = self.
_dest_dest.action(
74 WMS_WebControl_pro_API_actionDescription.ManualCommand,
75 WMS_WebControl_pro_API_actionType.Stop,
int|None current_cover_position(self)
int|None current_cover_position(self)
bool|None is_closed(self)
None async_set_cover_position(self, **Any kwargs)
None async_close_cover(self, **Any kwargs)
None async_stop_cover(self, **Any kwargs)
None async_open_cover(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, WebControlProConfigEntry config_entry, AddEntitiesCallback async_add_entities)