|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import datetime |
| 4 | +import json |
4 | 5 | import logging |
5 | 6 | import re |
6 | 7 | from dataclasses import asdict, dataclass, field |
@@ -589,3 +590,79 @@ class ServerTimer(NamedTuple): |
589 | 590 | id: str |
590 | 591 | status: str |
591 | 592 | dontknow: int |
| 593 | + |
| 594 | + |
| 595 | +@dataclass |
| 596 | +class RoborockProductStateValue(RoborockBase): |
| 597 | + value: list |
| 598 | + desc: dict |
| 599 | + |
| 600 | + |
| 601 | +@dataclass |
| 602 | +class RoborockProductState(RoborockBase): |
| 603 | + dps: int |
| 604 | + desc: dict |
| 605 | + value: list[RoborockProductStateValue] |
| 606 | + |
| 607 | + |
| 608 | +@dataclass |
| 609 | +class RoborockProductSpec(RoborockBase): |
| 610 | + state: RoborockProductState |
| 611 | + battery: dict | None = None |
| 612 | + dry_countdown: dict | None = None |
| 613 | + extra: dict | None = None |
| 614 | + offpeak: dict | None = None |
| 615 | + countdown: dict | None = None |
| 616 | + mode: dict | None = None |
| 617 | + ota_nfo: dict | None = None |
| 618 | + pause: dict | None = None |
| 619 | + program: dict | None = None |
| 620 | + shutdown: dict | None = None |
| 621 | + washing_left: dict | None = None |
| 622 | + |
| 623 | + |
| 624 | +@dataclass |
| 625 | +class RoborockProduct(RoborockBase): |
| 626 | + id: int |
| 627 | + name: str |
| 628 | + model: str |
| 629 | + packagename: str |
| 630 | + ssid: str |
| 631 | + picurl: str |
| 632 | + cardpicurl: str |
| 633 | + medium_cardpicurl: str |
| 634 | + resetwifipicurl: str |
| 635 | + resetwifitext: dict |
| 636 | + tuyaid: str |
| 637 | + status: int |
| 638 | + rriotid: str |
| 639 | + cardspec: str |
| 640 | + pictures: list |
| 641 | + nc_mode: str |
| 642 | + scope: None |
| 643 | + product_tags: list |
| 644 | + agreements: list |
| 645 | + plugin_pic_url: None |
| 646 | + products_specification: RoborockProductSpec | None = None |
| 647 | + |
| 648 | + def __post_init__(self): |
| 649 | + if self.cardspec: |
| 650 | + self.products_specification = RoborockProductSpec.from_dict(json.loads(self.cardspec).get("data")) |
| 651 | + |
| 652 | + |
| 653 | +@dataclass |
| 654 | +class RoborockProductCategory(RoborockBase): |
| 655 | + id: int |
| 656 | + display_name: str |
| 657 | + icon_url: str |
| 658 | + |
| 659 | + |
| 660 | +@dataclass |
| 661 | +class RoborockCategoryDetail(RoborockBase): |
| 662 | + category: RoborockProductCategory |
| 663 | + product_list: list[RoborockProduct] |
| 664 | + |
| 665 | + |
| 666 | +@dataclass |
| 667 | +class ProductResponse(RoborockBase): |
| 668 | + category_detail_list: list[RoborockCategoryDetail] |
0 commit comments