Fix alexa does to check `current_position` correctly when handling cover range changes (#121798)

pull/121636/head^2
Jan Bouwhuis 2024-07-13 16:10:09 +02:00 committed by GitHub
parent a34858a567
commit 3111951757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -1513,7 +1513,7 @@ async def async_api_adjust_range(
if instance == f"{cover.DOMAIN}.{cover.ATTR_POSITION}":
range_delta = int(range_delta * 20) if range_delta_default else int(range_delta)
service = SERVICE_SET_COVER_POSITION
if not (current := entity.attributes.get(cover.ATTR_POSITION)):
if not (current := entity.attributes.get(cover.ATTR_CURRENT_POSITION)):
msg = f"Unable to determine {entity.entity_id} current position"
raise AlexaInvalidValueError(msg)
position = response_value = min(100, max(0, range_delta + current))

View File

@ -1979,7 +1979,7 @@ async def test_cover_position(
"friendly_name": "Test cover range",
"device_class": "blind",
"supported_features": supported_features,
"position": position,
"current_position": position,
},
)
appliance = await discovery_test(device, hass)
@ -2296,7 +2296,7 @@ async def test_cover_position_range(
"friendly_name": "Test cover range",
"device_class": "blind",
"supported_features": 7,
"position": 30,
"current_position": 30,
},
)
appliance = await discovery_test(device, hass)
@ -4658,7 +4658,7 @@ async def test_cover_semantics_position_and_tilt(hass: HomeAssistant) -> None:
"friendly_name": "Test cover semantics",
"device_class": "blind",
"supported_features": 255,
"position": 30,
"current_position": 30,
"tilt_position": 30,
},
)