botslab360 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 placix
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: botslab360
3
+ Version: 0.1.0
4
+ Summary: Async Python client for Botslab/360 robot vacuums
5
+ License-Expression: MIT
6
+ Project-URL: Source, https://github.com/placix/python-botslab360
7
+ Project-URL: Issues, https://github.com/placix/python-botslab360/issues
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: cryptography>=42
15
+ Requires-Dist: httpx<1,>=0.27
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest>=8; extra == "test"
18
+ Dynamic: license-file
19
+
20
+ # botslab360
21
+
22
+ Async Python client for Botslab / 360 robot vacuums.
23
+
24
+ This project provides an unofficial Python interface for selected 360 robot vacuum cleaners and is intended as a reusable library for integrations such as Home Assistant.
25
+
26
+ > [!WARNING]
27
+ > This project is unofficial and not affiliated with Botslab, Qihoo 360 or 360 Smart Home.
28
+ > Version `0.1.0` should be considered experimental.
29
+
30
+ ## Features
31
+
32
+ Currently implemented:
33
+
34
+ - Qihoo `Q` / `T` session authentication
35
+ - Automatic `qid` derivation
36
+ - Smart Home login and session handling
37
+ - Automatic Smart Home SID refresh
38
+ - Device discovery
39
+ - Robot status retrieval
40
+ - TCP / push protocol communication
41
+ - AES decryption of push messages
42
+ - Start cleaning
43
+ - Pause cleaning
44
+ - Resume cleaning
45
+ - Return to dock
46
+ - Locate robot
47
+
48
+ Currently tested with:
49
+
50
+ - 360 S9-P / X90
51
+
52
+ Other models may work but have not yet been verified.
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install botslab360
58
+ ```
59
+
60
+ Python 3.10 or newer is required.
61
+
62
+ ## Authentication
63
+
64
+ The library currently uses authenticated Qihoo 360 account session tokens:
65
+
66
+ - `Q`
67
+ - `T`
68
+
69
+ These tokens can be obtained from an authenticated 360 web session.
70
+
71
+ They must be treated like credentials.
72
+
73
+ Never publish or log:
74
+
75
+ - `Q`
76
+ - `T`
77
+ - `qid`
78
+ - `sid`
79
+ - `pushKey`
80
+
81
+ The library does not implement automatic captcha solving or the proprietary Qihoo Account SDK.
82
+
83
+ ## Basic usage
84
+
85
+ ```python
86
+ import asyncio
87
+
88
+ from botslab360 import Botslab360Client
89
+
90
+
91
+ async def main() -> None:
92
+ q = "YOUR_Q_TOKEN"
93
+ t = "YOUR_T_TOKEN"
94
+
95
+ async with Botslab360Client(q, t) as client:
96
+ await client.authenticate()
97
+
98
+ devices = await client.get_devices()
99
+
100
+ for device in devices:
101
+ print(device.name)
102
+ print(device.model)
103
+
104
+ status = await client.get_status(device)
105
+
106
+ print(f"Battery: {status.battery}%")
107
+ print(f"State: {status.state}")
108
+ print(f"Charging: {status.charging}")
109
+
110
+
111
+ asyncio.run(main())
112
+ ```
113
+
114
+ For real applications, do not hard-code credentials. Load them securely from configuration or environment-specific secret storage.
115
+
116
+ ## Robot control
117
+
118
+ ```python
119
+ async with Botslab360Client(q, t) as client:
120
+ await client.authenticate()
121
+
122
+ devices = await client.get_devices()
123
+ robot = devices[0]
124
+
125
+ await client.start_cleaning(robot)
126
+ await client.pause(robot)
127
+ await client.resume(robot)
128
+ await client.return_to_dock(robot)
129
+ await client.locate(robot)
130
+ ```
131
+
132
+ ## Status information
133
+
134
+ Depending on the robot model, status information may include:
135
+
136
+ - Battery level
137
+ - Robot state
138
+ - Charging state
139
+ - Fan mode
140
+ - Cleaned area in square metres
141
+ - Cleaning time in seconds
142
+ - Error code
143
+ - Online state
144
+
145
+ Example:
146
+
147
+ ```text
148
+ Device: 360 Saugroboter
149
+ Model: S9-P
150
+ Battery: 100 %
151
+ State: fullcharge
152
+ Charging: True
153
+ Fan mode: strong
154
+ Cleaned area: 5
155
+ Cleaning time: 157
156
+ Error code: 0
157
+ ```
158
+
159
+ ## Session handling
160
+
161
+ The library distinguishes between the Qihoo account session and the Smart Home session.
162
+
163
+ Conceptually:
164
+
165
+ ```text
166
+ Q + T
167
+ ↓
168
+ qid
169
+ ↓
170
+ Smart Home login
171
+ ↓
172
+ sid + pushKey
173
+ ↓
174
+ Device communication
175
+ ```
176
+
177
+ If the Smart Home SID expires, the library performs one automatic re-authentication attempt using the existing `Q` and `T` tokens.
178
+
179
+ If the underlying Qihoo account session is no longer valid, the caller must provide new `Q` and `T` tokens.
180
+
181
+ ## Development
182
+
183
+ Clone the repository:
184
+
185
+ ```bash
186
+ git clone https://github.com/placix/python-botslab360.git
187
+ cd python-botslab360
188
+ ```
189
+
190
+ Create a virtual environment:
191
+
192
+ ```bash
193
+ python -m venv .venv
194
+ ```
195
+
196
+ Activate it on Windows:
197
+
198
+ ```powershell
199
+ .\.venv\Scripts\Activate.ps1
200
+ ```
201
+
202
+ Install in editable mode:
203
+
204
+ ```bash
205
+ python -m pip install -e .
206
+ ```
207
+
208
+ Install test dependencies:
209
+
210
+ ```bash
211
+ python -m pip install -e ".[test]"
212
+ ```
213
+
214
+ Run the test suite:
215
+
216
+ ```bash
217
+ pytest
218
+ ```
219
+
220
+ ## Project status
221
+
222
+ The library is currently under active development.
223
+
224
+ The current focus is providing a clean protocol layer that can later be used by a native Home Assistant integration.
225
+
226
+ Planned future work may include:
227
+
228
+ - Additional robot models
229
+ - Persistent push connection
230
+ - Fan speed control
231
+ - Room cleaning
232
+ - Zone cleaning
233
+ - Map support
234
+
235
+ ## Security
236
+
237
+ Authentication and session values must be treated as secrets.
238
+
239
+ Do not include real credentials in:
240
+
241
+ - bug reports
242
+ - screenshots
243
+ - logs
244
+ - test fixtures
245
+ - Git commits
246
+
247
+ ## License
248
+
249
+ MIT
250
+
251
+ ## Links
252
+
253
+ - Source: https://github.com/placix/python-botslab360
254
+ - Issues: https://github.com/placix/python-botslab360/issues
@@ -0,0 +1,235 @@
1
+ # botslab360
2
+
3
+ Async Python client for Botslab / 360 robot vacuums.
4
+
5
+ This project provides an unofficial Python interface for selected 360 robot vacuum cleaners and is intended as a reusable library for integrations such as Home Assistant.
6
+
7
+ > [!WARNING]
8
+ > This project is unofficial and not affiliated with Botslab, Qihoo 360 or 360 Smart Home.
9
+ > Version `0.1.0` should be considered experimental.
10
+
11
+ ## Features
12
+
13
+ Currently implemented:
14
+
15
+ - Qihoo `Q` / `T` session authentication
16
+ - Automatic `qid` derivation
17
+ - Smart Home login and session handling
18
+ - Automatic Smart Home SID refresh
19
+ - Device discovery
20
+ - Robot status retrieval
21
+ - TCP / push protocol communication
22
+ - AES decryption of push messages
23
+ - Start cleaning
24
+ - Pause cleaning
25
+ - Resume cleaning
26
+ - Return to dock
27
+ - Locate robot
28
+
29
+ Currently tested with:
30
+
31
+ - 360 S9-P / X90
32
+
33
+ Other models may work but have not yet been verified.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install botslab360
39
+ ```
40
+
41
+ Python 3.10 or newer is required.
42
+
43
+ ## Authentication
44
+
45
+ The library currently uses authenticated Qihoo 360 account session tokens:
46
+
47
+ - `Q`
48
+ - `T`
49
+
50
+ These tokens can be obtained from an authenticated 360 web session.
51
+
52
+ They must be treated like credentials.
53
+
54
+ Never publish or log:
55
+
56
+ - `Q`
57
+ - `T`
58
+ - `qid`
59
+ - `sid`
60
+ - `pushKey`
61
+
62
+ The library does not implement automatic captcha solving or the proprietary Qihoo Account SDK.
63
+
64
+ ## Basic usage
65
+
66
+ ```python
67
+ import asyncio
68
+
69
+ from botslab360 import Botslab360Client
70
+
71
+
72
+ async def main() -> None:
73
+ q = "YOUR_Q_TOKEN"
74
+ t = "YOUR_T_TOKEN"
75
+
76
+ async with Botslab360Client(q, t) as client:
77
+ await client.authenticate()
78
+
79
+ devices = await client.get_devices()
80
+
81
+ for device in devices:
82
+ print(device.name)
83
+ print(device.model)
84
+
85
+ status = await client.get_status(device)
86
+
87
+ print(f"Battery: {status.battery}%")
88
+ print(f"State: {status.state}")
89
+ print(f"Charging: {status.charging}")
90
+
91
+
92
+ asyncio.run(main())
93
+ ```
94
+
95
+ For real applications, do not hard-code credentials. Load them securely from configuration or environment-specific secret storage.
96
+
97
+ ## Robot control
98
+
99
+ ```python
100
+ async with Botslab360Client(q, t) as client:
101
+ await client.authenticate()
102
+
103
+ devices = await client.get_devices()
104
+ robot = devices[0]
105
+
106
+ await client.start_cleaning(robot)
107
+ await client.pause(robot)
108
+ await client.resume(robot)
109
+ await client.return_to_dock(robot)
110
+ await client.locate(robot)
111
+ ```
112
+
113
+ ## Status information
114
+
115
+ Depending on the robot model, status information may include:
116
+
117
+ - Battery level
118
+ - Robot state
119
+ - Charging state
120
+ - Fan mode
121
+ - Cleaned area in square metres
122
+ - Cleaning time in seconds
123
+ - Error code
124
+ - Online state
125
+
126
+ Example:
127
+
128
+ ```text
129
+ Device: 360 Saugroboter
130
+ Model: S9-P
131
+ Battery: 100 %
132
+ State: fullcharge
133
+ Charging: True
134
+ Fan mode: strong
135
+ Cleaned area: 5
136
+ Cleaning time: 157
137
+ Error code: 0
138
+ ```
139
+
140
+ ## Session handling
141
+
142
+ The library distinguishes between the Qihoo account session and the Smart Home session.
143
+
144
+ Conceptually:
145
+
146
+ ```text
147
+ Q + T
148
+ ↓
149
+ qid
150
+ ↓
151
+ Smart Home login
152
+ ↓
153
+ sid + pushKey
154
+ ↓
155
+ Device communication
156
+ ```
157
+
158
+ If the Smart Home SID expires, the library performs one automatic re-authentication attempt using the existing `Q` and `T` tokens.
159
+
160
+ If the underlying Qihoo account session is no longer valid, the caller must provide new `Q` and `T` tokens.
161
+
162
+ ## Development
163
+
164
+ Clone the repository:
165
+
166
+ ```bash
167
+ git clone https://github.com/placix/python-botslab360.git
168
+ cd python-botslab360
169
+ ```
170
+
171
+ Create a virtual environment:
172
+
173
+ ```bash
174
+ python -m venv .venv
175
+ ```
176
+
177
+ Activate it on Windows:
178
+
179
+ ```powershell
180
+ .\.venv\Scripts\Activate.ps1
181
+ ```
182
+
183
+ Install in editable mode:
184
+
185
+ ```bash
186
+ python -m pip install -e .
187
+ ```
188
+
189
+ Install test dependencies:
190
+
191
+ ```bash
192
+ python -m pip install -e ".[test]"
193
+ ```
194
+
195
+ Run the test suite:
196
+
197
+ ```bash
198
+ pytest
199
+ ```
200
+
201
+ ## Project status
202
+
203
+ The library is currently under active development.
204
+
205
+ The current focus is providing a clean protocol layer that can later be used by a native Home Assistant integration.
206
+
207
+ Planned future work may include:
208
+
209
+ - Additional robot models
210
+ - Persistent push connection
211
+ - Fan speed control
212
+ - Room cleaning
213
+ - Zone cleaning
214
+ - Map support
215
+
216
+ ## Security
217
+
218
+ Authentication and session values must be treated as secrets.
219
+
220
+ Do not include real credentials in:
221
+
222
+ - bug reports
223
+ - screenshots
224
+ - logs
225
+ - test fixtures
226
+ - Git commits
227
+
228
+ ## License
229
+
230
+ MIT
231
+
232
+ ## Links
233
+
234
+ - Source: https://github.com/placix/python-botslab360
235
+ - Issues: https://github.com/placix/python-botslab360/issues
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "botslab360"
7
+ version = "0.1.0"
8
+ description = "Async Python client for Botslab/360 robot vacuums"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+
14
+ dependencies = [
15
+ "cryptography>=42",
16
+ "httpx>=0.27,<1",
17
+ ]
18
+
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ ]
24
+
25
+ [project.optional-dependencies]
26
+ test = [
27
+ "pytest>=8",
28
+ ]
29
+
30
+ [project.urls]
31
+ Source = "https://github.com/placix/python-botslab360"
32
+ Issues = "https://github.com/placix/python-botslab360/issues"
33
+
34
+ [tool.setuptools.packages.find]
35
+ where = ["src"]
36
+
37
+ [tool.pytest.ini_options]
38
+ addopts = "-q"
39
+ pythonpath = ["src"]
40
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ """Async authentication for Botslab/360 smart-home devices."""
2
+
3
+ from .auth import BotslabAuth, credentials_from_tokens, derive_qid
4
+ from .client import Botslab360Client
5
+ from .exceptions import (
6
+ ApiError,
7
+ AuthenticationError,
8
+ Botslab360Error,
9
+ InvalidSessionError,
10
+ )
11
+ from .models import Device, QihooCredentials, RobotStatus, SmartSession
12
+
13
+ __all__ = [
14
+ "ApiError",
15
+ "AuthenticationError",
16
+ "Botslab360Client",
17
+ "Botslab360Error",
18
+ "BotslabAuth",
19
+ "Device",
20
+ "InvalidSessionError",
21
+ "QihooCredentials",
22
+ "RobotStatus",
23
+ "SmartSession",
24
+ "credentials_from_tokens",
25
+ "derive_qid",
26
+ ]