Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify reading from the device, ignoring end-of-line characters #36

Merged
merged 8 commits into from
Mar 12, 2024

Conversation

clssn
Copy link
Owner

@clssn clssn commented Mar 10, 2024

Reading from the various device variants got overly complicated with all the variants.
It just occurred to me that the EOL sequences don't play any role, they are just there for better readability in a screen session with a human.

Remove EOL characters during low-level reading
Remove any other EOL related code except the \r in queries
Unify queries so to always read until the next prompt character (>)
Validate port lengths in port length related queries

Discard EOL characters, then it's possible to read byte wise not to miss
a notification.

Remove all EOL related code from the NumatoUsbGpio class.
@clssn clssn added this to the Device Compatibility milestone Mar 10, 2024
@clssn clssn self-assigned this Mar 10, 2024
@clssn clssn changed the title Feature/34-simplify-reading Simplify reading from the device, ignoring end-of-line characters Mar 10, 2024
@clssn
Copy link
Owner Author

clssn commented Mar 10, 2024

  • Remove references to eol, like in readme.md

With the goal to further simplify the code, this commit applies the
single responsibility principle to the query method. This is done by
removing the validation extra-functionality into a read_response method
which is now called after the query. The read_response method accepts
the expected response as optional argument so that the response can be
validated in a uniform way.

Additionally resolved several issues reported by static code analysis.
Also adapt and improve tests and fix pylint findings.
Was mistakenly pyline.
@clssn clssn force-pushed the feature/34-simplify-reading branch from 1f30335 to 96482b3 Compare March 10, 2024 22:45
@clssn
Copy link
Owner Author

clssn commented Mar 12, 2024

According to user feedback from Numato related HA core issues (here and here) this looks very promising.

@clssn clssn merged commit c004e65 into main Mar 12, 2024
3 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.

Simplify reading from the device Different EOL for notifications and regular responses
1 participant