Change roborock to use home_data_v3 (#144238)

This commit is contained in:
Luke Lashley 2025-05-04 23:02:32 -04:00 committed by GitHub
parent cad2d72ed9
commit e0916fdd26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) ->
)
_LOGGER.debug("Getting home data")
try:
home_data = await api_client.get_home_data_v2(user_data)
home_data = await api_client.get_home_data_v3(user_data)
except RoborockInvalidCredentials as err:
raise ConfigEntryAuthFailed(
"Invalid credentials",

View File

@ -72,7 +72,7 @@ def bypass_api_client_fixture() -> None:
"""Skip calls to the API client."""
with (
patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
return_value=HOME_DATA,
),
patch(
@ -183,7 +183,7 @@ def bypass_api_fixture_v1_only(bypass_api_fixture) -> None:
home_data_copy = deepcopy(HOME_DATA)
home_data_copy.received_devices = []
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
return_value=home_data_copy,
):
yield

View File

@ -54,7 +54,7 @@ async def test_config_entry_not_ready(
"""Test that when coordinator update fails, entry retries."""
with (
patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
),
patch(
"homeassistant.components.roborock.coordinator.RoborockLocalClientV1.get_prop",
@ -71,7 +71,7 @@ async def test_config_entry_not_ready_home_data(
"""Test that when we fail to get home data, entry retries."""
with (
patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
side_effect=RoborockException(),
),
patch(
@ -164,7 +164,7 @@ async def test_reauth_started(
) -> None:
"""Test reauth flow started."""
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
side_effect=RoborockInvalidCredentials(),
):
await async_setup_component(hass, DOMAIN, {})
@ -249,7 +249,7 @@ async def test_not_supported_protocol(
home_data_copy = deepcopy(HOME_DATA)
home_data_copy.received_devices[0].pv = "random"
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
return_value=home_data_copy,
):
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
@ -267,7 +267,7 @@ async def test_not_supported_a01_device(
home_data_copy = deepcopy(HOME_DATA)
home_data_copy.products[2].category = "random"
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
return_value=home_data_copy,
):
await async_setup_component(hass, DOMAIN, {})
@ -282,7 +282,7 @@ async def test_invalid_user_agreement(
) -> None:
"""Test that we fail setting up if the user agreement is out of date."""
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
side_effect=RoborockInvalidUserAgreement(),
):
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
@ -299,7 +299,7 @@ async def test_no_user_agreement(
) -> None:
"""Test that we fail setting up if the user has no agreement."""
with patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
side_effect=RoborockNoUserAgreement(),
):
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
@ -330,7 +330,7 @@ async def test_stale_device(
with (
patch(
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
return_value=hd,
),
patch(