Home Assistant Unofficial Reference 2024.12.1
models.py
Go to the documentation of this file.
1 """Roborock Models."""
2 
3 from dataclasses import dataclass
4 from typing import Any
5 
6 from roborock.containers import HomeDataDevice, HomeDataProduct, NetworkInfo
7 from roborock.roborock_typing import DeviceProp
8 
9 
10 @dataclass
12  """A model to describe roborock devices."""
13 
14  device: HomeDataDevice
15  network_info: NetworkInfo
16  product: HomeDataProduct
17  props: DeviceProp
18 
19  def as_dict(self) -> dict[str, dict[str, Any]]:
20  """Turn RoborockHassDeviceInfo into a dictionary."""
21  return {
22  "device": self.device.as_dict(),
23  "network_info": self.network_info.as_dict(),
24  "product": self.product.as_dict(),
25  "props": self.props.as_dict(),
26  }
27 
28 
29 @dataclass
31  """A model to describe A01 roborock devices."""
32 
33  device: HomeDataDevice
34  product: HomeDataProduct
35 
36  def as_dict(self) -> dict[str, dict[str, Any]]:
37  """Turn RoborockA01HassDeviceInfo into a dictionary."""
38  return {
39  "device": self.device.as_dict(),
40  "product": self.product.as_dict(),
41  }
42 
43 
44 @dataclass
46  """A model to describe all information about a map we may want."""
47 
48  flag: int
49  name: str
50  rooms: dict[int, str]