Skip to content

lox hw ls / search / identify via the livelearn API - #414

Merged
discostu105 merged 1 commit into
mainfrom
hw-learn
Nov 15, 2026
Merged

discostu105 merged 1 commit into
mainfrom
hw-learn

Conversation

@discostu105

Copy link
Copy Markdown
Owner

New subcommands on top of the Miniserver's jdev/sps/livelearn web service (the API the Loxone App uses for its expert-mode device search):

  • lox hw ls [--tech tree|air|link|all]: paired devices with type, serial, base, room, online state (-o json adds uuid, switchboard, place).
  • lox hw search <tree|air|base-serial> [--seconds N]: starts a search, keepalive every 10 s, prints new devices as they appear. tree/air search every base of that technology in turn. Never pairs anything.
  • lox hw identify <serial> [--seconds N]: makes a paired device blink.

Search and identify always send their stop commands: on timeout, on error and on Ctrl-C (first Ctrl-C ends the wait so the stop goes out, a second quits). --dry-run prints the commands. 401/403 explains the needed rights (device management + expert mode).

Tested with unit tests (fake clock and Miniserver for every exit path, anonymized fixtures) and live: hw ls (56 devices), hw search tree --seconds 15 (liveSearch went true → false), hw identify 5 s.

Not included: pairing (create/replace) — waits for a hardware experiment.

https://claude.ai/code/session_01Ms544aw3YwUGYox8c8BHA4

Use the Miniserver's device search API (jdev/sps/livelearn/...), the one
the Loxone App uses in expert mode:

- hw ls lists the paired Tree, Air and Link devices from listtree, with
  serial, base, room (named from the structure file) and online state.
- hw search tree|air|<base> starts a search, sends keepalive every 10 s,
  polls results every 2 s and prints new devices as they appear. tree/air
  search every base of that technology one after the other.
- hw identify <serial> finds the device's base and lets it flash.

Search and identify always send their stop commands: when the time is
up, on an error and on Ctrl-C (a second Ctrl-C quits at once). The loops
take an Http and a Clock trait, so tests cover every exit with a fake
Miniserver and virtual time. Nothing pairs devices.

Tested live (firmware 17.3): hw ls, a 15 s tree search (liveSearch went
back to isSearching:false) and a 5 s identify.

Claude-Session: https://claude.ai/code/session_01Ms544aw3YwUGYox8c8BHA4
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.32432% with 225 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.16%. Comparing base (e8935ba) to head (e932650).

Files with missing lines Patch % Lines
src/commands/hw.rs 16.26% 211 Missing ⚠️
src/livelearn.rs 94.17% 11 Missing ⚠️
src/commands/system.rs 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #414      +/-   ##
==========================================
- Coverage   77.40%   77.16%   -0.24%     
==========================================
  Files         160      162       +2     
  Lines       52549    52993     +444     
==========================================
+ Hits        40673    40892     +219     
- Misses      11876    12101     +225     
Files with missing lines Coverage Δ
src/main.rs 57.41% <ø> (ø)
src/commands/system.rs 19.83% <0.00%> (-0.09%) ⬇️
src/livelearn.rs 94.17% <94.17%> (ø)
src/commands/hw.rs 16.26% <16.26%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@discostu105
discostu105 merged commit 3b6617f into main Nov 15, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant