Skip to content

Verbraucher: Shelly Temperaturen, Topics beim Hinzufügen initialisieren - #4196

Open
LKuemmel wants to merge 4 commits into
openWB:masterfrom
LKuemmel:consumer_dev
Open

LKuemmel wants to merge 4 commits into
openWB:masterfrom
LKuemmel:consumer_dev

Conversation

@LKuemmel

@LKuemmel LKuemmel commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

references #3466 (comment)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 temperatures to the consumer data model.
  • Initializes consumer get and set topics 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
Comment thread packages/modules/devices/shelly/shelly/status_handler.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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)
@LKuemmel LKuemmel added this to the 2.4.0 milestone Oct 27, 2026
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.

2 participants