|
92 | 92 |
|
93 | 93 | @dataclass |
94 | 94 | class Status(RoborockBase): |
| 95 | + """This status will be depreciated in favor of StatusV2.""" |
| 96 | + |
95 | 97 | msg_ver: int | None = None |
96 | 98 | msg_seq: int | None = None |
97 | 99 | state: RoborockStateCode | None = None |
@@ -250,6 +252,137 @@ def __repr__(self) -> str: |
250 | 252 | return _attr_repr(self) |
251 | 253 |
|
252 | 254 |
|
| 255 | +class StatusV2(RoborockBase): |
| 256 | + """ |
| 257 | + This is a new version of the Status object. |
| 258 | + This is the result of GET_STATUS from the api. |
| 259 | + """ |
| 260 | + |
| 261 | + msg_ver: int | None = None |
| 262 | + msg_seq: int | None = None |
| 263 | + state: RoborockStateCode | None = None |
| 264 | + battery: int | None = None |
| 265 | + clean_time: int | None = None |
| 266 | + clean_area: int | None = None |
| 267 | + error_code: RoborockErrorCode | None = None |
| 268 | + map_present: int | None = None |
| 269 | + in_cleaning: RoborockInCleaning | None = None |
| 270 | + in_returning: int | None = None |
| 271 | + in_fresh_state: int | None = None |
| 272 | + lab_status: int | None = None |
| 273 | + water_box_status: int | None = None |
| 274 | + back_type: int | None = None |
| 275 | + wash_phase: int | None = None |
| 276 | + wash_ready: int | None = None |
| 277 | + fan_power: int | None = None |
| 278 | + dnd_enabled: int | None = None |
| 279 | + map_status: int | None = None |
| 280 | + is_locating: int | None = None |
| 281 | + lock_status: int | None = None |
| 282 | + water_box_mode: int | None = None |
| 283 | + water_box_carriage_status: int | None = None |
| 284 | + mop_forbidden_enable: int | None = None |
| 285 | + camera_status: int | None = None |
| 286 | + is_exploring: int | None = None |
| 287 | + home_sec_status: int | None = None |
| 288 | + home_sec_enable_password: int | None = None |
| 289 | + adbumper_status: list[int] | None = None |
| 290 | + water_shortage_status: int | None = None |
| 291 | + dock_type: RoborockDockTypeCode | None = None |
| 292 | + dust_collection_status: int | None = None |
| 293 | + auto_dust_collection: int | None = None |
| 294 | + avoid_count: int | None = None |
| 295 | + mop_mode: int | None = None |
| 296 | + debug_mode: int | None = None |
| 297 | + collision_avoid_status: int | None = None |
| 298 | + switch_map_mode: int | None = None |
| 299 | + dock_error_status: RoborockDockErrorCode | None = None |
| 300 | + charge_status: int | None = None |
| 301 | + unsave_map_reason: int | None = None |
| 302 | + unsave_map_flag: int | None = None |
| 303 | + wash_status: int | None = None |
| 304 | + distance_off: int | None = None |
| 305 | + in_warmup: int | None = None |
| 306 | + dry_status: int | None = None |
| 307 | + rdt: int | None = None |
| 308 | + clean_percent: int | None = None |
| 309 | + rss: int | None = None |
| 310 | + dss: int | None = None |
| 311 | + common_status: int | None = None |
| 312 | + corner_clean_mode: int | None = None |
| 313 | + last_clean_t: int | None = None |
| 314 | + replenish_mode: int | None = None |
| 315 | + repeat: int | None = None |
| 316 | + kct: int | None = None |
| 317 | + subdivision_sets: int | None = None |
| 318 | + |
| 319 | + @property |
| 320 | + def square_meter_clean_area(self) -> float | None: |
| 321 | + return round(self.clean_area / 1000000, 1) if self.clean_area is not None else None |
| 322 | + |
| 323 | + @property |
| 324 | + def error_code_name(self) -> str | None: |
| 325 | + return self.error_code.name if self.error_code is not None else None |
| 326 | + |
| 327 | + @property |
| 328 | + def state_name(self) -> str | None: |
| 329 | + return self.state.name if self.state is not None else None |
| 330 | + |
| 331 | + @property |
| 332 | + def current_map(self) -> int | None: |
| 333 | + """Returns the current map ID if the map is present.""" |
| 334 | + if self.map_status is not None: |
| 335 | + map_flag = self.map_status >> 2 |
| 336 | + if map_flag != NO_MAP: |
| 337 | + return map_flag |
| 338 | + return None |
| 339 | + |
| 340 | + @property |
| 341 | + def clear_water_box_status(self) -> ClearWaterBoxStatus | None: |
| 342 | + if self.dss: |
| 343 | + return ClearWaterBoxStatus((self.dss >> 2) & 3) |
| 344 | + return None |
| 345 | + |
| 346 | + @property |
| 347 | + def dirty_water_box_status(self) -> DirtyWaterBoxStatus | None: |
| 348 | + if self.dss: |
| 349 | + return DirtyWaterBoxStatus((self.dss >> 4) & 3) |
| 350 | + return None |
| 351 | + |
| 352 | + @property |
| 353 | + def dust_bag_status(self) -> DustBagStatus | None: |
| 354 | + if self.dss: |
| 355 | + return DustBagStatus((self.dss >> 6) & 3) |
| 356 | + return None |
| 357 | + |
| 358 | + @property |
| 359 | + def water_box_filter_status(self) -> int | None: |
| 360 | + if self.dss: |
| 361 | + return (self.dss >> 8) & 3 |
| 362 | + return None |
| 363 | + |
| 364 | + @property |
| 365 | + def clean_fluid_status(self) -> int | None: |
| 366 | + if self.dss: |
| 367 | + return (self.dss >> 10) & 3 |
| 368 | + return None |
| 369 | + |
| 370 | + @property |
| 371 | + def hatch_door_status(self) -> int | None: |
| 372 | + if self.dss: |
| 373 | + return (self.dss >> 12) & 7 |
| 374 | + return None |
| 375 | + |
| 376 | + @property |
| 377 | + def dock_cool_fan_status(self) -> int | None: |
| 378 | + if self.dss: |
| 379 | + return (self.dss >> 15) & 3 |
| 380 | + return None |
| 381 | + |
| 382 | + def __repr__(self) -> str: |
| 383 | + return _attr_repr(self) |
| 384 | + |
| 385 | + |
253 | 386 | @dataclass |
254 | 387 | class S4MaxStatus(Status): |
255 | 388 | fan_power: RoborockFanSpeedS6Pure | None = None |
|
0 commit comments