mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Change roborock to use home_data_v3 (#144238)
This commit is contained in:
parent
cad2d72ed9
commit
e0916fdd26
@ -53,7 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) ->
|
|||||||
)
|
)
|
||||||
_LOGGER.debug("Getting home data")
|
_LOGGER.debug("Getting home data")
|
||||||
try:
|
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:
|
except RoborockInvalidCredentials as err:
|
||||||
raise ConfigEntryAuthFailed(
|
raise ConfigEntryAuthFailed(
|
||||||
"Invalid credentials",
|
"Invalid credentials",
|
||||||
|
@ -72,7 +72,7 @@ def bypass_api_client_fixture() -> None:
|
|||||||
"""Skip calls to the API client."""
|
"""Skip calls to the API client."""
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
return_value=HOME_DATA,
|
return_value=HOME_DATA,
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
@ -183,7 +183,7 @@ def bypass_api_fixture_v1_only(bypass_api_fixture) -> None:
|
|||||||
home_data_copy = deepcopy(HOME_DATA)
|
home_data_copy = deepcopy(HOME_DATA)
|
||||||
home_data_copy.received_devices = []
|
home_data_copy.received_devices = []
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
return_value=home_data_copy,
|
return_value=home_data_copy,
|
||||||
):
|
):
|
||||||
yield
|
yield
|
||||||
|
@ -54,7 +54,7 @@ async def test_config_entry_not_ready(
|
|||||||
"""Test that when coordinator update fails, entry retries."""
|
"""Test that when coordinator update fails, entry retries."""
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.roborock.coordinator.RoborockLocalClientV1.get_prop",
|
"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."""
|
"""Test that when we fail to get home data, entry retries."""
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
side_effect=RoborockException(),
|
side_effect=RoborockException(),
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
@ -164,7 +164,7 @@ async def test_reauth_started(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test reauth flow started."""
|
"""Test reauth flow started."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
side_effect=RoborockInvalidCredentials(),
|
side_effect=RoborockInvalidCredentials(),
|
||||||
):
|
):
|
||||||
await async_setup_component(hass, DOMAIN, {})
|
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 = deepcopy(HOME_DATA)
|
||||||
home_data_copy.received_devices[0].pv = "random"
|
home_data_copy.received_devices[0].pv = "random"
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
return_value=home_data_copy,
|
return_value=home_data_copy,
|
||||||
):
|
):
|
||||||
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
|
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 = deepcopy(HOME_DATA)
|
||||||
home_data_copy.products[2].category = "random"
|
home_data_copy.products[2].category = "random"
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
return_value=home_data_copy,
|
return_value=home_data_copy,
|
||||||
):
|
):
|
||||||
await async_setup_component(hass, DOMAIN, {})
|
await async_setup_component(hass, DOMAIN, {})
|
||||||
@ -282,7 +282,7 @@ async def test_invalid_user_agreement(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we fail setting up if the user agreement is out of date."""
|
"""Test that we fail setting up if the user agreement is out of date."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
side_effect=RoborockInvalidUserAgreement(),
|
side_effect=RoborockInvalidUserAgreement(),
|
||||||
):
|
):
|
||||||
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
|
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
|
||||||
@ -299,7 +299,7 @@ async def test_no_user_agreement(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test that we fail setting up if the user has no agreement."""
|
"""Test that we fail setting up if the user has no agreement."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
side_effect=RoborockNoUserAgreement(),
|
side_effect=RoborockNoUserAgreement(),
|
||||||
):
|
):
|
||||||
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
|
await hass.config_entries.async_setup(mock_roborock_entry.entry_id)
|
||||||
@ -330,7 +330,7 @@ async def test_stale_device(
|
|||||||
|
|
||||||
with (
|
with (
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v2",
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data_v3",
|
||||||
return_value=hd,
|
return_value=hd,
|
||||||
),
|
),
|
||||||
patch(
|
patch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user