Repository navigation
Conversation
Reviewer's GuideImplementationSkip missing external-temperature sensor entries without logging, while continuing to log malformed entries.
TestsAdd coverage for absent and sparse sensors, malformed entries, and both Shelly generations.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/modules/devices/shelly/shelly/status_handler.py" line_range="42" />
<code_context>
value = status['ext_temperature'][str(index)]['tC']
else:
value = status[f'temperature:{100 + index}']['tC']
+ except KeyError:
+ continue
+ try:
</code_context>
<issue_to_address>
**Malformed status faults consumer**
When the Shelly status has a non-mapping `ext_temperature` section or temperature entry, `parse_temperatures` lets the `TypeError` from indexing escape because the lookup is outside the conversion handler, aborting the consumer update and leaving readings stale as the component enters its fault path.
Handle and log `TypeError` from the nested lookup as malformed data without aborting processing of valid readings.
Also at `packages/modules/devices/shelly/shelly/status_handler.py:44-46`.
</issue_to_address>
### Comment 2
<location path="packages/modules/devices/shelly/shelly/status_handler.py" line_range="42" />
<code_context>
value = status['ext_temperature'][str(index)]['tC']
else:
value = status[f'temperature:{100 + index}']['tC']
+ except KeyError:
+ continue
+ try:
</code_context>
<issue_to_address>
**Malformed sensors disappear silently**
When an indexed sensor entry is present but lacks its `tC` field, `parse_temperatures` catches the lookup's `KeyError` and continues, treating the malformed sensor as absent; its reading is omitted, potentially leaving a previously published value stale, without a diagnostic.
Distinguish an absent sensor from a present entry missing `tC`, and log the malformed entry instead of silently skipping it.
</issue_to_address>
LKuemmel
approved these changes
Nov 10, 2026
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.
#3466 (reply in thread)
Summary by Sourcery
Handle absent Shelly external temperature sensors without spurious errors while continuing to report genuinely malformed readings.
Bug Fixes:
Tests: