Fix/m1s telnet discovery v2 - #385
Open
teyou wants to merge 3 commits into
Open
Conversation
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.
Summary
Fix device discovery on Aqara M1S gateways by improving Telnet file reading and M1S shell selection.
The integration could connect to MQTT, but failed to discover the gateway and paired Zigbee devices with errors such as:
and:
Root cause
Duplicate Telnet reads
TelnetShell.read_file()performed two consecutive reads whenwith_newline=False.The first read already consumed the file contents and shell prompt. The second read then waited for another prompt, which could return an empty response, timeout, or closed connection.
M1S shell prompt handling
The detected model name remains:
However, custom-flashed M1S firmware can still use the classic
#shell prompt.The old
_get_shell()logic routed"m1s gen2"toTelnetShellM2POE, which expects the/ #prompt. This caused Telnet reads to fail on this M1S firmware.Changes
core/shell.pywith_newline=False.with_newlineas output formatting only."M1S": "m1s gen2"model mapping.core/gateway.pyTelnetShell.TelnetShellM2POE.coordinator.infoanddevice.infousing the safer JSON helper.Tested with
4.0.6_0006.06466.46After applying the changes:
/data/zigbee/coordinator.infoloads successfully/data/zigbee/device.infoloads successfully