-
Notifications
You must be signed in to change notification settings - Fork 106
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
Bugfix/revert and add more logging for issues #412
base: main
Are you sure you want to change the base?
Bugfix/revert and add more logging for issues #412
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #412 +/- ##
==========================================
- Coverage 71.49% 70.98% -0.52%
==========================================
Files 27 28 +1
Lines 1912 1961 +49
==========================================
+ Hits 1367 1392 +25
- Misses 545 569 +24 ☔ View full report in Codecov by Sentry. |
Cannot fix codecov as it gives me "Error 404" when I try to open the results page. It is probably irrelevant as no new functionality has been added to require new tests. |
Okay, thanks! Changes are in two of the files only. Other ones are simply pre-commit formatting. |
The formatting is a bit of a mess. I pinned ruff in #417 Also a small update the CI script, as my PR tried to publish a new image Can you test these solarman sunsynk changes? |
Can you rebase this on the latest? |
…dling and logging - Added logging for suspicious register values (0xFFFF) and large unpacked values. - Improved error handling during unpacking of register values, including specific warnings for single and double register unpacking failures. - Introduced a mapping of register addresses to sensors for better tracking and debugging. - Enhanced performance logging for register reads, including warnings for slow reads and multiple consecutive timeouts. - Updated debug logging to provide more context on register requests and responses. These changes aim to improve the robustness and reliability of the sensor reading process.
149e306
to
7d5a2d2
Compare
Done |
raise | ||
|
||
raise ValueError(f"Unsupported number of registers: {len(regs)}") | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this outer general exception handler?
you already log 1&2 register exceptions above
# Check if state is ok & tracking the sensors being read | ||
assert self.state is not None | ||
for sen in sensors: | ||
if sen not in self.state.values: | ||
_LOGGER.warning("sensor %s not being tracked", sen.id) | ||
|
||
# Create a map of register addresses to their corresponding sensors | ||
reg_to_sensor: dict[int, Union[Sensor, None]] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reg_to_sensor: dict[int, Union[Sensor, None]] = {} | |
reg_to_sensor: dict[int, Sensor | None] = {} |
isinstance(current_sensor, t) | ||
for t in ( | ||
BinarySensor, | ||
EnumSensor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can’t 0 be a vlid state for Binary/Enum?
I’m ok with the logging during struct unpack, but it seems there are too many logs during read Any chance to rather do this via one of the stats sensors? |
Enhance register unpacking and sensor reading with improved error handling and logging
Revert #408 which caused:
Added logging should help resolve:
Changes:
These changes aim to improve the robustness and reliability of the sensor reading process. This should help us resolve the inconsistency of data when it gets congested.