feat(controls): expose export priority and EPS for AC-coupled inverters#90
Conversation
…d inverters HR311 (export priority, 3 modes) and HR317 (EPS on/off) were confirmed writable on AC-coupled inverters via portal observations (issue #52). givenergy-modbus b3 adds ExportPriority enum, set_export_priority/set_enable_eps commands, and includes these registers in the HR(300-359) load_config poll block. - export_priority: select entity (Battery First / Grid First / Load First) - enable_eps: switch entity Both gated on caps.is_ac_coupled and not caps.is_three_phase, mirroring the existing AC-limit gate. Three-phase AC deferred pending modbus#75. Bumps givenergy-modbus pin to >=2.1.0b3. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 39 minutes and 46 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✨ Finishing Touches🧪 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 |
|
I’ve started reviewing this PR. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request updates the givenergy-modbus dependency to version 2.1.0b3 and introduces new configuration controls specifically for AC-coupled, single-phase inverters, including an 'Export Priority' select entity and an 'Emergency Power Supply (EPS)' switch entity. Corresponding unit tests have been added to verify these entities are only registered when appropriate. The review feedback suggests adopting defensive attribute access (using getattr) and robust error handling when retrieving export_priority and enable_eps to prevent potential AttributeError or type conversion issues on inverter models or firmware variants where these attributes might not be populated.
dewet22-codex
left a comment
There was a problem hiding this comment.
Approved. I reviewed the current head and do not have any actionable concerns. I ran uv run pytest -q (160 passed), uv lock --check, and targeted ruff on the changed files; GitHub checks are green apart from CodeQL still being in progress at review time.
… totals (#121) * feat: dashboard PR A — Smart Load, AC-Coupled, mode controls, battery totals Closes high-priority gaps between exposed entities and the generated dashboard: - Smart Load slots 1–10 on Controls (`has_smart_load` kwarg; defaults open until givenergy-modbus exposes a capability we can gate on per #181 / 2.1.3 — wired through with a TODO). - AC-Coupled card on Controls (export priority, EPS, AC charge/discharge limits) gated by `has_ac_config_block` from PlantCapabilities. - Mode card additions: Real Time Control, Inverter Max Output Power. - Energy → All-Time Totals: Battery Charged / Battery Discharged. - Bumps DASHBOARD_VERSION to 8 so the Repairs prompt fires on existing installs. Refs #52, #76, #83, #89, #90, #106. * fix: align has_ac_config_block gating with entity registration Exclude three-phase systems from the AC-coupled card — switch.py and number.py both gate AC-coupled entities on `not caps.is_three_phase`, so the dashboard flag must match. Also replace EN DASH characters in docstrings with plain ASCII hyphens (ruff RUF002). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
What
Two new controls for AC-coupled inverters, both observed being written by
the GivEnergy portal during deliberate testing on real hardware (issue #52):
export_priority— select entity with three options: Battery First, GridFirst, Load First (HR311 via
set_export_priority)enable_eps— switch entity for Emergency Power Supply mode (HR317 viaset_enable_eps)Both require givenergy-modbus >=2.1.0b3, which adds the commands, the
ExportPriorityenum, and includes HR(300-359) in theload_configpollblock so these fields are read automatically.
Gating
Same gate as the AC charge/discharge limits:
caps.is_ac_coupled and not caps.is_three_phase. Three-phase AC is excluded for now — pending per-modelregister work in modbus#75, at which point the gate can relax to just
is_ac_coupled.Caveat
Not yet validated on live hardware — that's the next step once a reporter
with an AC-coupled plant picks up the pre-release. Tests cover both paths:
absent on the hybrid default fixture, present and command-sending on a
PlantCapabilities(device_type=Model.AC)fixture.Bumps
givenergy-modbuspin to>=2.1.0b3.🤖 Generated with Claude Code