Skip to content

Fix 800-series (telnet): manual login + robust single-line command read#27

Open
seadillpicklerooster wants to merge 1 commit into
eseglem:masterfrom
seadillpicklerooster:fix-800-series-telnet
Open

Fix 800-series (telnet): manual login + robust single-line command read#27
seadillpicklerooster wants to merge 1 commit into
eseglem:masterfrom
seadillpicklerooster:fix-800-series-telnet

Conversation

@seadillpicklerooster

@seadillpicklerooster seadillpicklerooster commented Jun 7, 2026

Copy link
Copy Markdown

What

Makes the WattBox 800-series (WB-800 / WB-820, IP models) actually work over the IP driver. Tested against real WB-800-IPVM-12 and WB-820-IPVM-12, firmware 2.10.0.0, over telnet (port 23). This addresses eseglem/hass-wattbox#55 (and the long-standing "adds but no entities" reports).

The problems (all in driver/async_driver.py)

  1. Telnet auth fails. scrapli's in-channel telnet auth sends credentials the device rejects as Invalid Login (the WattBox presents a plain Username: / Password: prompt that scrapli's handshake doesn't satisfy). Result: ScrapliTimeout/ScrapliAuthenticationFailed during setup.
  2. Command reads time out. _send_command relies on scrapli's _read_until_prompt(), but this protocol has no real prompt (replies are bare ?Key=value\n lines), so it reads until timeout.
  3. No-echo parse bug. _send_command does split_response[1], assuming the device echoes the command on line 0 and the reply on line 1. Over telnet these units do not echo, so it IndexErrors (or mis-parses) — the classic "adds, no entities, no error" symptom.

The fix

  • Auth: for telnet transports, set auth_bypass=True and perform the Username:/Password: handshake manually in on_open. SSH is untouched (asyncssh still authenticates; the manual login is gated on transport in ("telnet","asynctelnet")).
  • Command read/parse: read the matching reply line directly with re.compile(b"(?m)^" + re.escape(key) + b"=(.*)") (or OK|#Error for ! commands). This is no-echo safe and tolerates spaces/commas in values (e.g. ?OutletName={Switch},...), which the old \S+ prompt regex could not.

Testing

Validated end-to-end against both units: async_create_ip_wattbox()async_get_initial()async_update() returns correct model/firmware/outlet-count, per-outlet names, status, and power (e.g. Switch 47.8 W), and total power/voltage.

Caveat: validated on telnet only (I don't have an SSH-configured unit). The SSH path is left on its original code path, but a second set of eyes / an SSH test would be welcome.

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