Fix Powerview top shade open position (#75110)
parent
b105b0fbcb
commit
9e99ea68fb
|
@ -455,14 +455,6 @@ class PowerViewShadeTDBUTop(PowerViewShadeTDBU):
|
||||||
super().__init__(coordinator, device_info, room_name, shade, name)
|
super().__init__(coordinator, device_info, room_name, shade, name)
|
||||||
self._attr_unique_id = f"{self._shade.id}_top"
|
self._attr_unique_id = f"{self._shade.id}_top"
|
||||||
self._attr_name = f"{self._shade_name} Top"
|
self._attr_name = f"{self._shade_name} Top"
|
||||||
# these shades share a class in parent API
|
|
||||||
# override open position for top shade
|
|
||||||
self._shade.open_position = {
|
|
||||||
ATTR_POSITION1: MIN_POSITION,
|
|
||||||
ATTR_POSITION2: MAX_POSITION,
|
|
||||||
ATTR_POSKIND1: POS_KIND_PRIMARY,
|
|
||||||
ATTR_POSKIND2: POS_KIND_SECONDARY,
|
|
||||||
}
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self) -> bool:
|
def should_poll(self) -> bool:
|
||||||
|
@ -485,6 +477,21 @@ class PowerViewShadeTDBUTop(PowerViewShadeTDBU):
|
||||||
# these need to be inverted to report state correctly in HA
|
# these need to be inverted to report state correctly in HA
|
||||||
return hd_position_to_hass(self.positions.secondary, MAX_POSITION)
|
return hd_position_to_hass(self.positions.secondary, MAX_POSITION)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def open_position(self) -> PowerviewShadeMove:
|
||||||
|
"""Return the open position and required additional positions."""
|
||||||
|
# these shades share a class in parent API
|
||||||
|
# override open position for top shade
|
||||||
|
return PowerviewShadeMove(
|
||||||
|
{
|
||||||
|
ATTR_POSITION1: MIN_POSITION,
|
||||||
|
ATTR_POSITION2: MAX_POSITION,
|
||||||
|
ATTR_POSKIND1: POS_KIND_PRIMARY,
|
||||||
|
ATTR_POSKIND2: POS_KIND_SECONDARY,
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _clamp_cover_limit(self, target_hass_position: int) -> int:
|
def _clamp_cover_limit(self, target_hass_position: int) -> int:
|
||||||
"""Dont allow a cover to go into an impossbile position."""
|
"""Dont allow a cover to go into an impossbile position."""
|
||||||
|
|
Loading…
Reference in New Issue