Skip to content

Commit

Permalink
Fix alexa does to check current_position correctly when handling co…
Browse files Browse the repository at this point in the history
…ver range changes (#121798)
  • Loading branch information
jbouwh authored Jul 13, 2024
1 parent a34858a commit 3111951
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/alexa/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions tests/components/alexa/test_smart_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
},
)
Expand Down

0 comments on commit 3111951

Please sign in to comment.