2023-04-20 14:02:58 +00:00
|
|
|
"""Roborock Models."""
|
2024-03-08 14:05:07 +00:00
|
|
|
|
2023-04-20 14:02:58 +00:00
|
|
|
from dataclasses import dataclass
|
2023-06-07 01:24:36 +00:00
|
|
|
from typing import Any
|
2023-04-20 14:02:58 +00:00
|
|
|
|
|
|
|
from roborock.containers import HomeDataDevice, HomeDataProduct, NetworkInfo
|
2023-05-19 03:55:39 +00:00
|
|
|
from roborock.roborock_typing import DeviceProp
|
2023-04-20 14:02:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class RoborockHassDeviceInfo:
|
|
|
|
"""A model to describe roborock devices."""
|
|
|
|
|
|
|
|
device: HomeDataDevice
|
|
|
|
network_info: NetworkInfo
|
|
|
|
product: HomeDataProduct
|
2023-04-27 19:10:34 +00:00
|
|
|
props: DeviceProp
|
2023-06-07 01:24:36 +00:00
|
|
|
|
|
|
|
def as_dict(self) -> dict[str, dict[str, Any]]:
|
|
|
|
"""Turn RoborockHassDeviceInfo into a dictionary."""
|
|
|
|
return {
|
|
|
|
"device": self.device.as_dict(),
|
|
|
|
"network_info": self.network_info.as_dict(),
|
|
|
|
"product": self.product.as_dict(),
|
|
|
|
"props": self.props.as_dict(),
|
|
|
|
}
|
2024-04-08 19:40:59 +00:00
|
|
|
|
|
|
|
|
2024-06-26 13:40:19 +00:00
|
|
|
@dataclass
|
|
|
|
class RoborockA01HassDeviceInfo:
|
|
|
|
"""A model to describe A01 roborock devices."""
|
|
|
|
|
|
|
|
device: HomeDataDevice
|
|
|
|
product: HomeDataProduct
|
|
|
|
|
|
|
|
def as_dict(self) -> dict[str, dict[str, Any]]:
|
|
|
|
"""Turn RoborockA01HassDeviceInfo into a dictionary."""
|
|
|
|
return {
|
|
|
|
"device": self.device.as_dict(),
|
|
|
|
"product": self.product.as_dict(),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-08 19:40:59 +00:00
|
|
|
@dataclass
|
|
|
|
class RoborockMapInfo:
|
|
|
|
"""A model to describe all information about a map we may want."""
|
|
|
|
|
|
|
|
flag: int
|
|
|
|
name: str
|
|
|
|
rooms: dict[int, str]
|