Skip to content

fix(smart-plugs): select printer power deterministically - #171

Merged
ichwars merged 2 commits into
mainfrom
dev-issue-140-smart-plug-selection
Sep 7, 2026
Merged

fix(smart-plugs): select printer power deterministically#171
ichwars merged 2 commits into
mainfrom
dev-issue-140-smart-plug-selection

Conversation

@ichwars

@ichwars ichwars commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • use one deterministic printer-power ranking for the printer card, queue power-on, and per-print energy accounting
  • prefer switchable, explicitly assigned, enabled and measurable power rows while retaining script-only fallbacks and accessory automation
  • never bill a metered accessory when the selected printer outlet has no lifetime counter; log missing measurements instead
  • extract the shared rule from size-limited consumers and lower their grandfathered source budgets

Related Issue

Closes #140

Documentation

  • No docs update required — this fixes internal smart-plug selection without changing configuration or workflow

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Code refactoring
  • Test addition or update

Upstream comparison

Selectively adapts the deterministic smart-plug selection behavior from maziggy/bambuddy commits 5a05e03 and 9a2b811. PrintOps' per-plug accessory/dryer automation and active-print auto-off protection remain unchanged; energy fallback is intentionally stricter so accessory meters cannot be attributed to printer consumption.

Testing

  • Issue regression suite: 34 passed
  • Smart-plug, energy, manager, and archive regression selection: 209 passed
  • Full backend: 8,593 passed, 253 skipped
  • Full frontend: 3,041 passed across 267 files; all 11 locales in parity
  • Frontend lint, TypeScript typecheck, and isolated production build
  • Ruff lint/format, source-size budget, dependency boundaries, compile check, domain guard, and diff checks

Checklist

  • My code follows the project's coding style
  • My changes generate no new warnings
  • I have tested my changes thoroughly
  • No protected PrintOps business-domain behavior was removed

Hardware note

No printer-hardware test was performed. Tasmota, Home Assistant switches/scripts, MQTT monitors, REST capability ranking, disabled rows, multiple metered rows, accessory preservation, and missing-counter behavior are covered by automated tests.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T19:59:48.627075Z 40610e2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40610e2798

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/app/services/smart_plug_selection.py
Comment thread backend/app/services/smart_plug_selection.py Outdated
@ichwars
ichwars merged commit c2f01aa into main Sep 7, 2026
30 checks 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.

Drucker-Steckdose für Leistung, Energie und Kosten deterministisch auswählen

1 participant