From bbb6cdad1f683adfe3a4e20b43d16de7bd37cff5 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 15:16:03 -0700 Subject: [PATCH 1/7] feat: Improve room naming and data integration by introducing `raw_name` to `NamedRoomMapping` and enhancing `iot_id` and name mapping from `HomeData`. --- roborock/data/containers.py | 29 ++++++++++- roborock/data/v1/v1_containers.py | 22 +++++++- roborock/devices/traits/v1/home.py | 43 +++++++-------- roborock/devices/traits/v1/rooms.py | 52 ++++++++----------- .../__snapshots__/test_file_cache.ambr | 12 ++--- tests/devices/test_file_cache.py | 8 +-- tests/devices/traits/v1/test_home.py | 25 ++++++--- tests/devices/traits/v1/test_rooms.py | 13 +++-- 8 files changed, 126 insertions(+), 78 deletions(-) diff --git a/roborock/data/containers.py b/roborock/data/containers.py index e40f62c4..2e469e6b 100644 --- a/roborock/data/containers.py +++ b/roborock/data/containers.py @@ -301,6 +301,11 @@ class HomeDataRoom(RoborockBase): id: int name: str + @property + def iot_id(self) -> str: + """Return the room's ID as a string IOT ID.""" + return str(self.id) + @dataclass class HomeDataScene(RoborockBase): @@ -352,6 +357,16 @@ def device_products(self) -> dict[str, tuple[HomeDataDevice, HomeDataProduct]]: if (product := product_map.get(device.product_id)) is not None } + @property + def rooms_map(self) -> dict[str, HomeDataRoom]: + """Returns a dictionary of Room iot_id to rooms""" + return {room.iot_id: room for room in self.rooms} + + @property + def rooms_name_map(self) -> dict[str, str]: + """Returns a dictionary of Room iot_id to room names.""" + return {room.iot_id: room.name for room in self.rooms} + @dataclass class LoginData(RoborockBase): @@ -388,8 +403,13 @@ class NamedRoomMapping(RoomMapping): from the HomeData based on the iot_id from the room. """ - name: str - """The human-readable name of the room, if available.""" + @property + def name(self) -> str: + """The human-readable name of the room, or a default name if not available.""" + return self.raw_name or f"Room {self.segment_id}" + + raw_name: str | None = None + """The raw name of the room, as provided by the device.""" @dataclass @@ -409,6 +429,11 @@ class CombinedMapInfo(RoborockBase): rooms: list[NamedRoomMapping] """The list of rooms in the map.""" + @property + def rooms_map(self) -> dict[int, NamedRoomMapping]: + """Returns a mapping of segment_id to NamedRoomMapping.""" + return {room.segment_id: room for room in self.rooms} + @dataclass class BroadcastMessage(RoborockBase): diff --git a/roborock/data/v1/v1_containers.py b/roborock/data/v1/v1_containers.py index e266a85b..4a64661d 100644 --- a/roborock/data/v1/v1_containers.py +++ b/roborock/data/v1/v1_containers.py @@ -38,7 +38,7 @@ ) from roborock.exceptions import RoborockException -from ..containers import RoborockBase, RoborockBaseTimer, _attr_repr +from ..containers import NamedRoomMapping, RoborockBase, RoborockBaseTimer, _attr_repr from .v1_code_mappings import ( CleanFluidStatus, ClearWaterBoxStatus, @@ -686,6 +686,17 @@ class MultiMapsListRoom(RoborockBase): iot_name_id: str | None = None iot_name: str | None = None + @property + def named_room_mapping(self) -> NamedRoomMapping | None: + """Returns a NamedRoomMapping object if valid.""" + if self.id is None or self.iot_name_id is None: + return None + return NamedRoomMapping( + segment_id=self.id, + iot_id=self.iot_name_id, + raw_name=self.iot_name, + ) + @dataclass class MultiMapsListMapInfoBakMaps(RoborockBase): @@ -707,6 +718,15 @@ def mapFlag(self) -> int: """Alias for map_flag, returns the map flag as an integer.""" return self.map_flag + @property + def rooms_map(self) -> dict[int, NamedRoomMapping]: + """Returns a dictionary of room mappings by segment id.""" + return { + room.id: room.named_room_mapping + for room in self.rooms or () + if room.id is not None and room.named_room_mapping is not None + } + @dataclass class MultiMapsList(RoborockBase): diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index 0352b18d..dd87478f 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -20,7 +20,8 @@ import logging from typing import Self -from roborock.data import CombinedMapInfo, NamedRoomMapping, RoborockBase +from roborock.data import CombinedMapInfo, MultiMapsListMapInfo, RoborockBase +from roborock.data.containers import NamedRoomMapping from roborock.data.v1.v1_code_mappings import RoborockStateCode from roborock.devices.cache import DeviceCache from roborock.devices.traits.v1 import common @@ -114,35 +115,29 @@ async def discover_home(self) -> None: self._discovery_completed = True await self._update_home_cache(home_map_info, home_map_content) - async def _refresh_map_info(self, map_info) -> CombinedMapInfo: + async def _refresh_map_info(self, map_info: MultiMapsListMapInfo) -> CombinedMapInfo: """Collect room data for a specific map and return CombinedMapInfo.""" await self._rooms_trait.refresh() - rooms: dict[int, NamedRoomMapping] = {} - if map_info.rooms: - # Not all vacuums respond with rooms inside map_info. - # If we can determine if all vacuums will return everything with get_rooms, we could remove this step. - for room in map_info.rooms: - if room.id is not None and room.iot_name_id is not None: - rooms[room.id] = NamedRoomMapping( - segment_id=room.id, - iot_id=room.iot_name_id, - name=room.iot_name or f"Room {room.id}", - ) - - # Add rooms from rooms_trait. - # Keep existing names from map_info unless they are fallback names. - if self._rooms_trait.rooms: - for room in self._rooms_trait.rooms: - if room.segment_id is not None and room.name: - existing_room = rooms.get(room.segment_id) - if existing_room is None or existing_room.name == f"Room {room.segment_id}": - rooms[room.segment_id] = room - + # We have room names from two sources. The map_info.rooms which we just + # received from the MultiMapsList or the self._rooms_trait.rooms which + # comes from the GET_ROOM_MAPPING command. We merge them, giving priority + # to map_info rooms, and excluding unset rooms from the trait. + rooms: list[NamedRoomMapping] = list( + { + **map_info.rooms_map, + **{ + room.segment_id: room + for room in self._rooms_trait.rooms or () + if (existing := map_info.rooms_map.get(room.segment_id)) is None + or (room.raw_name and existing.raw_name is None) + }, + }.values() + ) return CombinedMapInfo( map_flag=map_info.map_flag, name=map_info.name, - rooms=list(rooms.values()), + rooms=rooms, ) async def _refresh_map_content(self) -> MapContent: diff --git a/roborock/devices/traits/v1/rooms.py b/roborock/devices/traits/v1/rooms.py index 698fa90f..6df36295 100644 --- a/roborock/devices/traits/v1/rooms.py +++ b/roborock/devices/traits/v1/rooms.py @@ -3,7 +3,7 @@ import logging from dataclasses import dataclass -from roborock.data import HomeData, NamedRoomMapping, RoborockBase +from roborock.data import HomeData, HomeDataRoom, NamedRoomMapping, RoborockBase from roborock.devices.traits.v1 import common from roborock.roborock_typing import RoborockCommand from roborock.web_api import UserWebApiClient @@ -36,7 +36,7 @@ def __init__(self, home_data: HomeData, web_api: UserWebApiClient) -> None: super().__init__() self._home_data = home_data self._web_api = web_api - self._seen_unknown_room_iot_ids: set[str] = set() + self._discovered_iot_ids: set[str] = set() async def refresh(self) -> None: """Refresh room mappings and backfill unknown room names from the web API.""" @@ -45,47 +45,39 @@ async def refresh(self) -> None: raise ValueError(f"Unexpected RoomsTrait response format: {response!r}") segment_map = _extract_segment_map(response) - await self._populate_missing_home_data_rooms(segment_map) - - new_data = self._parse_response(response, segment_map) + # Track all iot ids seen before. Refresh the room list when new ids are found. + new_iot_ids = set(segment_map.values()) - set(self._home_data.rooms_map.keys()) + if new_iot_ids - self._discovered_iot_ids: + _LOGGER.debug("Refreshing room list to discover new room names") + if updated_rooms := await self._refresh_rooms(): + _LOGGER.debug("Updating rooms: %s", list(updated_rooms)) + self._home_data.rooms = updated_rooms + self._discovered_iot_ids.update(new_iot_ids) + + new_data = self._parse_rooms(segment_map, self._home_data.rooms_name_map) self._update_trait_values(new_data) _LOGGER.debug("Refreshed %s: %s", self.__class__.__name__, new_data) - @property - def _iot_id_room_name_map(self) -> dict[str, str]: - """Returns a dictionary of Room IOT IDs to room names.""" - return {str(room.id): room.name for room in self._home_data.rooms or ()} - - def _parse_response(self, response: common.V1ResponseData, segment_map: dict[int, str] | None = None) -> Rooms: + @staticmethod + def _parse_rooms( + segment_map: dict[int, str], + name_map: dict[str, str], + ) -> Rooms: """Parse the response from the device into a list of NamedRoomMapping.""" - if not isinstance(response, list): - raise ValueError(f"Unexpected RoomsTrait response format: {response!r}") - if segment_map is None: - segment_map = _extract_segment_map(response) - name_map = self._iot_id_room_name_map return Rooms( rooms=[ - NamedRoomMapping(segment_id=segment_id, iot_id=iot_id, name=name_map.get(iot_id, f"Room {segment_id}")) + NamedRoomMapping(segment_id=segment_id, iot_id=iot_id, raw_name=name_map.get(iot_id)) for segment_id, iot_id in segment_map.items() ] ) - async def _populate_missing_home_data_rooms(self, segment_map: dict[int, str]) -> None: - """Load missing room names into home data for newly-seen unknown room ids.""" - missing_room_iot_ids = set(segment_map.values()) - set(self._iot_id_room_name_map.keys()) - new_missing_room_iot_ids = missing_room_iot_ids - self._seen_unknown_room_iot_ids - if not new_missing_room_iot_ids: - return - + async def _refresh_rooms(self) -> list[HomeDataRoom]: + """Merge the existing rooms with new rooms returned from the API.""" try: - web_rooms = await self._web_api.get_rooms() + return await self._web_api.get_rooms() except Exception: _LOGGER.debug("Failed to fetch rooms from web API", exc_info=True) - else: - if isinstance(web_rooms, list) and web_rooms: - self._home_data.rooms = web_rooms - - self._seen_unknown_room_iot_ids.update(missing_room_iot_ids) + return [] def _extract_segment_map(response: list) -> dict[int, str]: diff --git a/tests/devices/__snapshots__/test_file_cache.ambr b/tests/devices/__snapshots__/test_file_cache.ambr index fa2f343a..0a634d5d 100644 --- a/tests/devices/__snapshots__/test_file_cache.ambr +++ b/tests/devices/__snapshots__/test_file_cache.ambr @@ -1,36 +1,36 @@ # serializer version: 1 # name: test_set_and_flush_and_get[default-all_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', raw_name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', raw_name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[default-empty_cache] CacheData(home_data=None, device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[default-multiple_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[default-populated_cache] CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[json-all_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', raw_name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', raw_name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[json-empty_cache] CacheData(home_data=None, device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[json-multiple_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[json-populated_cache] CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[pickle-all_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={'device1': DeviceCacheData(network_info=NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50), home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map 1', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room'), NamedRoomMapping(segment_id=1024, iot_id='4322', raw_name='Starship')]), 2: CombinedMapInfo(map_flag=2, name='Test Map 2', rooms=[NamedRoomMapping(segment_id=2047, iot_id='5432', raw_name='Bedroom')])}, home_map_content_base64={1: 'ZHVtbXlfbWFwX2NvbnRlbnQ=', 2: 'bW9yZV9kdW1teV9jb250ZW50'}, device_features=DeviceFeatures(is_show_clean_finish_reason_supported=True, is_re_segment_supported=False, is_video_monitor_supported=False, is_any_state_transit_goto_supported=False, is_fw_filter_obstacle_supported=False, is_video_setting_supported=False, is_ignore_unknown_map_object_supported=False, is_set_child_supported=False, is_carpet_supported=False, is_record_allowed=False, is_mop_path_supported=False, is_multi_map_segment_timer_supported=False, is_current_map_restore_enabled=False, is_room_name_supported=False, is_shake_mop_set_supported=False, is_map_beautify_internal_debug_supported=False, is_new_data_for_clean_history=False, is_new_data_for_clean_history_detail=False, is_flow_led_setting_supported=False, is_dust_collection_setting_supported=False, is_rpc_retry_supported=False, is_avoid_collision_supported=False, is_support_set_switch_map_mode=False, is_map_carpet_add_support=False, is_custom_water_box_distance_supported=False, is_support_smart_scene=False, is_support_floor_edit=False, is_support_furniture=False, is_wash_then_charge_cmd_supported=False, is_support_room_tag=False, is_support_quick_map_builder=False, is_support_smart_global_clean_with_custom_mode=False, is_careful_slow_mop_supported=False, is_egg_mode_supported_from_new_features=False, is_carpet_show_on_map=False, is_supported_valley_electricity=False, is_unsave_map_reason_supported=False, is_supported_drying=False, is_supported_download_test_voice=False, is_support_backup_map=False, is_support_custom_mode_in_cleaning=False, is_support_remote_control_in_call=False, is_support_set_volume_in_call=True, is_support_clean_estimate=False, is_support_custom_dnd=False, is_carpet_deep_clean_supported=False, is_support_stuck_zone=False, is_support_custom_door_sill=False, is_wifi_manage_supported=False, is_clean_route_fast_mode_supported=False, is_support_cliff_zone=False, is_support_smart_door_sill=False, is_support_floor_direction=False, is_back_charge_auto_wash_supported=False, is_support_incremental_map=False, is_offline_map_supported=False, is_super_deep_wash_supported=False, is_ces_2022_supported=False, is_dss_believable=False, is_main_brush_up_down_supported_from_str=False, is_goto_pure_clean_path_supported=False, is_water_up_down_drain_supported=False, is_setting_carpet_first_supported=False, is_clean_route_deep_slow_plus_supported=False, is_dynamically_skip_clean_zone_supported=False, is_dynamically_add_clean_zones_supported=False, is_left_water_drain_supported=False, is_clean_count_setting_supported=False, is_corner_clean_mode_supported=False, is_two_key_real_time_video_supported=False, is_two_key_rtv_in_charging_supported=False, is_dirty_replenish_clean_supported=False, is_auto_delivery_field_in_global_status_supported=False, is_avoid_collision_mode_supported=False, is_voice_control_supported=False, is_new_endpoint_supported=False, is_pumping_water_supported=False, is_corner_mop_stretch_supported=False, is_hot_wash_towel_supported=False, is_floor_dir_clean_any_time_supported=False, is_pet_supplies_deep_clean_supported=False, is_mop_shake_water_max_supported=False, is_exact_custom_mode_supported=False, is_video_patrol_supported=False, is_carpet_custom_clean_supported=False, is_pet_snapshot_supported=False, is_custom_clean_mode_count_supported=False, is_new_ai_recognition_supported=False, is_auto_collection_2_supported=False, is_right_brush_stretch_supported=False, is_smart_clean_mode_set_supported=False, is_dirty_object_detect_supported=False, is_no_need_carpet_press_set_supported=False, is_voice_control_led_supported=False, is_water_leak_check_supported=False, is_min_battery_15_to_clean_task_supported=False, is_gap_deep_clean_supported=False, is_object_detect_check_supported=False, is_identify_room_supported=False, is_matter_supported=False, is_workday_holiday_supported=False, is_clean_direct_status_supported=False, is_map_eraser_supported=False, is_optimize_battery_supported=False, is_activate_video_charging_and_standby_supported=False, is_carpet_long_haired_supported=False, is_clean_history_time_line_supported=False, is_max_zone_opened_supported=False, is_exhibition_function_supported=False, is_lds_lifting_supported=False, is_auto_tear_down_mop_supported=False, is_small_side_mop_supported=False, is_support_side_brush_up_down_supported=False, is_dry_interval_timer_supported=False, is_uvc_sterilize_supported=False, is_midway_back_to_dock_supported=False, is_support_main_brush_up_down_supported=False, is_egg_dance_mode_supported=False, is_mechanical_arm_mode_supported=False, is_tidyup_zones_supported=False, is_clean_time_line_supported=False, is_clean_then_mop_mode_supported=False, is_type_identify_supported=False, is_support_get_particular_status_supported=False, is_three_d_mapping_inner_test_supported=False, is_sync_server_name_supported=False, is_should_show_arm_over_load_supported=False, is_collect_dust_count_show_supported=False, is_support_api_app_stop_grasp_supported=False, is_ctm_with_repeat_supported=False, is_side_brush_lift_carpet_supported=False, is_detect_wire_carpet_supported=False, is_water_slide_mode_supported=False, is_soak_and_wash_supported=False, is_clean_efficiency_supported=False, is_back_wash_new_smart_supported=False, is_dual_band_wi_fi_supported=False, is_program_mode_supported=False, is_clean_fluid_delivery_supported=False, is_carpet_long_haired_ex_supported=False, is_over_sea_ctm_supported=False, is_full_duples_switch_supported=False, is_low_area_access_supported=False, is_follow_low_obs_supported=False, is_two_gears_no_collision_supported=False, is_carpet_shape_type_supported=False, is_sr_map_supported=False, is_led_status_switch_supported=False, is_multi_floor_supported=False, is_support_fetch_timer_summary=False, is_order_clean_supported=False, is_analysis_supported=False, is_remote_supported=False, is_support_voice_control_debug=False, is_mop_forbidden_supported=True, is_soft_clean_mode_supported=True, is_custom_mode_supported=True, is_support_custom_carpet=True, is_show_general_obstacle_supported=True, is_show_obstacle_photo_supported=True, is_rubber_brush_carpet_supported=True, is_carpet_pressure_use_origin_paras_supported=True, is_support_mop_back_pwm_set=True, is_collect_dust_mode_supported=True, is_support_water_mode=False, is_pure_clean_mop_supported=False, is_new_remote_view_supported=False, is_max_plus_mode_supported=False, is_none_pure_clean_mop_with_max_plus=False, is_clean_route_setting_supported=False, is_mop_shake_module_supported=False, is_customized_clean_supported=False), trait_data={'test_trait': {'key': 'value', 'number': 42}}), 'device2': DeviceCacheData(network_info=None, home_map_info=None, home_map_content_base64=None, device_features=None, trait_data=None)}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[pickle-empty_cache] CacheData(home_data=None, device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[pickle-multiple_fields_cache] - CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) + CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={'abc123': NetworkInfo(ip='1.1.1.1', ssid='test_wifi', mac='aa:bb:cc:dd:ee:ff', bssid='aa:bb:cc:dd:ee:ff', rssi=-50)}, home_map_info={1: CombinedMapInfo(map_flag=1, name='Test Map', rooms=[NamedRoomMapping(segment_id=1023, iot_id='4321', raw_name='Living Room')])}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) # --- # name: test_set_and_flush_and_get[pickle-populated_cache] CacheData(home_data=HomeData(id=123456, name='My Home', products=[HomeDataProduct(id='product-id-s7-maxv', name='Roborock S7 MaxV', model='roborock.vacuum.a27', category=, code='a27', icon_url=None, attribute=None, capability=0, schema=[HomeDataProductSchema(id='101', name='rpc_request', code='rpc_request_code', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='102', name='rpc_response', code='rpc_response', mode='rw', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='120', name='错误代码', code='error_code', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='121', name='设备状态', code='state', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='122', name='设备电量', code='battery', mode='ro', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='123', name='清扫模式', code='fan_power', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='124', name='拖地模式', code='water_box_mode', mode='rw', type='ENUM', product_property=None, property='{"range": []}', desc=None), HomeDataProductSchema(id='125', name='主刷寿命', code='main_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='126', name='边刷寿命', code='side_brush_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='127', name='滤网寿命', code='filter_life', mode='rw', type='VALUE', product_property=None, property='{"max": 100, "min": 0, "step": 1, "unit": null, "scale": 1}', desc=None), HomeDataProductSchema(id='128', name='额外状态', code='additional_props', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='130', name='完成事件', code='task_complete', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='131', name='电量不足任务取消', code='task_cancel_low_power', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='132', name='运动中任务取消', code='task_cancel_in_motion', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='133', name='充电状态', code='charge_status', mode='ro', type='RAW', product_property=None, property=None, desc=None), HomeDataProductSchema(id='134', name='烘干状态', code='drying_status', mode='ro', type='RAW', product_property=None, property=None, desc=None)])], devices=[HomeDataDevice(duid='abc123', name='Roborock S7 MaxV', local_key='key123key123key1', product_id='product-id-s7-maxv', fv='02.56.02', attribute=None, active_time=1672364449, runtime_env=None, time_zone_id='America/Los_Angeles', icon_url='no_url', lon=None, lat=None, share=False, share_time=None, online=True, pv='1.0', room_id=2362003, tuya_uuid=None, tuya_migrated=False, extra='{"RRPhotoPrivacyVersion": "1"}', sn='abc123', feature_set='2234201184108543', new_feature_set='0000000000002041', device_status={'121': 8, '122': 100, '123': 102, '124': 203, '125': 94, '126': 90, '127': 87, '128': 0, '133': 1, '120': 0}, silent_ota_switch=True, setting=None, f=None, create_time=None, cid=None, share_type=None, share_expired_time=None)], received_devices=[], lon=None, lat=None, geo_name=None, rooms=[HomeDataRoom(id=2362048, name='Example room 1'), HomeDataRoom(id=2362044, name='Example room 2'), HomeDataRoom(id=2362041, name='Example room 3')]), device_info={}, network_info={}, home_map_info={}, home_map_content={}, home_map_content_base64={}, device_features=None, trait_data=None) diff --git a/tests/devices/test_file_cache.py b/tests/devices/test_file_cache.py index 3ad5ffe5..fac248f8 100644 --- a/tests/devices/test_file_cache.py +++ b/tests/devices/test_file_cache.py @@ -48,7 +48,7 @@ async def test_get_from_non_existent_cache(cache_file: pathlib.Path) -> None: 1: CombinedMapInfo( map_flag=1, name="Test Map", - rooms=[NamedRoomMapping(segment_id=1023, iot_id="4321", name="Living Room")], + rooms=[NamedRoomMapping(segment_id=1023, iot_id="4321", raw_name="Living Room")], ) }, ), @@ -62,14 +62,14 @@ async def test_get_from_non_existent_cache(cache_file: pathlib.Path) -> None: map_flag=1, name="Test Map 1", rooms=[ - NamedRoomMapping(segment_id=1023, iot_id="4321", name="Living Room"), - NamedRoomMapping(segment_id=1024, iot_id="4322", name="Starship"), + NamedRoomMapping(segment_id=1023, iot_id="4321", raw_name="Living Room"), + NamedRoomMapping(segment_id=1024, iot_id="4322", raw_name="Starship"), ], ), 2: CombinedMapInfo( map_flag=2, name="Test Map 2", - rooms=[NamedRoomMapping(segment_id=2047, iot_id="5432", name="Bedroom")], + rooms=[NamedRoomMapping(segment_id=2047, iot_id="5432", raw_name="Bedroom")], ), }, home_map_content_base64={ diff --git a/tests/devices/traits/v1/test_home.py b/tests/devices/traits/v1/test_home.py index a6097561..dd85a8c9 100644 --- a/tests/devices/traits/v1/test_home.py +++ b/tests/devices/traits/v1/test_home.py @@ -6,7 +6,7 @@ import pytest -from roborock.data.containers import CombinedMapInfo, NamedRoomMapping +from roborock.data.containers import CombinedMapInfo, HomeDataRoom, NamedRoomMapping from roborock.data.v1.v1_code_mappings import RoborockStateCode from roborock.data.v1.v1_containers import MultiMapsListMapInfo, MultiMapsListRoom from roborock.devices.cache import DeviceCache, DeviceCacheData, InMemoryCache @@ -181,6 +181,7 @@ async def test_discover_home_empty_cache( mock_mqtt_rpc_channel: AsyncMock, mock_map_rpc_channel: AsyncMock, device_cache: DeviceCache, + web_api_client: AsyncMock, ) -> None: """Test discovering home when cache is empty.""" # Setup mocks for the discovery process @@ -199,6 +200,12 @@ async def test_discover_home_empty_cache( MAP_BYTES_RESPONSE_2, # Map bytes for 123 MAP_BYTES_RESPONSE_1, # Map bytes for 0 ] + # We have an empty home data so the room list gets loaded + web_api_client.get_rooms.return_value = [ + HomeDataRoom(id=2362048, name="Example room 1"), + HomeDataRoom(id=2362044, name="Example room 2"), + HomeDataRoom(id=2362041, name="Example room 3"), + ] # Before discovery, no cache should exist assert home_trait.home_map_info is None @@ -217,8 +224,10 @@ async def test_discover_home_empty_cache( assert map_0_data.name == "Ground Floor" assert len(map_0_data.rooms) == 2 assert map_0_data.rooms[0].segment_id == 16 + assert map_0_data.rooms[0].iot_id == "2362048" assert map_0_data.rooms[0].name == "Example room 1" assert map_0_data.rooms[1].segment_id == 17 + assert map_0_data.rooms[1].iot_id == "2362044" assert map_0_data.rooms[1].name == "Example room 2" map_0_content = home_trait.home_map_content[0] @@ -232,8 +241,10 @@ async def test_discover_home_empty_cache( assert map_123_data.name == "Second Floor" assert len(map_123_data.rooms) == 2 assert map_123_data.rooms[0].segment_id == 18 + assert map_123_data.rooms[0].iot_id == "2362041" assert map_123_data.rooms[0].name == "Example room 3" assert map_123_data.rooms[1].segment_id == 19 + assert map_123_data.rooms[0].iot_id == "2362041" assert map_123_data.rooms[1].name == "Room 19" # Not in mock home data map_123_content = home_trait.home_map_content[123] @@ -664,13 +675,15 @@ async def test_refresh_map_info_prefers_map_info_names_and_adds_missing_rooms( # - segment_id 18 with valid name: not in map_info, should be added # - segment_id 20 with valid name: overrides map_info fallback "Room 20" rooms_trait.rooms = [ - NamedRoomMapping(segment_id=16, iot_id="2362048", name="Room 16"), # Exists in map_info, should not override + NamedRoomMapping(segment_id=16, iot_id="2362048"), # Exists in map_info, should not override NamedRoomMapping( - segment_id=19, iot_id="2362042", name="Updated Bedroom Name" + segment_id=19, iot_id="2362042", raw_name="Updated Bedroom Name" ), # Exists in map_info, should not override - NamedRoomMapping(segment_id=17, iot_id="2362044", name="Room 17"), # Not in map_info, should be added - NamedRoomMapping(segment_id=18, iot_id="2362041", name="Example room 3"), # Not in map_info, should be added - NamedRoomMapping(segment_id=20, iot_id="9999001", name="Office from rooms_trait"), + NamedRoomMapping(segment_id=17, iot_id="2362044"), # Not in map_info, should be added + NamedRoomMapping( + segment_id=18, iot_id="2362041", raw_name="Example room 3" + ), # Not in map_info, should be added + NamedRoomMapping(segment_id=20, iot_id="9999001", raw_name="Office from rooms_trait"), ] # Mock rooms_trait.refresh to prevent actual device calls diff --git a/tests/devices/traits/v1/test_rooms.py b/tests/devices/traits/v1/test_rooms.py index ec930b6a..70dfb080 100644 --- a/tests/devices/traits/v1/test_rooms.py +++ b/tests/devices/traits/v1/test_rooms.py @@ -94,8 +94,8 @@ async def test_refresh_unknown_room_names_overwrites_home_data( await rooms_trait.refresh() assert rooms_trait.rooms - assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=16, iot_id="2362048", name="Living Room") - assert rooms_trait.rooms[1] == NamedRoomMapping(segment_id=17, iot_id="9999999", name="Office") + assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=16, iot_id="2362048", raw_name="Living Room") + assert rooms_trait.rooms[1] == NamedRoomMapping(segment_id=17, iot_id="9999999", raw_name="Office") home_data_rooms = {str(room.id): room.name for room in rooms_trait._home_data.rooms or ()} assert home_data_rooms["2362048"] == "Living Room" @@ -143,11 +143,13 @@ async def test_refresh_unknown_room_names_unresolved_uses_room_fallback( await rooms_trait.refresh() assert rooms_trait.rooms - assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=33, iot_id="9999922", name="Room 33") + assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=33, iot_id="9999922") + assert rooms_trait.rooms[0].name == "Room 33" await rooms_trait.refresh() assert rooms_trait.rooms - assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=33, iot_id="9999922", name="Room 33") + assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=33, iot_id="9999922") + assert rooms_trait.rooms[0].name == "Room 33" web_api_client.get_rooms.assert_called_once() @@ -202,5 +204,6 @@ async def test_refresh_unknown_room_names_failure_falls_back_to_room_segment_id( await rooms_trait.refresh() assert rooms_trait.rooms - assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=16, iot_id="9999401", name="Room 16") + assert rooms_trait.rooms[0] == NamedRoomMapping(segment_id=16, iot_id="9999401") + assert rooms_trait.rooms[0].name == "Room 16" web_api_client.get_rooms.assert_called_once() From dcf4df92b520c598cb81c362b5f6bca843aaa411 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 19:26:54 -0700 Subject: [PATCH 2/7] feat: Allow rooms trait to unconditionally override map info rooms during merging. --- roborock/data/v1/v1_containers.py | 4 ++-- roborock/devices/traits/v1/home.py | 27 +++++++++++---------------- roborock/devices/traits/v1/rooms.py | 2 +- tests/devices/traits/v1/test_home.py | 10 +++++----- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/roborock/data/v1/v1_containers.py b/roborock/data/v1/v1_containers.py index 4a64661d..2c2a0970 100644 --- a/roborock/data/v1/v1_containers.py +++ b/roborock/data/v1/v1_containers.py @@ -722,9 +722,9 @@ def mapFlag(self) -> int: def rooms_map(self) -> dict[int, NamedRoomMapping]: """Returns a dictionary of room mappings by segment id.""" return { - room.id: room.named_room_mapping + room.id: mapping for room in self.rooms or () - if room.id is not None and room.named_room_mapping is not None + if room.id is not None and (mapping := room.named_room_mapping) is not None } diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index dd87478f..d2ca0653 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -119,25 +119,20 @@ async def _refresh_map_info(self, map_info: MultiMapsListMapInfo) -> CombinedMap """Collect room data for a specific map and return CombinedMapInfo.""" await self._rooms_trait.refresh() - # We have room names from two sources. The map_info.rooms which we just - # received from the MultiMapsList or the self._rooms_trait.rooms which - # comes from the GET_ROOM_MAPPING command. We merge them, giving priority - # to map_info rooms, and excluding unset rooms from the trait. - rooms: list[NamedRoomMapping] = list( - { - **map_info.rooms_map, - **{ - room.segment_id: room - for room in self._rooms_trait.rooms or () - if (existing := map_info.rooms_map.get(room.segment_id)) is None - or (room.raw_name and existing.raw_name is None) - }, - }.values() - ) + # We have room names from multiple sources: + # - The map_info.rooms which we just received from the MultiMapsList + # - RoomsTrait rooms come from the GET_ROOM_MAPPING command for the current device (only) + # - RoomsTrait rooms that are pulled from the cloud API + # We always prefer the RoomsTrait room names since they are always newer and + # just refreshed above. + rooms_map: dict[str, NamedRoomMapping] = { + **map_info.rooms_map, + **{room.segment_id: room for room in self._rooms_trait.rooms or ()}, + } return CombinedMapInfo( map_flag=map_info.map_flag, name=map_info.name, - rooms=rooms, + rooms=list(rooms_map.values()), ) async def _refresh_map_content(self) -> MapContent: diff --git a/roborock/devices/traits/v1/rooms.py b/roborock/devices/traits/v1/rooms.py index 6df36295..8d90c41c 100644 --- a/roborock/devices/traits/v1/rooms.py +++ b/roborock/devices/traits/v1/rooms.py @@ -72,7 +72,7 @@ def _parse_rooms( ) async def _refresh_rooms(self) -> list[HomeDataRoom]: - """Merge the existing rooms with new rooms returned from the API.""" + """Fetch the latest rooms from the web API.""" try: return await self._web_api.get_rooms() except Exception: diff --git a/tests/devices/traits/v1/test_home.py b/tests/devices/traits/v1/test_home.py index dd85a8c9..8f9fde7c 100644 --- a/tests/devices/traits/v1/test_home.py +++ b/tests/devices/traits/v1/test_home.py @@ -244,7 +244,7 @@ async def test_discover_home_empty_cache( assert map_123_data.rooms[0].iot_id == "2362041" assert map_123_data.rooms[0].name == "Example room 3" assert map_123_data.rooms[1].segment_id == 19 - assert map_123_data.rooms[0].iot_id == "2362041" + assert map_123_data.rooms[1].iot_id == "2362042" assert map_123_data.rooms[1].name == "Room 19" # Not in mock home data map_123_content = home_trait.home_map_content[123] @@ -675,7 +675,7 @@ async def test_refresh_map_info_prefers_map_info_names_and_adds_missing_rooms( # - segment_id 18 with valid name: not in map_info, should be added # - segment_id 20 with valid name: overrides map_info fallback "Room 20" rooms_trait.rooms = [ - NamedRoomMapping(segment_id=16, iot_id="2362048"), # Exists in map_info, should not override + NamedRoomMapping(segment_id=16, iot_id="2362048"), # Will override even with no name NamedRoomMapping( segment_id=19, iot_id="2362042", raw_name="Updated Bedroom Name" ), # Exists in map_info, should not override @@ -697,9 +697,9 @@ async def test_refresh_map_info_prefers_map_info_names_and_adds_missing_rooms( # Sort rooms by segment_id for consistent assertions sorted_rooms = sorted(result.rooms, key=lambda r: r.segment_id) - # Room 16: from map_info, kept (not overridden by rooms_trait fallback) + # Room 16: from map_info is overridden by rooms_trait assert sorted_rooms[0].segment_id == 16 - assert sorted_rooms[0].name == "Kitchen from map_info" + assert sorted_rooms[0].name == "Room 16" assert sorted_rooms[0].iot_id == "2362048" # Room 17: from rooms_trait with fallback name, added because not in map_info @@ -714,7 +714,7 @@ async def test_refresh_map_info_prefers_map_info_names_and_adds_missing_rooms( # Room 19: from map_info, kept (not overridden by rooms_trait) assert sorted_rooms[3].segment_id == 19 - assert sorted_rooms[3].name == "Bedroom from map_info" + assert sorted_rooms[3].name == "Updated Bedroom Name" assert sorted_rooms[3].iot_id == "2362042" # Room 20: map_info fallback name replaced by rooms_trait name From 238f89768a4da517676d3d3a9a3f5f9b014e81b7 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 19:28:05 -0700 Subject: [PATCH 3/7] refactor: update rooms_map dictionary key type from string to integer --- roborock/devices/traits/v1/home.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index d2ca0653..2b84ef0a 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -125,7 +125,7 @@ async def _refresh_map_info(self, map_info: MultiMapsListMapInfo) -> CombinedMap # - RoomsTrait rooms that are pulled from the cloud API # We always prefer the RoomsTrait room names since they are always newer and # just refreshed above. - rooms_map: dict[str, NamedRoomMapping] = { + rooms_map: dict[int, NamedRoomMapping] = { **map_info.rooms_map, **{room.segment_id: room for room in self._rooms_trait.rooms or ()}, } From 562b8d363443150a4d2c33705756461e1aa702e7 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 19:30:29 -0700 Subject: [PATCH 4/7] refactor: move NamedRoomMapping import from roborock.data.containers to roborock.data --- roborock/devices/traits/v1/home.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index 2b84ef0a..e7864fd7 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -20,8 +20,7 @@ import logging from typing import Self -from roborock.data import CombinedMapInfo, MultiMapsListMapInfo, RoborockBase -from roborock.data.containers import NamedRoomMapping +from roborock.data import CombinedMapInfo, MultiMapsListMapInfo, NamedRoomMapping, RoborockBase from roborock.data.v1.v1_code_mappings import RoborockStateCode from roborock.devices.cache import DeviceCache from roborock.devices.traits.v1 import common From 924f106d9e06015e056d20b18e3f7d0927702f30 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 19:48:33 -0700 Subject: [PATCH 5/7] feat: add `current_rooms` property to the `Home` trait and include corresponding tests. --- roborock/devices/traits/v1/home.py | 5 +++++ tests/devices/traits/v1/test_home.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index e7864fd7..f34a21eb 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -221,6 +221,11 @@ def current_map_data(self) -> CombinedMapInfo | None: return None return self._home_map_info.get(current_map_flag) + @property + def current_rooms(self) -> list[NamedRoomMapping]: + """Returns the room names for the current map.""" + return self.current_map_data.rooms + @property def home_map_content(self) -> dict[int, MapContent] | None: """Returns the map content for all cached maps.""" diff --git a/tests/devices/traits/v1/test_home.py b/tests/devices/traits/v1/test_home.py index 8f9fde7c..f2871637 100644 --- a/tests/devices/traits/v1/test_home.py +++ b/tests/devices/traits/v1/test_home.py @@ -257,6 +257,10 @@ async def test_discover_home_empty_cache( assert current_map_data is not None assert current_map_data.map_flag == 0 assert current_map_data.name == "Ground Floor" + assert [room.name for room in home_trait.current_rooms] == [ + "Example room 1", + "Example room 2", + ] # Verify the persistent cache has been updated device_cache_data = await device_cache.get() @@ -507,6 +511,11 @@ async def test_discover_home_device_busy_cleaning( assert home_trait.home_map_info.keys() == {0} assert home_trait.home_map_content is not None assert home_trait.home_map_content.keys() == {0} + assert [room.name for room in home_trait.current_rooms] == [ + "Example room 1", + "Example room 2", + ] + map_0_content = home_trait.home_map_content[0] assert map_0_content is not None assert map_0_content.image_content == TEST_IMAGE_CONTENT_1 @@ -548,6 +557,10 @@ async def test_discover_home_device_busy_cleaning( assert home_trait.home_map_info.keys() == {0, 123} assert home_trait.home_map_content is not None assert home_trait.home_map_content.keys() == {0, 123} + assert [room.name for room in home_trait.current_rooms] == [ + "Room 16", + "Room 17", + ] # Verify the persistent cache has been updated device_cache_data = await device_cache.get() From 532f108667db3e43867da8c0ab06a6490175f4cc Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 19:50:52 -0700 Subject: [PATCH 6/7] Fix: Make `current_rooms` property return `None` if `current_map_data` is `None`. --- roborock/devices/traits/v1/home.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index f34a21eb..fd0ca881 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -222,8 +222,10 @@ def current_map_data(self) -> CombinedMapInfo | None: return self._home_map_info.get(current_map_flag) @property - def current_rooms(self) -> list[NamedRoomMapping]: + def current_rooms(self) -> list[NamedRoomMapping] | None: """Returns the room names for the current map.""" + if self.current_map_data is None: + return None return self.current_map_data.rooms @property From 27221b96b57c51336cc3f7d66c795e9a904de343 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 8 Mar 2026 20:37:16 -0700 Subject: [PATCH 7/7] chore: Update current_rooms to return empty list instead of None Change return type of current_rooms property to avoid returning None. --- roborock/devices/traits/v1/home.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roborock/devices/traits/v1/home.py b/roborock/devices/traits/v1/home.py index fd0ca881..cbe1fc1e 100644 --- a/roborock/devices/traits/v1/home.py +++ b/roborock/devices/traits/v1/home.py @@ -222,10 +222,10 @@ def current_map_data(self) -> CombinedMapInfo | None: return self._home_map_info.get(current_map_flag) @property - def current_rooms(self) -> list[NamedRoomMapping] | None: + def current_rooms(self) -> list[NamedRoomMapping]: """Returns the room names for the current map.""" if self.current_map_data is None: - return None + return [] return self.current_map_data.rooms @property