completed tilt control

This commit is contained in:
patman15
2025-01-06 19:46:52 +01:00
parent e00e04159a
commit d73bb1d1c4
2 changed files with 33 additions and 11 deletions

View File

@@ -33,7 +33,11 @@ async def async_setup_entry(
"""Set up the demo cover platform."""
coordinator: PVCoordinator = config_entry.runtime_data
async_add_entities([PowerViewCover(coordinator)])
async_add_entities(
[PowerViewCoverTilt(coordinator)]
if coordinator.dev_details.get("model") in ["51", "62"]
else [PowerViewCover(coordinator)]
)
class PowerViewCover(PassiveBluetoothCoordinatorEntity[PVCoordinator], CoverEntity): # type: ignore[reportIncompatibleVariableOverride]
@@ -53,8 +57,9 @@ class PowerViewCover(PassiveBluetoothCoordinatorEntity[PVCoordinator], CoverEnti
coordinator: PVCoordinator,
) -> None:
"""Initialize the shade."""
LOGGER.debug("%s: init() PowerViewCover", coordinator.name)
self._attr_name = CoverDeviceClass.SHADE
self._coord = coordinator
self._coord: PVCoordinator = coordinator
self._attr_device_info = self._coord.device_info
self._target_position: int | None = round(
self._coord.data.get(ATTR_CURRENT_POSITION, OPEN_POSITION)
@@ -187,6 +192,13 @@ class PowerViewCoverTilt(PowerViewCover):
# | CoverEntityFeature.OPEN_TILT
)
def __init__(
self,
coordinator: PVCoordinator,
) -> None:
LOGGER.debug("%s: init() PowerViewCoverTilt", coordinator.name)
super().__init__(coordinator)
@property
def current_cover_tilt_position(self) -> int | None: # type: ignore[reportIncompatibleVariableOverride]
"""Return current tilt of cover.