Repository navigation
Apply battery config/max_power to the control data - #4371
Merged
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/helpermodules/subdata.py" line_range="632" />
<code_context>
if re.search("/bat/[0-9]+/config$", msg.topic) is not None:
self.set_json_payload(var["bat"+index].data, msg)
+ elif re.search("/bat/[0-9]+/config/", msg.topic) is not None:
+ self.set_json_payload_class(var["bat"+index].data.config, msg)
elif re.search("/bat/[0-9]+/get/", msg.topic) is not None:
self.set_json_payload_class(var["bat"+index].data.get, msg)
</code_context>
<issue_to_address>
**Malformed limits break battery filtering**
When a retained `openWB/bat/<id>/config/max_power` payload is a string or null, or an anonymous MQTT client publishes a string to `openWB/set/bat/<id>/config/max_power`, `set_json_payload_class` stores the decoded value without type validation, so `PeakFilter.check_values` compares a string or null with zero and raises `TypeError` or lets invalid battery readings reach control data.
Validate or coerce `max_power` to a number before storing it.
</issue_to_address>
LKuemmel
approved these changes
Nov 23, 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.
Die "Maximale Leistung des Speichers" (
openWB/bat/<id>/config/max_power) wurde imsubdatanicht ausgewertet: Es gab nur einen Zweig für…/bat/<id>/config(ohne Unterthema),max_powerblieb immer 0. Damit war die Plausibilitätsprüfung (PeakFilter) für Speicher nie aktiv und fehlerhafte Zählerwerte gelangten in die Logs (siehe #4370). Beim Wechselrichter funktioniert das (…/pv/<id>/config/…).Summary by Sourcery
Ensure battery max_power configuration is validated and reflected in control data.
Bug Fixes:
Tests: