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

tcp: Make firmware strings (in packet suffix) optional #376

Merged

Conversation

MarijnS95
Copy link
Contributor

@MarijnS95 MarijnS95 commented Apr 13, 2023

Fixes robbinjanssen/home-assistant-omnik-inverter#142, robbinjanssen/home-assistant-omnik-inverter#134 (comment)

Multiple of the following reports are going around:

Buffer size too small (85 instead of at least 125 bytes)

As it turns out these last 40 bytes contain exactly the firmware and firmware_slave strings, which are not sent by certain 3000TL inverters. Move the fields to a secondary, optional Structure to allow these devices to be read out over TCP, and warn when the length of a reply isn't matching one of the known message sizes so that we can potentially discover more different layouts.

Multiple of the following reports are going around:

    Buffer size too small (85 instead of at least 125 bytes)

As it turns out these last 40 bytes contain exactly the `firmware` and
`firmware_slave` strings, which are not sent by certain 3000TL
inverters.  Move the fields to a secondary, optional `Structure` to
allow these devices to be read out over TCP, and warn when the length
of a reply isn't matching one of the known message sizes so that we can
potentially discover more different layouts.
Makes `_parse_information_reply()` quite a bit slimmer
omnikinverter/tcp.py Outdated Show resolved Hide resolved
@MarijnS95 MarijnS95 force-pushed the tcp-firmware-strings-optional branch from 4637629 to 7a6168c Compare April 16, 2023 20:55
@codecov
Copy link

codecov bot commented Apr 16, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (96e54b7) 100.00% compared to head (7ab8054) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #376   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          341       357   +16     
  Branches        55        57    +2     
=========================================
+ Hits           341       357   +16     
Impacted Files Coverage Δ
omnikinverter/models.py 100.00% <100.00%> (ø)
omnikinverter/tcp.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label May 17, 2023
@robbinjanssen robbinjanssen added no-stale This issue or PR is exempted from the stable bot. and removed stale There has not been activity on this issue or PR for quite some time. labels May 22, 2023
@klaasnicolaas klaasnicolaas added the refactor Improvement of existing code, not introducing new features. label May 29, 2023
Copy link
Owner

@klaasnicolaas klaasnicolaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM

@klaasnicolaas klaasnicolaas merged commit b0498f2 into klaasnicolaas:main May 29, 2023
@MarijnS95 MarijnS95 deleted the tcp-firmware-strings-optional branch May 29, 2023 10:38
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no-stale This issue or PR is exempted from the stable bot. refactor Improvement of existing code, not introducing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

omnik inverter tcp fails to configure in Home-assistant
4 participants