Motion blinds restore angle (#71790)
* restore tilt for TiltDevices * add tilt option to set_absolute_position * improve set_absolute_position service * fix styling
This commit is contained in:
parent
8f33437507
commit
6a6d31180b
5 changed files with 30 additions and 6 deletions
|
@ -71,6 +71,7 @@ TDBU_DEVICE_MAP = {
|
|||
|
||||
SET_ABSOLUTE_POSITION_SCHEMA = {
|
||||
vol.Required(ATTR_ABSOLUTE_POSITION): vol.All(cv.positive_int, vol.Range(max=100)),
|
||||
vol.Optional(ATTR_TILT_POSITION): vol.All(cv.positive_int, vol.Range(max=100)),
|
||||
vol.Optional(ATTR_WIDTH): vol.All(cv.positive_int, vol.Range(max=100)),
|
||||
}
|
||||
|
||||
|
@ -163,6 +164,8 @@ async def async_setup_entry(
|
|||
class MotionPositionDevice(CoordinatorEntity, CoverEntity):
|
||||
"""Representation of a Motion Blind Device."""
|
||||
|
||||
_restore_tilt = False
|
||||
|
||||
def __init__(self, coordinator, blind, device_class, sw_version):
|
||||
"""Initialize the blind."""
|
||||
super().__init__(coordinator)
|
||||
|
@ -287,16 +290,25 @@ class MotionPositionDevice(CoordinatorEntity, CoverEntity):
|
|||
position = kwargs[ATTR_POSITION]
|
||||
async with self._api_lock:
|
||||
await self.hass.async_add_executor_job(
|
||||
self._blind.Set_position, 100 - position
|
||||
self._blind.Set_position,
|
||||
100 - position,
|
||||
None,
|
||||
self._restore_tilt,
|
||||
)
|
||||
await self.async_request_position_till_stop()
|
||||
|
||||
async def async_set_absolute_position(self, **kwargs):
|
||||
"""Move the cover to a specific absolute position (see TDBU)."""
|
||||
position = kwargs[ATTR_ABSOLUTE_POSITION]
|
||||
angle = kwargs.get(ATTR_TILT_POSITION)
|
||||
if angle is not None:
|
||||
angle = angle * 180 / 100
|
||||
async with self._api_lock:
|
||||
await self.hass.async_add_executor_job(
|
||||
self._blind.Set_position, 100 - position
|
||||
self._blind.Set_position,
|
||||
100 - position,
|
||||
angle,
|
||||
self._restore_tilt,
|
||||
)
|
||||
await self.async_request_position_till_stop()
|
||||
|
||||
|
@ -309,6 +321,8 @@ class MotionPositionDevice(CoordinatorEntity, CoverEntity):
|
|||
class MotionTiltDevice(MotionPositionDevice):
|
||||
"""Representation of a Motion Blind Device."""
|
||||
|
||||
_restore_tilt = True
|
||||
|
||||
@property
|
||||
def current_cover_tilt_position(self):
|
||||
"""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Motion Blinds",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/motion_blinds",
|
||||
"requirements": ["motionblinds==0.6.5"],
|
||||
"requirements": ["motionblinds==0.6.7"],
|
||||
"dependencies": ["network"],
|
||||
"dhcp": [
|
||||
{ "registered_devices": true },
|
||||
|
|
|
@ -14,8 +14,17 @@ set_absolute_position:
|
|||
required: true
|
||||
selector:
|
||||
number:
|
||||
min: 1
|
||||
min: 0
|
||||
max: 100
|
||||
unit_of_measurement: "%"
|
||||
tilt_position:
|
||||
name: Tilt position
|
||||
description: Tilt position to move to.
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 100
|
||||
unit_of_measurement: "%"
|
||||
width:
|
||||
name: Width
|
||||
description: Specify the width that is covered, only for TDBU Combined entities.
|
||||
|
@ -23,3 +32,4 @@ set_absolute_position:
|
|||
number:
|
||||
min: 1
|
||||
max: 100
|
||||
unit_of_measurement: "%"
|
||||
|
|
|
@ -1035,7 +1035,7 @@ mitemp_bt==0.0.5
|
|||
moehlenhoff-alpha2==1.1.2
|
||||
|
||||
# homeassistant.components.motion_blinds
|
||||
motionblinds==0.6.5
|
||||
motionblinds==0.6.7
|
||||
|
||||
# homeassistant.components.motioneye
|
||||
motioneye-client==0.3.12
|
||||
|
|
|
@ -712,7 +712,7 @@ minio==5.0.10
|
|||
moehlenhoff-alpha2==1.1.2
|
||||
|
||||
# homeassistant.components.motion_blinds
|
||||
motionblinds==0.6.5
|
||||
motionblinds==0.6.7
|
||||
|
||||
# homeassistant.components.motioneye
|
||||
motioneye-client==0.3.12
|
||||
|
|
Loading…
Add table
Reference in a new issue