-
-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Raise an issue when the Roborock local api is unavailable. #154576
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
Changes from all commits
913ca74
382fdff
5cd1736
e94d30e
85aca25
8c1ef2a
e6ffa68
03b32dd
d02bdd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| from homeassistant.components.roborock.coordinator import RoborockDataUpdateCoordinator | ||
| from homeassistant.const import ATTR_ENTITY_ID, Platform | ||
| from homeassistant.core import HomeAssistant | ||
| from homeassistant.helpers import issue_registry as ir | ||
| from homeassistant.util import dt as dt_util | ||
|
|
||
| from .mock_data import PROP | ||
|
|
@@ -171,6 +172,44 @@ async def test_no_maps( | |
| assert load_map.call_count == 0 | ||
|
|
||
|
|
||
| async def test_cloud_api_repair( | ||
| hass: HomeAssistant, | ||
| mock_roborock_entry: MockConfigEntry, | ||
| bypass_api_fixture_v1_only, | ||
| ) -> None: | ||
| """Test that a repair is created when we use the cloud api.""" | ||
| # Force the system to use the cloud api. | ||
| with patch( | ||
| "homeassistant.components.roborock.coordinator.RoborockLocalClientV1.ping", | ||
| side_effect=RoborockException(), | ||
| ): | ||
| await hass.config_entries.async_setup(mock_roborock_entry.entry_id) | ||
| await hass.async_block_till_done() | ||
|
|
||
| issue_registry = ir.async_get(hass) | ||
| assert len(issue_registry.issues) == 2 | ||
| # Check that both expected device names are present, regardless of order | ||
| assert all( | ||
| issue.translation_key == "cloud_api_used" | ||
| for issue in issue_registry.issues.values() | ||
| ) | ||
| names = { | ||
| issue.translation_placeholders["device_name"] | ||
| for issue in issue_registry.issues.values() | ||
| } | ||
| assert names == {"Roborock S7 MaxV", "Roborock S7 2"} | ||
| await hass.config_entries.async_unload(mock_roborock_entry.entry_id) | ||
| # Now change to using the local api | ||
| with patch( | ||
| "homeassistant.components.roborock.coordinator.RoborockLocalClientV1.ping" | ||
| ): | ||
|
Comment on lines
+203
to
+205
|
||
| # Set it back up | ||
| await hass.config_entries.async_setup(mock_roborock_entry.entry_id) | ||
| await hass.async_block_till_done() | ||
|
|
||
| assert len(issue_registry.issues) == 0 | ||
|
|
||
|
|
||
| async def test_two_maps_in_cleaning( | ||
| hass: HomeAssistant, | ||
| mock_roborock_entry: MockConfigEntry, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RoborockLocalClientV1.ping is awaited in the coordinator; patching it without an AsyncMock can cause await errors. Use an AsyncMock for the side effect and import AsyncMock: with patch('homeassistant.components.roborock.coordinator.RoborockLocalClientV1.ping', new=AsyncMock(side_effect=RoborockException()))