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 xiaomi_miio vacuum fan speed list #32821

Closed
Closed
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
8 changes: 7 additions & 1 deletion homeassistant/components/xiaomi_miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@
extra=vol.ALLOW_EXTRA,
)

FAN_SPEEDS = {"Silent": 38, "Standard": 60, "Medium": 77, "Turbo": 90, "Gentle": 105}
FAN_SPEEDS = {
"Silent": 101,
"Standard": 102,
"Medium": 103,
"Turbo": 104,
"Gentle": 105,
}

ATTR_CLEAN_START = "clean_start"
ATTR_CLEAN_STOP = "clean_stop"
Expand Down
8 changes: 4 additions & 4 deletions tests/components/xiaomi_miio/test_vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def mirobo_is_got_error_fixture():
mock_vacuum = mock.MagicMock()
mock_vacuum.status().data = {"test": "raw"}
mock_vacuum.status().is_on = False
mock_vacuum.status().fanspeed = 38
mock_vacuum.status().fanspeed = 101
mock_vacuum.status().got_error = True
mock_vacuum.status().error = "Error message"
mock_vacuum.status().battery = 82
Expand Down Expand Up @@ -261,11 +261,11 @@ async def test_xiaomi_vacuum_services(hass, caplog, mock_mirobo_is_got_error):
await hass.services.async_call(
DOMAIN,
SERVICE_SET_FAN_SPEED,
{"entity_id": entity_id, "fan_speed": 60},
{"entity_id": entity_id, "fan_speed": 102},
blocking=True,
)
mock_mirobo_is_got_error.assert_has_calls(
[mock.call.set_fan_speed(60)], any_order=True
[mock.call.set_fan_speed(102)], any_order=True
)
mock_mirobo_is_got_error.assert_has_calls(STATUS_CALLS, any_order=True)
mock_mirobo_is_got_error.reset_mock()
Expand All @@ -277,7 +277,7 @@ async def test_xiaomi_vacuum_services(hass, caplog, mock_mirobo_is_got_error):
blocking=True,
)
mock_mirobo_is_got_error.assert_has_calls(
[mock.call.set_fan_speed(77)], any_order=True
[mock.call.set_fan_speed(103)], any_order=True
)
mock_mirobo_is_got_error.assert_has_calls(STATUS_CALLS, any_order=True)
mock_mirobo_is_got_error.reset_mock()
Expand Down