Skip to content

Consumer: fix update values extra meters, on time counter for not controlled - #4081

Merged
LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:consumer
Oct 12, 2026
Merged

LKuemmel merged 2 commits into
openWB:masterfrom
LKuemmel:consumer

Conversation

@LKuemmel

@LKuemmel LKuemmel commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

🟡 Changes recommended

Current calculation can overwrite measurements or fail on zero voltage, and some linked meters may be finalized after their consumers.

3 open findings
What changed in this PR

This PR updates consumer value handling so uncontrolled consumers track on-time, and schedules extra meters for value updates.

Changes:

  • Adds linked extra meters that are absent from the hierarchy to the update sequence.
  • Moves consumer current, charge-state, and on-time calculations before the uncontrolled-consumer return.
File Description
packages/​modules/​loadvars.py Adds extra meters to the update levels.
packages/​control/​consumer/​consumer.py Updates consumer state and on-time before the early return.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/control/consumer/consumer.py Outdated
Comment thread packages/control/consumer/consumer.py Outdated
Comment thread packages/modules/loadvars.py

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.

🟡 Changes recommended

A linked virtual extra meter can fail to calculate and publish its reading when it has no hierarchy entry.

1 open finding
3 resolved since last review

🧠 Review effort: Lite

continue
if extra_meter_id in known_counter_ids:
continue
extra_meter_level.append({"type": ComponentType.COUNTER.value, "id": extra_meter_id})
@LKuemmel
LKuemmel merged commit c0544ab into openWB:master Oct 12, 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