Skip to content

add type for loadmanagement prio, improve update config - #3834

Merged
LKuemmel merged 3 commits into
openWB:feature_loadmanagement_prio_listfrom
LKuemmel:loadmanagement_prio_list
Aug 21, 2026
Merged

add type for loadmanagement prio, improve update config#3834
LKuemmel merged 3 commits into
openWB:feature_loadmanagement_prio_listfrom
LKuemmel:loadmanagement_prio_list

Conversation

@LKuemmel

Copy link
Copy Markdown
Contributor

Wenn ich ein Fahrzeug lösche, wird aus openWB/counter/get/loadmanagement_prios nicht der Eintrag des Fahrzeugs entfernt, sondern der Eintrag eines Verbrauchers – und zwar genau der, der dieselbe ID hat.

Fahrzeuge und Verbraucher vergeben ihre IDs unabhängig voneinander, die Nummernkreise überschneiden sich also.

@LKuemmel
LKuemmel requested a lite review from Copilot August 20, 2026 13:39

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (3)

packages/control/counter_all/counter_all_data.py:104

  • Im Protocol stimmt die Signatur von _remove_loadmanagement_prio_item nicht mit der Implementierung in LoadmanagementPrioMixin überein: dort wird entry als List[Dict] erwartet und ein bool zurückgegeben. Das kann Typprüfung/IDE-Unterstützung brechen und verdeckt echte Fehler.
    def add_loadmanagement_prio_item(self, type: ComponentType, id: int) -> None: ...
    def remove_loadmanagement_prio_item(self, type: ComponentType, id: int) -> None: ...
    def _remove_loadmanagement_prio_item(self, type: ComponentType, id: int, entry: Dict) -> None: ...

packages/control/counter_all/loadmanagement_prio_test.py:36

  • Kleiner Tippfehler im Test-Case-Label: emtpy list sollte empty list heißen (hilft beim Lesen von Testreports).
        pytest.param([], 2, ComponentType.VEHICLE, [{"type": "vehicle", "id": 2}], id="emtpy list"),

packages/control/counter_all/loadmanagement_prio_test.py:142

  • In test_remove_loadmanagement_prio_item wird der parametrisierte type aktuell ignoriert und hart ComponentType.VEHICLE verwendet. Besser ist es, den parametrisierten Wert zu nutzen (und so auch klar zu machen, dass nach type+id entfernt wird).
    c.remove_loadmanagement_prio_item(ComponentType.VEHICLE, id)

@LKuemmel
LKuemmel force-pushed the feature_loadmanagement_prio_list branch from 92d9f60 to f855518 Compare August 21, 2026 07:55
@LKuemmel
LKuemmel force-pushed the loadmanagement_prio_list branch from 1ec4037 to 4585cd5 Compare August 21, 2026 12:02
@LKuemmel LKuemmel changed the title add type for loadmanagement prio add type for loadmanagement prio, improve update config Aug 21, 2026
@LKuemmel
LKuemmel requested a balanced review from Copilot August 21, 2026 12:04

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

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

self.all_received_topics[f"openWB/vehicle/template/charge_template/{charge_template_id}"])
if charge_template["chargemode"]["selected"] == chargemode and charge_template["prio"] == prio:
loadmanagement_prios.append({"type": "vehicle", "id": int(get_index(topic))})
grouped_vehicles.append({"type": "vehicle", "id": int(get_index(topic))})
@LKuemmel
LKuemmel force-pushed the loadmanagement_prio_list branch from 4585cd5 to 5496a81 Compare August 21, 2026 12:17
@LKuemmel
LKuemmel requested a balanced review from Copilot August 21, 2026 12:17

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

packages/helpermodules/command.py:797

  • ComponentType.VEHICLE.value is "vehicle", which is exactly the value that remove_loadmanagement_prio_item hard-coded before this change. Consequently, the removeVehicle path is behaviorally identical and can still select the same colliding entry described in the PR. The vehicle and consumer entries need distinct persisted type values, and this call must target the vehicle value after existing data is migrated.
            data.data.counter_all_data.remove_loadmanagement_prio_item(ComponentType.VEHICLE, payload["data"]["id"])

packages/control/counter_all/loadmanagement_prio_test.py:142

  • The test now ignores its parametrized type argument and always removes ComponentType.VEHICLE; moreover, every fixture contains only vehicle entries. It therefore cannot exercise the same-ID, different-type collision that this PR is intended to fix. Pass enum values through the parameter and add a mixed-type case asserting that only the requested type is removed.
    c.remove_loadmanagement_prio_item(ComponentType.VEHICLE, id)

Comment on lines +3598 to +3603
grouped_vehicles = []
self._loop_all_received_topics(upgrade)
if len(grouped_vehicles) == 1:
loadmanagement_prios.append(grouped_vehicles[0])
elif len(grouped_vehicles) > 1:
loadmanagement_prios.append({"type": "group", "children": grouped_vehicles})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

im Feature-Branch nicht relevant

@LKuemmel
LKuemmel merged commit ddfaf21 into openWB:feature_loadmanagement_prio_list Aug 21, 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.

2 participants