botslab360 0.6.0__tar.gz → 0.7.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.
- {botslab360-0.6.0/src/botslab360.egg-info → botslab360-0.7.0}/PKG-INFO +10 -1
- {botslab360-0.6.0 → botslab360-0.7.0}/README.md +9 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/pyproject.toml +1 -1
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/models.py +9 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/protocol.py +42 -0
- {botslab360-0.6.0 → botslab360-0.7.0/src/botslab360.egg-info}/PKG-INFO +10 -1
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_protocol.py +81 -1
- {botslab360-0.6.0 → botslab360-0.7.0}/ATTRIBUTION.md +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/LICENSE +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/setup.cfg +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/__init__.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/auth.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/client.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/commands.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/exceptions.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/quc.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360/rooms.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360.egg-info/SOURCES.txt +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360.egg-info/dependency_links.txt +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360.egg-info/requires.txt +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/src/botslab360.egg-info/top_level.txt +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_android_360_diagnostic.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_auth.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_commands.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_compare_android_quc.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_credentials_auth_example.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_devices.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_network_info.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_network_info_diagnostic.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_public_robot360_auth_diagnostic.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_public_room_api_diagnostic.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_quc.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_room_diagnostic.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_rooms.py +0 -0
- {botslab360-0.6.0 → botslab360-0.7.0}/tests/test_status.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: botslab360
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Async Python client for Botslab/360 robot vacuums
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Source, https://github.com/placix/python-botslab360
|
|
@@ -174,6 +174,15 @@ async def main() -> None:
|
|
|
174
174
|
asyncio.run(main())
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
`RobotStatus` also exposes optional diagnostic values reported by status
|
|
178
|
+
command `20001`: the raw lifetime-area counter, lifetime cleaning time in
|
|
179
|
+
seconds, raw current and previous sub-state, raw map position, raw heading,
|
|
180
|
+
timer status, and auto-boost state. The units of `total_cleaned_area_raw`,
|
|
181
|
+
`position_x`, `position_y`, and `heading` are not established, so these values
|
|
182
|
+
are returned without conversion or a claimed physical unit. Missing fields
|
|
183
|
+
remain `None`; raw integer states are intentionally not assigned guessed
|
|
184
|
+
meanings.
|
|
185
|
+
|
|
177
186
|
For real applications, do not hard-code credentials. Load them securely from configuration or environment-specific secret storage.
|
|
178
187
|
|
|
179
188
|
## Robot control
|
|
@@ -154,6 +154,15 @@ async def main() -> None:
|
|
|
154
154
|
asyncio.run(main())
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
`RobotStatus` also exposes optional diagnostic values reported by status
|
|
158
|
+
command `20001`: the raw lifetime-area counter, lifetime cleaning time in
|
|
159
|
+
seconds, raw current and previous sub-state, raw map position, raw heading,
|
|
160
|
+
timer status, and auto-boost state. The units of `total_cleaned_area_raw`,
|
|
161
|
+
`position_x`, `position_y`, and `heading` are not established, so these values
|
|
162
|
+
are returned without conversion or a claimed physical unit. Missing fields
|
|
163
|
+
remain `None`; raw integer states are intentionally not assigned guessed
|
|
164
|
+
meanings.
|
|
165
|
+
|
|
157
166
|
For real applications, do not hard-code credentials. Load them securely from configuration or environment-specific secret storage.
|
|
158
167
|
|
|
159
168
|
## Robot control
|
|
@@ -189,6 +189,15 @@ class RobotStatus:
|
|
|
189
189
|
cleaning_time_seconds: int | None
|
|
190
190
|
error_code: int
|
|
191
191
|
mop_status: int | None = None
|
|
192
|
+
total_cleaned_area_raw: int | None = None
|
|
193
|
+
total_cleaning_time_seconds: int | None = None
|
|
194
|
+
sub_state: str | None = None
|
|
195
|
+
last_sub_state: str | None = None
|
|
196
|
+
position_x: int | None = None
|
|
197
|
+
position_y: int | None = None
|
|
198
|
+
heading: int | None = None
|
|
199
|
+
timer_status: int | None = None
|
|
200
|
+
auto_boost: int | None = None
|
|
192
201
|
|
|
193
202
|
@property
|
|
194
203
|
def cleaned_area(self) -> int | None:
|
|
@@ -125,6 +125,28 @@ def _optional_int(value: object, *, field: str) -> int | None:
|
|
|
125
125
|
return value
|
|
126
126
|
|
|
127
127
|
|
|
128
|
+
def _optional_status_text(value: object, *, field: str) -> str | None:
|
|
129
|
+
if value in (None, ""):
|
|
130
|
+
return None
|
|
131
|
+
if not isinstance(value, str):
|
|
132
|
+
raise _protocol_error(f"Status field {field} is invalid")
|
|
133
|
+
return value
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _optional_position(value: object) -> tuple[int | None, int | None]:
|
|
137
|
+
if value in (None, []):
|
|
138
|
+
return None, None
|
|
139
|
+
if (
|
|
140
|
+
not isinstance(value, list)
|
|
141
|
+
or len(value) < 2
|
|
142
|
+
or any(
|
|
143
|
+
isinstance(item, bool) or not isinstance(item, int) for item in value[:2]
|
|
144
|
+
)
|
|
145
|
+
):
|
|
146
|
+
raise _protocol_error("Status field pos is invalid")
|
|
147
|
+
return value[0], value[1]
|
|
148
|
+
|
|
149
|
+
|
|
128
150
|
def _optional_text(value: object, *, field: str) -> str | None:
|
|
129
151
|
if value in (None, ""):
|
|
130
152
|
return None
|
|
@@ -245,6 +267,8 @@ def parse_status_event(
|
|
|
245
267
|
else:
|
|
246
268
|
raise _protocol_error("Status field errorState is invalid")
|
|
247
269
|
|
|
270
|
+
position_x, position_y = _optional_position(status.get("pos"))
|
|
271
|
+
|
|
248
272
|
return RobotStatus(
|
|
249
273
|
device_id=device_id,
|
|
250
274
|
online=online,
|
|
@@ -259,6 +283,24 @@ def parse_status_event(
|
|
|
259
283
|
),
|
|
260
284
|
error_code=error_code,
|
|
261
285
|
mop_status=_optional_int(status.get("mopStatus"), field="mopStatus"),
|
|
286
|
+
total_cleaned_area_raw=_optional_int(status.get("allArea"), field="allArea"),
|
|
287
|
+
total_cleaning_time_seconds=_optional_int(
|
|
288
|
+
status.get("allTime"),
|
|
289
|
+
field="allTime",
|
|
290
|
+
),
|
|
291
|
+
sub_state=_optional_status_text(status.get("subMode"), field="subMode"),
|
|
292
|
+
last_sub_state=_optional_status_text(
|
|
293
|
+
status.get("lastSubMode"),
|
|
294
|
+
field="lastSubMode",
|
|
295
|
+
),
|
|
296
|
+
position_x=position_x,
|
|
297
|
+
position_y=position_y,
|
|
298
|
+
heading=_optional_int(status.get("phi"), field="phi"),
|
|
299
|
+
timer_status=_optional_int(
|
|
300
|
+
status.get("timerStatus"),
|
|
301
|
+
field="timerStatus",
|
|
302
|
+
),
|
|
303
|
+
auto_boost=_optional_int(status.get("autoBoost"), field="autoBoost"),
|
|
262
304
|
)
|
|
263
305
|
|
|
264
306
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: botslab360
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Async Python client for Botslab/360 robot vacuums
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Source, https://github.com/placix/python-botslab360
|
|
@@ -174,6 +174,15 @@ async def main() -> None:
|
|
|
174
174
|
asyncio.run(main())
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
`RobotStatus` also exposes optional diagnostic values reported by status
|
|
178
|
+
command `20001`: the raw lifetime-area counter, lifetime cleaning time in
|
|
179
|
+
seconds, raw current and previous sub-state, raw map position, raw heading,
|
|
180
|
+
timer status, and auto-boost state. The units of `total_cleaned_area_raw`,
|
|
181
|
+
`position_x`, `position_y`, and `heading` are not established, so these values
|
|
182
|
+
are returned without conversion or a claimed physical unit. Missing fields
|
|
183
|
+
remain `None`; raw integer states are intentionally not assigned guessed
|
|
184
|
+
meanings.
|
|
185
|
+
|
|
177
186
|
For real applications, do not hard-code credentials. Load them securely from configuration or environment-specific secret storage.
|
|
178
187
|
|
|
179
188
|
## Robot control
|
|
@@ -133,8 +133,26 @@ def test_decode_unencrypted_push_envelope() -> None:
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
def test_parse_status_event_returns_typed_status() -> None:
|
|
136
|
+
event = synthetic_event()
|
|
137
|
+
protocol = json.loads(event["data"])
|
|
138
|
+
status_data = protocol["data"]
|
|
139
|
+
assert isinstance(status_data, dict)
|
|
140
|
+
status_data.update(
|
|
141
|
+
{
|
|
142
|
+
"subMode": "smart",
|
|
143
|
+
"lastSubMode": "total",
|
|
144
|
+
"allArea": 8400,
|
|
145
|
+
"allTime": 3600,
|
|
146
|
+
"pos": [120, 340],
|
|
147
|
+
"phi": 90,
|
|
148
|
+
"timerStatus": 1,
|
|
149
|
+
"autoBoost": 0,
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
event["data"] = json.dumps(protocol, separators=(",", ":"))
|
|
153
|
+
|
|
136
154
|
status = parse_status_event(
|
|
137
|
-
|
|
155
|
+
event,
|
|
138
156
|
device_id="synthetic-device-1",
|
|
139
157
|
task_id="synthetic-task",
|
|
140
158
|
)
|
|
@@ -152,6 +170,68 @@ def test_parse_status_event_returns_typed_status() -> None:
|
|
|
152
170
|
assert status.cleaning_time == 1800
|
|
153
171
|
assert status.error_code == 0
|
|
154
172
|
assert status.mop_status is None
|
|
173
|
+
assert status.total_cleaned_area_raw == 8400
|
|
174
|
+
assert status.total_cleaning_time_seconds == 3600
|
|
175
|
+
assert status.sub_state == "smart"
|
|
176
|
+
assert status.last_sub_state == "total"
|
|
177
|
+
assert status.position_x == 120
|
|
178
|
+
assert status.position_y == 340
|
|
179
|
+
assert status.heading == 90
|
|
180
|
+
assert status.timer_status == 1
|
|
181
|
+
assert status.auto_boost == 0
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def test_parse_status_event_leaves_optional_diagnostics_unknown_when_missing() -> None:
|
|
185
|
+
event = synthetic_event()
|
|
186
|
+
protocol = json.loads(event["data"])
|
|
187
|
+
status_data = protocol["data"]
|
|
188
|
+
assert isinstance(status_data, dict)
|
|
189
|
+
for field in (
|
|
190
|
+
"allArea",
|
|
191
|
+
"allTime",
|
|
192
|
+
"subMode",
|
|
193
|
+
"lastSubMode",
|
|
194
|
+
"pos",
|
|
195
|
+
"phi",
|
|
196
|
+
"timerStatus",
|
|
197
|
+
"autoBoost",
|
|
198
|
+
):
|
|
199
|
+
status_data.pop(field, None)
|
|
200
|
+
event["data"] = json.dumps(protocol, separators=(",", ":"))
|
|
201
|
+
|
|
202
|
+
status = parse_status_event(
|
|
203
|
+
event,
|
|
204
|
+
device_id="synthetic-device-1",
|
|
205
|
+
task_id="synthetic-task",
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
assert status is not None
|
|
209
|
+
assert status.total_cleaned_area_raw is None
|
|
210
|
+
assert status.total_cleaning_time_seconds is None
|
|
211
|
+
assert status.sub_state is None
|
|
212
|
+
assert status.last_sub_state is None
|
|
213
|
+
assert status.position_x is None
|
|
214
|
+
assert status.position_y is None
|
|
215
|
+
assert status.heading is None
|
|
216
|
+
assert status.timer_status is None
|
|
217
|
+
assert status.auto_boost is None
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
@pytest.mark.parametrize("position", [[1], [1, "2"], "1,2", [True, 2]])
|
|
221
|
+
def test_parse_status_event_rejects_invalid_position(position: object) -> None:
|
|
222
|
+
event = synthetic_event()
|
|
223
|
+
protocol = json.loads(event["data"])
|
|
224
|
+
status_data = protocol["data"]
|
|
225
|
+
assert isinstance(status_data, dict)
|
|
226
|
+
status_data["pos"] = position
|
|
227
|
+
event["data"] = json.dumps(protocol, separators=(",", ":"))
|
|
228
|
+
|
|
229
|
+
with pytest.raises(ApiError, match="Status field pos is invalid"):
|
|
230
|
+
parse_status_event(
|
|
231
|
+
event,
|
|
232
|
+
device_id="synthetic-device-1",
|
|
233
|
+
task_id="synthetic-task",
|
|
234
|
+
)
|
|
155
235
|
|
|
156
236
|
|
|
157
237
|
@pytest.mark.parametrize("mop_status", [0, 1, 2, 37])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|