consider non charging for consumers and update consumer state messages - #3840
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates control logic to better handle “non-charging” behavior for consumers and refines consumer state/status messaging, while consolidating shared load-handling utilities across chargepoints and consumers.
Changes:
- Update consumer
state_strmessages based onConsumerUsageand charging state. - Centralize “no charge” cleanup logic into a new
control.load.no_charge()and wire it intoprepare. - Generalize “consider less charging” load-management logic to apply to both chargepoints and consumers, and move charge-start timestamp handling into the shared
Loadprotocol.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/control/process.py | Updates consumer state messaging and consumer state update handling. |
| packages/control/prepare.py | Switches “no charge” reset call to the new centralized load.no_charge(). |
| packages/control/load.py | Adds new shared no_charge() implementation for chargepoints + consumers. |
| packages/control/load_protocol.py | Adds shared set_timestamp_charge_start() helper to the Load protocol. |
| packages/control/consumer/consumer.py | Removes per-consumer timestamp handling (now shared via Load). |
| packages/control/chargepoint/chargepoint.py | Removes chargepoint-local set_timestamp_charge_start() (now shared via Load). |
| packages/control/chargepoint/chargepoint_all.py | Removes old AllChargepoints.no_charge() implementation. |
| packages/control/algorithm/common.py | Applies “less charging” consideration uniformly to all loads, including consumers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
76
to
80
| def process_on_time(self): | ||
| if self.data.get.charge_state: | ||
| now = timecheck.create_timestamp() | ||
| if self.data.set.timestamp_wrote_last_on_time is None: | ||
| self.data.set.timestamp_wrote_last_on_time = now |
Comment on lines
+17
to
+33
| for load in list(data.data.cp_data.values()) + list(data.data.consumer_data.values()): | ||
| try: | ||
| # Kein EV angesteckt | ||
| control_parameter = load.data.control_parameter | ||
| if (not load.data.get.plug_state or | ||
| # Kein EV, das Laden soll | ||
| # Kein EV, das auf das Ablaufen der Einschalt- oder Phasenumschaltverzögerung wartet | ||
| (control_parameter.state != ChargepointState.PERFORMING_PHASE_SWITCH and | ||
| control_parameter.state != ChargepointState.PHASE_SWITCH_DELAY and | ||
| control_parameter.state != ChargepointState.SWITCH_OFF_DELAY and | ||
| control_parameter.state != ChargepointState.SWITCH_ON_DELAY and | ||
| control_parameter.state != ChargepointState.NO_CHARGING_ALLOWED)): | ||
| continue | ||
| else: | ||
| break | ||
| except Exception: | ||
| log.exception("Fehler beim Bereinigen der Werte für Ladepunkt/Verbraucher "+load.num) |
| log.debug( | ||
| f"LP {cp.num} lädt deutlich unter dem Sollstrom und wird nur mit {cp.data.get.currents}A berücksichtigt.") | ||
| return get_medium_charging_current(cp.data.get.currents) | ||
| def consider_less_charging_chargepoint_in_loadmanagement(load: Load, set_current: float) -> bool: |
Comment on lines
+178
to
+184
| log.debug(f"LP {load.num} lädt deutlich unter dem Sollstrom und " | ||
| f"wird nur mit {load.data.get.currents}A berücksichtigt.") | ||
| return get_medium_charging_current(load.data.get.currents) | ||
| elif load.data.set.current_prev != 0: | ||
| log.debug( | ||
| f"LP {load.num} lädt nicht und wird nur mit {load.data.get.currents}A berücksichtigt.") | ||
| return get_medium_charging_current(load.data.get.currents) |
Comment on lines
+169
to
+173
| if isinstance(load, Chargepoint): | ||
| expected_current = set_current - load.data.set.charging_ev_data.ev_template.data.nominal_difference | ||
| else: | ||
| return set_current | ||
| expected_current = set_current - 1 | ||
| expected_current = max(expected_current, 0) |
| submode_changed: bool | ||
| data: LoadData | ||
|
|
||
| def set_timestamp_charge_start(self): |
LKuemmel
added a commit
that referenced
this pull request
Aug 24, 2026
#3840) * no charge for loads * consider non charging for consumers and update consumer state messages * flake8 * review
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.
No description provided.