Skip to content

feat(controls): expose export priority and EPS for AC-coupled inverters#90

Merged
dewet22 merged 1 commit into
mainfrom
feat/eps-export-priority
Jun 1, 2026
Merged

feat(controls): expose export priority and EPS for AC-coupled inverters#90
dewet22 merged 1 commit into
mainfrom
feat/eps-export-priority

Conversation

@dewet22

@dewet22 dewet22 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

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, Grid
    First, Load First (HR311 via set_export_priority)
  • enable_eps — switch entity for Emergency Power Supply mode (HR317 via
    set_enable_eps)

Both require givenergy-modbus >=2.1.0b3, which adds the commands, the
ExportPriority enum, and includes HR(300-359) in the load_config poll
block 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-model
register 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-modbus pin to >=2.1.0b3.

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@dewet22, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 82104064-89a3-4f67-8952-0d1f6169ee08

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5a7d3 and 94aaceb.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • custom_components/givenergy_local/manifest.json
  • custom_components/givenergy_local/select.py
  • custom_components/givenergy_local/switch.py
  • pyproject.toml
  • tests/test_select.py
  • tests/test_switch.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/eps-export-priority

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dewet22-codex

Copy link
Copy Markdown
Collaborator

I’ve started reviewing this PR.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgivenergy-modbus@​2.1.0b2 ⏵ 2.1.0b3100 +1100100100100

View full report

@gemini-code-assist gemini-code-assist 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.

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.

Comment thread custom_components/givenergy_local/select.py
Comment thread custom_components/givenergy_local/switch.py

@dewet22-codex dewet22-codex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@dewet22 dewet22 merged commit 0927d64 into main Jun 1, 2026
9 checks passed
@dewet22 dewet22 deleted the feat/eps-export-priority branch June 1, 2026 15:53
dewet22 added a commit that referenced this pull request Jun 4, 2026
… 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>
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