diff --git a/homeassistant/components/motion_blinds/cover.py b/homeassistant/components/motion_blinds/cover.py index ccd4043faee..e09bb531208 100644 --- a/homeassistant/components/motion_blinds/cover.py +++ b/homeassistant/components/motion_blinds/cover.py @@ -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): """ diff --git a/homeassistant/components/motion_blinds/manifest.json b/homeassistant/components/motion_blinds/manifest.json index 5ec39d8c638..1e8ad0eb0a1 100644 --- a/homeassistant/components/motion_blinds/manifest.json +++ b/homeassistant/components/motion_blinds/manifest.json @@ -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 }, diff --git a/homeassistant/components/motion_blinds/services.yaml b/homeassistant/components/motion_blinds/services.yaml index 1ee60923332..d37d6bb5be8 100644 --- a/homeassistant/components/motion_blinds/services.yaml +++ b/homeassistant/components/motion_blinds/services.yaml @@ -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: "%" diff --git a/requirements_all.txt b/requirements_all.txt index e1bde3fb6ca..457c2e9ec1d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e2d7267149f..dbb54b45643 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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