mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Velbus Cover: Assume state for VMBxBL modules (#109213)
This commit is contained in:
parent
1649957e5c
commit
90efe5ac90
@ -34,6 +34,7 @@ class VelbusCover(VelbusEntity, CoverEntity):
|
|||||||
"""Representation a Velbus cover."""
|
"""Representation a Velbus cover."""
|
||||||
|
|
||||||
_channel: VelbusBlind
|
_channel: VelbusBlind
|
||||||
|
_assumed_closed: bool
|
||||||
|
|
||||||
def __init__(self, channel: VelbusBlind) -> None:
|
def __init__(self, channel: VelbusBlind) -> None:
|
||||||
"""Initialize the cover."""
|
"""Initialize the cover."""
|
||||||
@ -51,11 +52,16 @@ class VelbusCover(VelbusEntity, CoverEntity):
|
|||||||
| CoverEntityFeature.CLOSE
|
| CoverEntityFeature.CLOSE
|
||||||
| CoverEntityFeature.STOP
|
| CoverEntityFeature.STOP
|
||||||
)
|
)
|
||||||
|
self._attr_assumed_state = True
|
||||||
|
# guess the state to get the open/closed icons somewhat working
|
||||||
|
self._assumed_closed = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self) -> bool | None:
|
def is_closed(self) -> bool | None:
|
||||||
"""Return if the cover is closed."""
|
"""Return if the cover is closed."""
|
||||||
|
if self._channel.support_position():
|
||||||
return self._channel.is_closed()
|
return self._channel.is_closed()
|
||||||
|
return self._assumed_closed
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_opening(self) -> bool:
|
def is_opening(self) -> bool:
|
||||||
@ -83,11 +89,13 @@ class VelbusCover(VelbusEntity, CoverEntity):
|
|||||||
async def async_open_cover(self, **kwargs: Any) -> None:
|
async def async_open_cover(self, **kwargs: Any) -> None:
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
await self._channel.open()
|
await self._channel.open()
|
||||||
|
self._assumed_closed = False
|
||||||
|
|
||||||
@api_call
|
@api_call
|
||||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
await self._channel.close()
|
await self._channel.close()
|
||||||
|
self._assumed_closed = True
|
||||||
|
|
||||||
@api_call
|
@api_call
|
||||||
async def async_stop_cover(self, **kwargs: Any) -> None:
|
async def async_stop_cover(self, **kwargs: Any) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user