You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: Improve library user documentation
Update the documentation to answer basic questions from a first time library user perspective. Given the deeper submodules, it may be harder to find so we add details so users can understand the bigger picture.
Some existing documentation was focused more on design details for deeper implementation issues, so this clarifies what is lower level vs higher level.
* chore: fix typo in README.md
# Get all vacuum devices that support the v1 PropertiesApi
52
+
# Get all vacuum devices. Each device generation has different capabilities
53
+
# and APIs available so to find vacuums we filter by the v1 PropertiesApi.
54
54
for device in devices:
55
55
ifnot device.v1_properties:
56
56
continue
57
57
58
-
# Refresh the current device status
58
+
# The PropertiesAPI has traits different device commands such as getting
59
+
# status, sending clean commands, etc. For this example we send a
60
+
# command to refresh the current device status.
59
61
status_trait = device.v1_properties.status
60
62
await status_trait.refresh()
61
63
print(status_trait)
62
64
63
65
asyncio.run(main())
64
66
```
65
67
66
-
See [examples/example.py](examples/example.py) for a more full featured example
67
-
that has performance improvements to cache cloud information to prefer
68
-
connections over the local network.
68
+
69
+
## Functionality
70
+
71
+
The library interacts with devices through specific API properties based on the device protocol:
72
+
73
+
***Standard Vacuums (V1 Protocol)**: Most robot vacuums use this. Interaction is done through `device.v1_properties`, which contains traits like `status`, `consumables`, and `maps`. Use the `command` trait for actions like starting or stopping cleaning.
74
+
***Wet/Dry Vacuums & Washing Machines (A01 Protocol)**: Devices like the Dyad and Zeo use this. Interaction is done through `device.a01_properties` using `query_values()` and `set_value()`.
75
+
76
+
You can find detailed documentation for [Devices](https://python-roborock.github.io/python-roborock/roborock/devices/device.html) and [Traits](https://python-roborock.github.io/python-roborock/roborock/devices/traits.html).
77
+
69
78
70
79
## Supported devices
71
80
@@ -74,6 +83,7 @@ You can find what devices are supported
74
83
Please note this may not immediately contain the latest devices.
75
84
76
85
77
-
## Credits
86
+
## Acknowledgements
78
87
79
-
Thanks @rovo89 for https://gist.github.com/rovo89/dff47ed19fca0dfdda77503e66c2b7c7 And thanks @PiotrMachowski for https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor
88
+
* Thanks to [@rovo89](https://github.com/rovo89) for [Login APIs gist](https://gist.github.com/rovo89/dff47ed19fca0dfdda77503e66c2b7c7).
89
+
* Thanks to [@PiotrMachowski](https://github.com/PiotrMachowski) for [Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor](https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor).
Copy file name to clipboardExpand all lines: roborock/devices/README.md
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,19 @@ The devices module provides functionality to discover Roborock devices on the
4
4
network. This section documents the full lifecycle of device discovery across
5
5
Cloud and Network.
6
6
7
-
## Quick Start: Understanding Device Protocols
7
+
## Usage TL;DR
8
+
9
+
***Discovery**: Use `roborock.devices.device_manager.DeviceManager` to get device instances.
10
+
* Call `create_device_manager(user_params)` then `await device_manager.get_devices()`.
11
+
***Control**:
12
+
***Vacuums (V1)**: Use `device.v1_properties` to access traits like `status` or `consumables`.
13
+
* Call `await trait.refresh()` to update state.
14
+
* Use `device.v1_properties.command.send()` for raw commands (start/stop).
15
+
***Washers (A01)**: Use `device.a01_properties` for Dyad/Zeo devices.
16
+
* Use `await device.a01_properties.query_values([...])` to get state.
17
+
* Use `await device.a01_properties.set_value(protocol, value)` to control.
18
+
19
+
## Background: Understanding Device Protocols
8
20
9
21
**The library supports three device protocol versions, each with different capabilities:**
10
22
@@ -18,7 +30,7 @@ Cloud and Network.
18
30
19
31
**Key Point:** The `DeviceManager` automatically detects the protocol version and creates the appropriate channel type. You don't need to handle this manually.
20
32
21
-
## Architecture Overview
33
+
## Internal Architecture
22
34
23
35
The library is organized into distinct layers, each with a specific responsibility. **Different device protocols use different channel implementations:**
24
36
@@ -138,7 +150,7 @@ graph TB
138
150
|**A01** (`pv=A01`) |`MqttChannel` + helpers | ❌ No | Direct MQTT | Dyad, Zeo washers |
139
151
|**B01** (`pv=B01`) |`MqttChannel` + helpers | ❌ No | Direct MQTT | Some newer models |
140
152
141
-
## Init account setup
153
+
## Account Setup Internals
142
154
143
155
### Login
144
156
@@ -151,7 +163,7 @@ graph TB
151
163
- This contains information used to connect to MQTT
152
164
- You get an `-eu` suffix in the API URLs if you are in the eu and `-us` if you are in the us
153
165
154
-
## Home Data
166
+
## Home Data Internals
155
167
156
168
The `HomeData` includes information about the various devices in the home. We use `v3`
157
169
and it is notable that if devices don't show up in the `home_data` response it is likely
@@ -174,7 +186,7 @@ that a newer version of the API should be used.
174
186
- There is another REST request `get_rooms` that will do the same thing.
175
187
- Note: If we cache home_data, we likely need to use `get_rooms` to get rooms fresh
176
188
177
-
## Device Connections
189
+
## Connection Implementation
178
190
179
191
### Connection Flow by Protocol
180
192
@@ -343,7 +355,7 @@ graph LR
343
355
3.**Timeout Handling**: Commands timeout after 10 seconds if no response is received
344
356
4.**Multiple Strategies**: `V1Channel` tries local first, then falls back to MQTT if local fails
0 commit comments