Skip to content

Improve PeakFilter#3380

Merged
LKuemmel merged 5 commits into
openWB:masterfrom
ndrsnhs:improve-peakfilter
May 22, 2026
Merged

Improve PeakFilter#3380
LKuemmel merged 5 commits into
openWB:masterfrom
ndrsnhs:improve-peakfilter

Conversation

@ndrsnhs
Copy link
Copy Markdown
Contributor

@ndrsnhs ndrsnhs commented May 21, 2026

Einige Wechselrichter haben bei Zählerständen grobe Auflösung im Register was wiederholt trotz valider Werte Peaks auslöst (Werte bilden Treppchen).
Solche validen Peaks werden eine Regelschleife später übernommen - in der ersten Regelschleife werden sie auf None gesetzt.
Bei Hybridsystemen werden die Werte in _inverter.py nochmal nachbearbeitet. Hier führt None zu einer Exception was dann dazu führt, dass alle Werte (auch aktuelle Leistung) verworfen werden.
Erkennbar ist dass Problem an kleinen, zyklischen Einbrüchen im Graphen.
Meldung im Forum: https://forum.openwb.de/viewtopic.php?p=143030#p143030
#3333 (comment) behandelt das Problem der häufigen Fehlermeldungen - wird hier aber auch berücksichtigt

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts hybrid inverter value post-processing to avoid exceptions when energy counter readings are temporarily None (e.g., due to PeakFilter behavior), preventing the whole inverter state update from being discarded.

Changes:

  • Add None-guards around hybrid energy counter correction logic in fix_hybrid_values.
  • When required inputs are missing, mark exported as invalid (None) instead of computing with None values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +72 to +76
if (bat_get.imported is not None and bat_get.exported is not None and
imported is not None and exported is not None):
exported += bat_get.imported - bat_get.exported - imported
else:
exported = None
Comment on lines +72 to +76
if (bat_get.imported is not None and bat_get.exported is not None and
imported is not None and exported is not None):
exported += bat_get.imported - bat_get.exported - imported
else:
exported = None
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +19 to +24
self.__pv.power.write(int(inverter_state.power))
self.__pv.energy.write(inverter_state.exported)
self.__pv.energy_k.write(inverter_state.exported / 1000)
self.__pv.energy_k.write(
inverter_state.exported if inverter_state.exported is None
else inverter_state.exported / 1000
)
Comment on lines +75 to +79
if (bat_get.imported is not None and bat_get.exported is not None and
imported is not None and exported is not None):
exported += bat_get.imported - bat_get.exported - imported
else:
exported = None
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comment on lines 81 to 85
elif allowed_deviation > 0 and (total_energy - previous_total_energy) > allowed_deviation:
log.debug(f"PeakFilter: Unplausibler Zählerwert: {total_energy / 1000}kWh. "
f"Differenz zum vorherigen Wert: {total_energy - previous_total_energy}Wh. "
f"erlaubte Differenz: {round(allowed_deviation, 2)}Wh.")
self.fault_state.warning(f"Peakfilter: {total_energy / 1000}kWh. "
"Die Energie erscheint höher, als laut Anlagenkonfiguration plausibel "
"ist. Erneute Prüfung im nächsten Regelintervall.")
else:
self.__pv.energy_k.write(inverter_state.exported / 1000)
if inverter_state.exported is not None:
self.__pv.energy.write(inverter_state.exported)
self.__pv.energy_k.write(inverter_state.exported / 1000)
Comment on lines +76 to +77
else:
exported = None
imported is not None and exported is not None):
exported += bat_get.imported - bat_get.exported - imported
else:
exported = None
@LKuemmel LKuemmel merged commit afb0c9a into openWB:master May 22, 2026
1 check passed
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.

3 participants