add tilt functions
This commit is contained in:
@@ -218,9 +218,15 @@ class PowerViewBLE:
|
|||||||
(
|
(
|
||||||
ShadeCmd.SET_POSITION,
|
ShadeCmd.SET_POSITION,
|
||||||
int.to_bytes(pos1, 2, byteorder="little")
|
int.to_bytes(pos1, 2, byteorder="little")
|
||||||
+ int.to_bytes(pos2 if pos2 is not None else 0x8000, 2, byteorder="little")
|
+ int.to_bytes(
|
||||||
+ int.to_bytes(pos3 if pos3 is not None else 0x8000, 2, byteorder="little")
|
pos2 if pos2 is not None else 0x8000, 2, byteorder="little"
|
||||||
+ int.to_bytes(tilt if tilt is not None else 0x8000, 2, byteorder="little")
|
)
|
||||||
|
+ int.to_bytes(
|
||||||
|
pos3 if pos3 is not None else 0x8000, 2, byteorder="little"
|
||||||
|
)
|
||||||
|
+ int.to_bytes(
|
||||||
|
tilt if tilt is not None else 0x8000, 2, byteorder="little"
|
||||||
|
)
|
||||||
+ int.to_bytes(velocity, 1),
|
+ int.to_bytes(velocity, 1),
|
||||||
),
|
),
|
||||||
disconnect,
|
disconnect,
|
||||||
@@ -303,7 +309,7 @@ class PowerViewBLE:
|
|||||||
.decode("UTF-8")
|
.decode("UTF-8")
|
||||||
)
|
)
|
||||||
except BleakError as ex:
|
except BleakError as ex:
|
||||||
LOGGER.debug("%s: querying failed: %s", ex)
|
LOGGER.debug("%s: querying failed: %s", self.name, ex)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
@@ -346,7 +352,7 @@ class PowerViewBLE:
|
|||||||
disconnected_callback=self._on_disconnect,
|
disconnected_callback=self._on_disconnect,
|
||||||
services=[
|
services=[
|
||||||
UUID_COV_SERVICE,
|
UUID_COV_SERVICE,
|
||||||
# self.UUID_DEV_SERVICE,
|
UUID_DEV_SERVICE,
|
||||||
# self.UUID_BAT_SERVICE,
|
# self.UUID_BAT_SERVICE,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -185,11 +185,12 @@ class PowerViewCoverTilt(PowerViewCover):
|
|||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
CoverEntityFeature.OPEN
|
CoverEntityFeature.OPEN
|
||||||
| CoverEntityFeature.CLOSE
|
| CoverEntityFeature.CLOSE
|
||||||
| CoverEntityFeature.SET_POSITION
|
|
||||||
| CoverEntityFeature.STOP
|
| CoverEntityFeature.STOP
|
||||||
# | CoverEntityFeature.CLOSE_TILT
|
| CoverEntityFeature.SET_POSITION
|
||||||
|
| CoverEntityFeature.OPEN_TILT
|
||||||
|
| CoverEntityFeature.CLOSE_TILT
|
||||||
|
| CoverEntityFeature.STOP_TILT
|
||||||
| CoverEntityFeature.SET_TILT_POSITION
|
| CoverEntityFeature.SET_TILT_POSITION
|
||||||
# | CoverEntityFeature.OPEN_TILT
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -231,3 +232,19 @@ class PowerViewCoverTilt(PowerViewCover):
|
|||||||
target_position,
|
target_position,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def async_stop_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
|
"""Stop the cover."""
|
||||||
|
await self.async_stop_cover(kwargs=kwargs)
|
||||||
|
|
||||||
|
async def async_open_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
|
"""Open the cover tilt."""
|
||||||
|
LOGGER.debug("open cover tilt")
|
||||||
|
_kwargs = {**kwargs, ATTR_TILT_POSITION: OPEN_POSITION}
|
||||||
|
await self.async_set_cover_tilt_position(**_kwargs)
|
||||||
|
|
||||||
|
async def async_close_cover_tilt(self, **kwargs: Any) -> None:
|
||||||
|
"""Close the cover tilt."""
|
||||||
|
LOGGER.debug("close cover tilt")
|
||||||
|
_kwargs = {**kwargs, ATTR_TILT_POSITION: CLOSED_POSITION}
|
||||||
|
await self.async_set_cover_tilt_position(**_kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user