Fix when the Roborock map is being provisioned (#130574)
This commit is contained in:
parent
2fda4c82de
commit
938b1eca22
2 changed files with 12 additions and 3 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
|
@ -107,8 +106,12 @@ class RoborockDataUpdateCoordinator(DataUpdateCoordinator[DeviceProp]):
|
|||
async def _async_update_data(self) -> DeviceProp:
|
||||
"""Update data via library."""
|
||||
try:
|
||||
await asyncio.gather(*(self._update_device_prop(), self.get_rooms()))
|
||||
# Update device props and standard api information
|
||||
await self._update_device_prop()
|
||||
# Set the new map id from the updated device props
|
||||
self._set_current_map()
|
||||
# Get the rooms for that map id.
|
||||
await self.get_rooms()
|
||||
except RoborockException as ex:
|
||||
raise UpdateFailed(ex) from ex
|
||||
return self.roborock_device_info.props
|
||||
|
|
|
@ -135,6 +135,9 @@ class RoborockCurrentMapSelectEntity(RoborockCoordinatedEntityV1, SelectEntity):
|
|||
RoborockCommand.LOAD_MULTI_MAP,
|
||||
[map_id],
|
||||
)
|
||||
# Update the current map id manually so that nothing gets broken
|
||||
# if another service hits the api.
|
||||
self.coordinator.current_map = map_id
|
||||
# We need to wait after updating the map
|
||||
# so that other commands will be executed correctly.
|
||||
await asyncio.sleep(MAP_SLEEP)
|
||||
|
@ -148,6 +151,9 @@ class RoborockCurrentMapSelectEntity(RoborockCoordinatedEntityV1, SelectEntity):
|
|||
@property
|
||||
def current_option(self) -> str | None:
|
||||
"""Get the current status of the select entity from device_status."""
|
||||
if (current_map := self.coordinator.current_map) is not None:
|
||||
if (
|
||||
(current_map := self.coordinator.current_map) is not None
|
||||
and current_map in self.coordinator.maps
|
||||
): # 63 means it is searching for a map.
|
||||
return self.coordinator.maps[current_map].name
|
||||
return None
|
||||
|
|
Loading…
Add table
Reference in a new issue