Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active moderate findings leave the temperature model’s nullable sensor contract inaccurate and cause typical Shelly readings containing None to be rejected before the public topic is updated.
2 open issues
What changed in this PR
This pull request adds Shelly temperature reporting for consumer modules and initializes consumer MQTT topics when a consumer is added.
Changes:
- Parses up to three temperature sensors from Shelly Gen 1 and Gen 2+ responses.
- Exposes temperatures through Shelly PM and Shelly EM consumer states.
- Adds
temperaturesto the consumer data model. - Initializes consumer
getandsettopics during creation.
Review findings remain for:
- Supporting nullable temperature slots in the consumer data model.
- Avoiding publication of internal fields as MQTT topics.
- Preserving temperatures when an extra meter replaces the consumer state.
- Ensuring lists containing missing sensor values pass validation before publication.
| File | Description |
|---|---|
packages/modules/devices/shelly/shelly/status_handler.py |
Adds Shelly temperature parsing for different generations. |
packages/modules/consumers/shelly/shelly_pm/consumer.py |
Adds parsed temperatures to Shelly PM state updates. |
packages/modules/consumers/shelly/shelly_em/consumer.py |
Adds parsed temperatures to Shelly EM state updates. |
packages/helpermodules/command.py |
Initializes consumer get and set topics when adding consumers. |
packages/control/consumer/consumer_data.py |
Adds the consumer temperatures data field. |
Review effort: Lite
| set_power: Optional[float] = None | ||
| state: Optional[bool] = False | ||
| state_str: Optional[str] = field(default=None, metadata={"topic": "get/state_str"}) | ||
| temperatures: Optional[List[float]] = None |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A moderate issue remains because publishing null temperatures for consumers without temperature data violates the topic’s list-of-floats validation and causes updates to be rejected.
2 open issues
1 resolved since last review
Review effort: Lite
| pub_to_broker(f"openWB/set/consumer/{self.num}/get/exported", self.state.exported, 2) | ||
| if self.state.temperatures is not None: | ||
| pub_to_broker(f"openWB/set/consumer/{self.num}/get/temperatures", self.state.temperatures) | ||
| pub_to_broker(f"openWB/set/consumer/{self.num}/get/temperatures", self.state.temperatures) |
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.

references #3466 (comment)