Add open/close tilt support to KNX cover (#46583)

This commit is contained in:
Martin 2021-02-20 20:09:43 +01:00 committed by GitHub
parent 194c0d2b08
commit 6bb848455f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,9 @@ from homeassistant.components.cover import (
DEVICE_CLASS_BLIND,
DEVICE_CLASSES,
SUPPORT_CLOSE,
SUPPORT_CLOSE_TILT,
SUPPORT_OPEN,
SUPPORT_OPEN_TILT,
SUPPORT_SET_POSITION,
SUPPORT_SET_TILT_POSITION,
SUPPORT_STOP,
@ -61,7 +63,9 @@ class KNXCover(KnxEntity, CoverEntity):
if self._device.supports_stop:
supported_features |= SUPPORT_STOP
if self._device.supports_angle:
supported_features |= SUPPORT_SET_TILT_POSITION
supported_features |= (
SUPPORT_SET_TILT_POSITION | SUPPORT_OPEN_TILT | SUPPORT_CLOSE_TILT
)
return supported_features
@property
@ -127,6 +131,14 @@ class KNXCover(KnxEntity, CoverEntity):
knx_tilt_position = 100 - kwargs[ATTR_TILT_POSITION]
await self._device.set_angle(knx_tilt_position)
async def async_open_cover_tilt(self, **kwargs):
"""Open the cover tilt."""
await self._device.set_short_up()
async def async_close_cover_tilt(self, **kwargs):
"""Close the cover tilt."""
await self._device.set_short_down()
def start_auto_updater(self):
"""Start the autoupdater to update Home Assistant while cover is moving."""
if self._unsubscribe_auto_updater is None: