Skip to content

Anlauferkennung, Betriebsmodus zurücksetzen, Befehle für Pläne - #3588

Merged
LKuemmel merged 14 commits into
openWB:feature_consumerfrom
LKuemmel:consumer_dev
Jun 24, 2026
Merged

LKuemmel merged 14 commits into
openWB:feature_consumerfrom
LKuemmel:consumer_dev

Conversation

@LKuemmel

Copy link
Copy Markdown
Contributor

No description provided.

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.

Pull request overview

Erweitert die Verbraucher-Logik um Anlauferkennung (“wait for start”), neue/erweiterte MQTT-Set-Topics sowie Commands zum Anlegen/Löschen von Verbraucher-Plänen; zusätzlich wird ein nächtliches Zurücksetzen bestimmter Zustände implementiert.

Changes:

  • Mitternachts-Handler setzt wait_for_start-State und (optional) den Lademodus zurück.
  • MQTT-Handling erweitert: Consumer-/set/* Topics werden zugelassen, validiert und in SubData/ConsumerData.Set verarbeitet (inkl. Enum-Decoding).
  • Commands für Verbraucher-Zielladen-/Zeitladen-Pläne hinzugefügt sowie neue Tests für die Wait-for-start-Statemachine.

Reviewed changes

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

Show a summary per file
File Description
packages/main.py Setzt Verbraucher-Zustände um Mitternacht zurück.
packages/helpermodules/update_config.py Whitelist um Consumer-/set/* Topics erweitert.
packages/helpermodules/timecheck.py Typen für neue Consumer-Plan-Klassen ergänzt.
packages/helpermodules/subdata.py Enum-Werte aus MQTT-Payloads werden für Klassenattribute gesetzt.
packages/helpermodules/setdata.py Validierung für neue Consumer-/set/* Topics ergänzt.
packages/helpermodules/command.py Neue Commands zum Hinzufügen/Löschen von Verbraucher-Plänen.
packages/helpermodules/abstract_plans.py Default-Namen für Consumer-Plan-Typen angepasst.
packages/control/consumer/consumer.py Neue Wait-for-start-Logik, Reset-Funktionen, Anpassungen an min_current/min_intervall.
packages/control/consumer/consumer_test.py Neue Tests für wait_for_start_handler.
packages/control/consumer/consumer_data.py Neue Enums/Reset-Konfig, Umzug min_current/min_intervall in ConsumerConfig, neue Set-Topics.

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

Comment thread packages/control/consumer/consumer.py Resolved
Comment on lines 352 to 355
def wait_for_start_handler(
self, func: Callable[[], Tuple[int, str, Optional[str], int]]) -> Tuple[int, str, Optional[str], int]:
self, func: Callable[[], Tuple[int, str, Optional[str], int]]
) -> Tuple[int, Chargemode, Optional[Chargemode], int]:
if self.data.usage.wait_for_start_active:
Comment on lines +1216 to +1224
# check if "payload" contains "data.copy"
if "data" in payload and "copy" in payload["data"] and usage.scheduled_charging.plans is not None:
for plan in usage.scheduled_charging.plans:
if plan.id == payload["data"]["copy"]:
new_consumer_schedule_plan = copy.deepcopy(plan)
break
new_consumer_schedule_plan.name = f'Kopie von {new_consumer_schedule_plan.name}'
else:
new_consumer_schedule_plan = GET_PLAN_CLASS_FOR_USAGE[usage.type]()
Comment on lines +1241 to +1245
if self.max_id_consumer_scheduled_plan < payload["data"]["plan"]:
log.error(
payload, connection_id,
f'Die ID \'{payload["data"]["plan"]}\' ist größer als die maximal vergebene '
f'ID \'{self.max_id_usage_plan}\'.', MessageType.ERROR)
f'ID \'{self.max_id_consumer_scheduled_plan}\'.', MessageType.ERROR)
Comment on lines +1261 to +1269
# check if "payload" contains "data.copy"
if "data" in payload and "copy" in payload["data"]:
for plan in usage.time_charging.plans:
if plan.id == payload["data"]["copy"]:
new_time_charging_plan = copy.deepcopy(plan)
break
new_time_charging_plan.name = f'Kopie von {new_time_charging_plan.name}'
else:
new_time_charging_plan = TimeChargingPlanConsumer()
Comment on lines +1286 to +1289
if self.max_id_consumer_time_plan < payload["data"]["plan"]:
log.error(payload, connection_id, "Die ID ist größer als die maximal vergebene ID.",
MessageType.ERROR)
for plan in usage.time_charging.plans:
Comment on lines +111 to +121
def scheduled_charging(self) -> Tuple[Chargemode, str]:
return self.data.config.min_current, "Zielladen noch nicht implementiert", Chargemode.STOP, Chargemode.STOP
plan_data, remaining_time, duration = self._find_recent_plan(self.data.usage.scheduled_charging.plans)
if plan_data:
control_parameter.current_plan = plan_data.id
else:
control_parameter.current_plan = None
return self.scheduled_charging_calc_current(
plan_data,
remaining_time,
duration)
Comment thread packages/control/consumer/consumer.py Outdated
Comment on lines +439 to +441
if ((submode == "time_charging" and self.data.control_parameter.chargemode != "time_charging") or
(submode != "time_charging" and
self.data.control_parameter.chargemode != mode)):
Comment on lines +399 to +413
def reset_chargemode_at_midnight(self):
if self.data.usage.reset_chargemode.mode == ResetModes.MIDNIGHT:
if self.data.usage.chargemode != self.data.usage.reset_chargemode.chargemode:
log.info(f"Zurücksetzen des Lademodus auf {self.data.usage.reset_chargemode.chargemode} "
f"für Verbraucher {self.num} um Mitternacht.")
self.data.usage.chargemode = self.data.usage.reset_chargemode.chargemode

def reset_chargemode_at_time(self):
if (self.data.usage.reset_chargemode.mode == ResetModes.TIME and
self.data.usage.reset_chargemode.time is not None):
if timecheck.create_timestamp() > self.data.usage.reset_chargemode.time:
if self.data.usage.chargemode != self.data.usage.reset_chargemode.chargemode:
log.info(f"Zurücksetzen des Lademodus auf {self.data.usage.reset_chargemode.chargemode} "
f"für Verbraucher {self.num} um definierte Zeit.")
self.data.usage.chargemode = self.data.usage.reset_chargemode.chargemode
@LKuemmel
LKuemmel merged commit 35ce6da into openWB:feature_consumer Jun 24, 2026
1 check passed
LKuemmel added a commit that referenced this pull request Jun 30, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Jul 3, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Jul 8, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Jul 15, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Jul 23, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 6, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 18, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 18, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 19, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 19, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 20, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 20, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 20, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 21, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 24, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 26, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Aug 28, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Sep 7, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit to benderl/core that referenced this pull request Sep 8, 2026
…B#3588)

* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Sep 9, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Sep 9, 2026
* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
LKuemmel added a commit that referenced this pull request Sep 9, 2026
* draft

* draft

* fixes

* fixes

* Anlauferkennung, Betriebsmodus zurücksetzen, Befehle für Pläne (#3588)

* draft

* Anlauferkennung

* Betriebsmodus zurücksetzen

* ammend

* Anlauferkennung

* draft

* draft scheduled charging

* add scheduled und time plan commands for adding and removing

* flake8

* update config

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* review

* fix pytest

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* on time, fixes (#3612)

* on_time

* eco default price, typo

* on_time accessible via 1883 (#3626)

* on_time accessible via 1883

* fix

* Add Consumer tab and cards to koala web theme (#3630)

* add consumer tab/cards

* apply new design to consumer cards

* add consumer time on to consumer card

* fix consumer card CSS

* remove redundant placeholders

* imported and exported for consumers; daily, monthly log; daily yields; graph data (#3644)

* update module config

* imported and exported for consumers

* daily, monthly log

* daily yields

* graph data

* Consumer cards in carousel - small screen mobile view (#3637)

* Intergrate consumers in koala theme charts (#3672)

* Add consumer to energy flow chart

* Add consumer row to daily totals chart

* Add consumer total to history chart

* add consumer color to store

* Align legend category dropdowns

* Add consumer component to display flow chart (#3673)

* Add consumer component to display flow chart

* Add user management role

* energy percentage, set usage per json, several fixes (#3705)

* energy percentage, set usage per json

* consider min interval

* fixes

* pv

* fix

* pycheck, fix extra meter

* ammend

* fixes

* ammend

* fix

* switch interval elapsed

* flake8

* improve wait for start

* shelly, pytest (#3730)

* add shelly, flake8, pytest consumer chargemodes

* fix shelly

* existing pytests running

* review

* fix colors, lookup dict names and colors for consumers (#3736)

* fix colors, lookup dict names and colors for consumers

* review

* hide mode controls for consumer measurement only (#3715)

* update consumer-configuration-access (user management) (#3743)

* diagram colors, pytests, remove extra meters from log data (#3742)

* fix colors, lookup dict names and colors for consumers

* review

* extend tests

* add colors for yearly graph data

* remove extra meters from log data

* remove comment

* flake8

* ammend

* fix_merge

* switch mode on card

* update consumer button groups

* update message - data order in consumer card

* linting

* reapply lost changes from #3715

* usage type self controlled (#3775)

* usage type self controlled

* fix

* review

* review (#3776)

* calc on time (#3777)

* calc on time

* review

* pytest (#3786)

* fix pytest

* fixes, pytest

* review

* fix

* fixes (#3794)

* typo

* fix

* pytest

* Reworked IDM and Lambda consumer and add Ovum (#3737)

* IDM: send PV/Hausverbrauch/Batterie via GLT statt Leistungsvorgabe

* Lambda: PV-Überschuss statt power_limit an E-Manager senden

* Add OVUM CubeSpeicher/MPlus consumer module

* IDM: revert scaling factor, fix flake8 formatting

* flake8

* Rename send_grid_values to send_values in config.py

* Adjust surplus calculation to account for charging power

Include charging power in surplus calculation to avoid misreporting surplus to the heat pump.

* Update send_values function to send grid power

* Add Self_Controlled for IDM and Lambda

* flake8: fix syntax error and whitespace in consumer modules

Stray pasted line broke lambda_ consumer.py syntax; idm/lambda_/ovum
files had trailing whitespace on blank lines and missing EOF newlines.

* split PR: remove moduls except mqtt

* fix loadmanagement, clean up (#3819)

* clean up

* fix loadmanagement

* review

* review

* flake8

* fix versions

* fix merge error

* consider non charging for consumers and update consumer state messages (#3840)

* no charge for loads

* consider non charging for consumers and update consumer state messages

* flake8

* review

* fix rebase

* pass data object as parameter in set_power_limit methode (#3854)

* fix some type hints (#3866)

* fix reset of consumer state string (#3887)

* pass data object as parameter in set_power_limit methode, review (#3856)

* improve

* review: update comments

* flake8

* fix rebase

* Verbraucher: Fixes für  Löschen & Hinzufügen (#3909)

* fixes delete consumer, add consumer

* review

* Verbraucher: Fixes für Topics und Anlauferkennung (#3911)

* fixes

* type hint

* fix thread handling (#3912)

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: BrettS <[email protected]>
Co-authored-by: Brett-S-OWB <[email protected]>
Co-authored-by: Lutz Bender <[email protected]>
Co-authored-by: SeaSpotter <[email protected]>
Co-authored-by: benderl <[email protected]>
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