1 """Platform for cover integration."""
5 from boschshcpy
import SHCSession, SHCShutterControl
17 from .const
import DATA_SESSION, DOMAIN
18 from .entity
import SHCEntity
23 config_entry: ConfigEntry,
24 async_add_entities: AddEntitiesCallback,
26 """Set up the SHC cover platform."""
28 session: SHCSession = hass.data[DOMAIN][config_entry.entry_id][DATA_SESSION]
33 parent_id=session.information.unique_id,
34 entry_id=config_entry.entry_id,
36 for cover
in session.device_helper.shutter_controls
41 """Representation of a SHC shutter control device."""
44 _attr_device_class = CoverDeviceClass.SHUTTER
45 _attr_supported_features = (
46 CoverEntityFeature.OPEN
47 | CoverEntityFeature.CLOSE
48 | CoverEntityFeature.STOP
49 | CoverEntityFeature.SET_POSITION
54 """Return the current cover position."""
55 return round(self.
_device_device.level * 100.0)
63 """Return if the cover is closed or not."""
68 """Return if the cover is opening or not."""
70 self.
_device_device.operation_state
71 == SHCShutterControl.ShutterControlService.State.OPENING
76 """Return if the cover is closing or not."""
78 self.
_device_device.operation_state
79 == SHCShutterControl.ShutterControlService.State.CLOSING
91 """Move the cover to a specific position."""
92 position = kwargs[ATTR_POSITION]
93 self.
_device_device.level = position / 100.0
int current_cover_position(self)
None set_cover_position(self, **Any kwargs)
None stop_cover(self, **Any kwargs)
None close_cover(self, **Any kwargs)
None open_cover(self, **Any kwargs)
int|None current_cover_position(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)