|
9 | 9 | from typing import Any, Protocol |
10 | 10 |
|
11 | 11 | from roborock.data import CombinedMapInfo, HomeData, NetworkInfo, RoborockBase |
| 12 | +from roborock.data.containers import RoborockBase |
12 | 13 | from roborock.device_features import DeviceFeatures |
13 | 14 |
|
14 | 15 |
|
| 16 | +@dataclass |
| 17 | +class DeviceCacheData(RoborockBase): |
| 18 | + """Data structure for caching device information.""" |
| 19 | + |
| 20 | + network_info: NetworkInfo | None = None |
| 21 | + """Network information indexed by device DUID.""" |
| 22 | + |
| 23 | + home_map_info: CombinedMapInfo | None = None |
| 24 | + """Home map information for the device.""" |
| 25 | + |
| 26 | + home_map_content_base64: str | None = None |
| 27 | + """Home cache content for the device (encoded base64).""" |
| 28 | + |
| 29 | + device_features: DeviceFeatures | None = None |
| 30 | + """Device features information.""" |
| 31 | + |
| 32 | + trait_data: dict[str, Any] | None = None |
| 33 | + """Trait-specific cached data used internally for caching device features.""" |
| 34 | + |
| 35 | + |
15 | 36 | @dataclass |
16 | 37 | class CacheData(RoborockBase): |
17 | 38 | """Data structure for caching device information.""" |
18 | 39 |
|
19 | 40 | home_data: HomeData | None = None |
20 | 41 | """Home data containing device and product information.""" |
21 | 42 |
|
| 43 | + device_info: dict[str, DeviceCacheData] = field(default_factory=dict) |
| 44 | + """Per-device cached information indexed by device DUID.""" |
| 45 | + |
22 | 46 | network_info: dict[str, NetworkInfo] = field(default_factory=dict) |
23 | | - """Network information indexed by device DUID.""" |
| 47 | + """Network information indexed by device DUID. |
| 48 | + |
| 49 | + This is deprecated. Use the per-device `network_info` field instead. |
| 50 | + """ |
24 | 51 |
|
25 | 52 | home_map_info: dict[int, CombinedMapInfo] = field(default_factory=dict) |
26 | | - """Home map information indexed by map_flag.""" |
| 53 | + """Home map information indexed by map_flag. |
| 54 | + |
| 55 | + This is deprecated. Use the per-device `home_map_info` field instead. |
| 56 | + """ |
27 | 57 |
|
28 | 58 | home_map_content: dict[int, bytes] = field(default_factory=dict) |
29 | 59 | """Home cache content for each map data indexed by map_flag. |
30 | 60 |
|
31 | | - This is deprecated in favor of `home_map_content_base64`. |
| 61 | + This is deprecated. Use the per-device `home_map_content_base64` field instead. |
32 | 62 | """ |
33 | 63 |
|
34 | 64 | home_map_content_base64: dict[int, str] = field(default_factory=dict) |
35 | | - """Home cache content for each map data (encoded base64) indexed by map_flag.""" |
| 65 | + """Home cache content for each map data (encoded base64) indexed by map_flag. |
| 66 | + |
| 67 | + This is deprecated. Use the per-device `home_map_content_base64` field instead. |
| 68 | + """ |
36 | 69 |
|
37 | 70 | device_features: DeviceFeatures | None = None |
38 | | - """Device features information.""" |
| 71 | + """Device features information. |
| 72 | + |
| 73 | + This is deprecated. Use the per-device `device_features` field instead. |
| 74 | + """ |
39 | 75 |
|
40 | 76 | trait_data: dict[str, Any] | None = None |
41 | | - """Trait-specific cached data used internally for caching device features.""" |
| 77 | + """Trait-specific cached data used internally for caching device features. |
| 78 | + |
| 79 | + This is deprecated. Use the per-device `trait_data` field instead. |
| 80 | + """ |
42 | 81 |
|
43 | 82 |
|
44 | 83 | class Cache(Protocol): |
|
0 commit comments