Expose POWER_OFFSET and POWER_MULTIPLIER as Home Assistant addon config#308
Conversation
WalkthroughTwo new configuration options ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ha_addon/translations/en.yaml (1)
40-43: Consider clarifying mismatched per-phase list behavior.These descriptions are good, but they currently imply strict “one per phase.” Runtime behavior in
src/astrameter/powermeter/transform.pycycles provided values when counts differ and warns once. A short note about cycling/warning would reduce ambiguity.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ha_addon/translations/en.yaml` around lines 40 - 43, Update the user-facing descriptions for the "power_multiplier" and "power_offset" translation entries to state that if a comma-separated list length doesn't match the number of phases the runtime will cycle the provided values and emit a single warning; see the runtime behavior implemented in src/astrameter/powermeter/transform.py for exact semantics. Mention both the cycling and the single-warning behavior succinctly (e.g., "if counts differ, values are cycled and a single warning is logged") so users understand mismatched-list handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ha_addon/translations/en.yaml`:
- Around line 40-43: Update the user-facing descriptions for the
"power_multiplier" and "power_offset" translation entries to state that if a
comma-separated list length doesn't match the number of phases the runtime will
cycle the provided values and emit a single warning; see the runtime behavior
implemented in src/astrameter/powermeter/transform.py for exact semantics.
Mention both the cycling and the single-warning behavior succinctly (e.g., "if
counts differ, values are cycled and a single warning is logged") so users
understand mismatched-list handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4cc3d299-7d08-42b9-a38d-101b1c3e3050
📒 Files selected for processing (4)
CHANGELOG.mdha_addon/config.yamlha_addon/run.shha_addon/translations/en.yaml
Summary
This PR exposes the
POWER_OFFSETandPOWER_MULTIPLIERconfiguration options as optional advanced fields in the Home Assistant addon UI, allowing users to calibrate and transform power meter readings directly through the addon configuration without manual environment variable setup.Key Changes
power_offsetandpower_multiplieroptions, which are now exported as environment variables if providedImplementation Details
?in schema)bashio::config.has_valuechecksvalue * POWER_MULTIPLIER + POWER_OFFSET) and support for both single values and comma-separated per-phase listshttps://claude.ai/code/session_018GRnGWjaCTp4QdaCUcVoo4
Summary by CodeRabbit