Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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