Skip to content

Conversation

@naltatis
Copy link
Member

@naltatis naltatis commented Jan 6, 2026

fixes #25949

create single lpc circuit if hems but no load management is configured.

Bildschirmfoto 2026-01-06 um 14 17 05 Bildschirmfoto 2026-01-06 um 14 17 17

@naltatis naltatis requested review from andig and premultiply January 6, 2026 13:21
@naltatis naltatis added the bug Something isn't working label Jan 6, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The hard-coded circuit ID and name "lpc" are duplicated in GetOrCreateCircuit("lpc", "lpc"); consider introducing a shared constant or reusing existing configuration to avoid magic strings and keep this in sync with other circuit-related logic.
  • Auto-creating a circuit inside configureHEMS adds a side effect to a function that otherwise just configures HEMS; consider moving this behavior to a more central initialization path or clearly documenting that HEMS configuration may mutate circuit state.
  • Using log.INFO for the auto-create message might be noisy in normal operation; consider downgrading to a more verbose log level or making it conditional so it only appears when the auto-creation actually changes state.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hard-coded circuit ID and name "lpc" are duplicated in `GetOrCreateCircuit("lpc", "lpc")`; consider introducing a shared constant or reusing existing configuration to avoid magic strings and keep this in sync with other circuit-related logic.
- Auto-creating a circuit inside `configureHEMS` adds a side effect to a function that otherwise just configures HEMS; consider moving this behavior to a more central initialization path or clearly documenting that HEMS configuration may mutate circuit state.
- Using `log.INFO` for the auto-create message might be noisy in normal operation; consider downgrading to a more verbose log level or making it conditional so it only appears when the auto-creation actually changes state.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HEMS: auto-create load management

2 participants