Fix 800-series (telnet): manual login + robust single-line command read#27
Open
seadillpicklerooster wants to merge 1 commit into
Open
Fix 800-series (telnet): manual login + robust single-line command read#27seadillpicklerooster wants to merge 1 commit into
seadillpicklerooster wants to merge 1 commit into
Conversation
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)Invalid Login(the WattBox presents a plainUsername:/Password:prompt that scrapli's handshake doesn't satisfy). Result:ScrapliTimeout/ScrapliAuthenticationFailedduring setup._send_commandrelies on scrapli's_read_until_prompt(), but this protocol has no real prompt (replies are bare?Key=value\nlines), so it reads until timeout._send_commanddoessplit_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 itIndexErrors (or mis-parses) — the classic "adds, no entities, no error" symptom.The fix
auth_bypass=Trueand perform theUsername:/Password:handshake manually inon_open. SSH is untouched (asyncssh still authenticates; the manual login is gated ontransport in ("telnet","asynctelnet")).re.compile(b"(?m)^" + re.escape(key) + b"=(.*)")(orOK|#Errorfor!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.