Skip to content

Commit 6a3e593

Browse files
committed
move onboarding
1 parent 9794abc commit 6a3e593

6 files changed

Lines changed: 25 additions & 34 deletions

File tree

docs/onboarding.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ If this is a brand new vacuum, it is still a good idea to set it up once in the
99
Run onboarding from a second machine, not from the machine hosting the local server:
1010

1111
```bash
12-
uv run start_onboarding --server api-roborock.example.com
12+
uv run start_onboarding.py --server api-roborock.example.com
1313
```
1414

15-
`uv run onboarding.py --server api-roborock.example.com` still works as a compatibility wrapper.
15+
This is a standalone script — you can copy `start_onboarding.py` to any machine and run it with just `uv`.
1616

1717
The guided CLI will:
1818

@@ -41,7 +41,7 @@ The only required CLI flag is `--server`. The script will prompt for anything mi
4141
You can still pass them explicitly if you prefer:
4242

4343
```bash
44-
uv run start_onboarding --server api-roborock.example.com --ssid "My Wifi" --password "Password123" --timezone "America/New_York" --cst EST5EDT,M3.2.0,M11.1.0 --country-domain us
44+
uv run start_onboarding.py --server api-roborock.example.com --ssid "My Wifi" --password "Password123" --timezone "America/New_York" --cst EST5EDT,M3.2.0,M11.1.0 --country-domain us
4545
```
4646

4747
`server` should be your real stack hostname, usually the same `api-...` hostname you use for `/admin`.

onboarding.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ dev = [
2525

2626
[project.scripts]
2727
roborock-local-server = "roborock_local_server.__main__:main"
28-
start_onboarding = "roborock_local_server.onboarding_cli:main"
2928

3029
[build-system]
3130
requires = ["hatchling"]

src/roborock_local_server/onboarding_cli.py renamed to start_onboarding.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
"""Guided remote onboarding CLI for pairing vacuums through the main server."""
1+
#!/usr/bin/env python3
2+
# /// script
3+
# requires-python = ">=3.11"
4+
# dependencies = ["pycryptodome>=3.20,<4"]
5+
# ///
6+
"""Guided remote onboarding CLI for pairing vacuums through the main server.
7+
8+
This is a standalone script. Copy it to any machine and run:
9+
10+
uv run start_onboarding.py --server api-roborock.example.com
11+
"""
212

313
from __future__ import annotations
414

@@ -538,3 +548,6 @@ def main(argv: list[str] | None = None) -> int:
538548
print(f"Error: {exc}", file=sys.stderr)
539549
return 1
540550

551+
552+
if __name__ == "__main__":
553+
raise SystemExit(main())

tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44

55
ROOT = Path(__file__).resolve().parents[1]
6+
root_str = str(ROOT)
7+
if root_str not in sys.path:
8+
sys.path.insert(0, root_str)
69
SRC = ROOT / "src"
710
src_str = str(SRC)
811
if src_str not in sys.path:

tests/test_onboarding_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
from roborock_local_server.onboarding_cli import GuidedOnboardingConfig, run_guided_onboarding
7+
from start_onboarding import GuidedOnboardingConfig, run_guided_onboarding
88

99

1010
class FakeApi:
@@ -97,7 +97,7 @@ def test_guided_onboarding_happy_path(monkeypatch: pytest.MonkeyPatch, config: G
9797
answers = iter(["1", ""])
9898
monkeypatch.setattr("builtins.input", lambda prompt="": next(answers))
9999
monkeypatch.setattr(
100-
"roborock_local_server.onboarding_cli.poll_session_until_progress",
100+
"start_onboarding.poll_session_until_progress",
101101
lambda *args, **kwargs: next(poll_results),
102102
)
103103

@@ -177,7 +177,7 @@ def test_guided_onboarding_handles_extra_cycles(monkeypatch: pytest.MonkeyPatch,
177177
answers = iter(["1", "", "", ""])
178178
monkeypatch.setattr("builtins.input", lambda prompt="": next(answers))
179179
monkeypatch.setattr(
180-
"roborock_local_server.onboarding_cli.poll_session_until_progress",
180+
"start_onboarding.poll_session_until_progress",
181181
lambda *args, **kwargs: next(poll_results),
182182
)
183183

@@ -247,7 +247,7 @@ def test_guided_onboarding_timeout_can_retry_without_restart(
247247
answers = iter(["1", "", "retry", ""])
248248
monkeypatch.setattr("builtins.input", lambda prompt="": next(answers))
249249
monkeypatch.setattr(
250-
"roborock_local_server.onboarding_cli.poll_session_until_progress",
250+
"start_onboarding.poll_session_until_progress",
251251
lambda *args, **kwargs: next(poll_results),
252252
)
253253

@@ -307,7 +307,7 @@ def test_guided_onboarding_duplicate_names_still_selects_requested_device(
307307
answers = iter(["2", ""])
308308
monkeypatch.setattr("builtins.input", lambda prompt="": next(answers))
309309
monkeypatch.setattr(
310-
"roborock_local_server.onboarding_cli.poll_session_until_progress",
310+
"start_onboarding.poll_session_until_progress",
311311
lambda *args, **kwargs: next(poll_results),
312312
)
313313

0 commit comments

Comments
 (0)