Skip to content

feat: dashboard PR B — battery OOS, AC output telemetry, battery maintenance mode#122

Merged
dewet22 merged 2 commits into
mainfrom
feat/dashboard-gaps-pr-b
Jun 4, 2026
Merged

feat: dashboard PR B — battery OOS, AC output telemetry, battery maintenance mode#122
dewet22 merged 2 commits into
mainfrom
feat/dashboard-gaps-pr-b

Conversation

@dewet22

@dewet22 dewet22 commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

Mid-priority observability gaps, building on PR A.

  • Battery Out Of Spec (binary_sensor, Expose a single "battery out of spec" binary_sensor (sustained voltage/temperature excursions) #78) now surfaces on the Overview Status glance and Diagnostics → Faults & Warnings. Existing platform code didn't carry a name= in DeviceInfo, so HA was registering the entity_id as binary_sensor.battery_out_of_spec (no device prefix). Aligned its DeviceInfo with sensor.py (name="GivEnergy Inverter <serial>") so the slug becomes binary_sensor.givenergy_inverter_<serial>_battery_out_of_spec — consistent with every other platform.
  • AC output Voltage / Frequency / Current added to Diagnostics → Electrical alongside the existing AC input metrics (input/output labels disambiguated).
  • Battery Maintenance Mode added to Diagnostics → Hardware & Firmware. Three-phase only; skip_if_none keeps the entity absent on single-phase inverters.
  • DASHBOARD_VERSION → 9 so existing installs see the Repairs prompt.

Refs #78. Branched off main, independent from PR #121.

Test plan

  • Full local test suite green (uv run pytest): 231 passed.
  • New tests assert battery_out_of_spec appears in both Status glance and Faults card; Electrical card carries AC output telemetry; Hardware card carries battery_maintenance_mode.
  • Manual: existing install — verify binary_sensor.battery_out_of_spec keeps its entity_id (HA preserves it for existing installs); fresh install — verify the new prefixed entity_id is generated.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 4, 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 34 minutes and 33 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: 5caf3ce9-63ba-4beb-9803-e86bc80982b8

📥 Commits

Reviewing files that changed from the base of the PR and between 12e1732 and e329364.

📒 Files selected for processing (5)
  • custom_components/givenergy_local/binary_sensor.py
  • custom_components/givenergy_local/dashboard.py
  • custom_components/givenergy_local/sensor.py
  • dashboard/template.yaml
  • tests/test_dashboard.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dashboard-gaps-pr-b

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.

@deepsource-io

deepsource-io Bot commented Jun 4, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 12e1732...e329364 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Jun 4, 2026 6:38a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@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 Local integration to mirror the DeviceInfo from sensor.py in binary_sensor.py, ensuring correct entity ID prefixing. It also updates the dashboard configuration and templates to include the battery out-of-spec binary sensor, AC output metrics, and the battery maintenance mode sensor, with corresponding test coverage added. Feedback recommends adding skip_if_none=True to the battery_maintenance_mode sensor description to avoid it appearing as unknown on single-phase inverters, and moving the local import of _device_kind to the top of the file as there is no circular dependency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +738 to +739
- entity: {_i(inv, "battery_maintenance_mode")}
name: Battery Maintenance Mode

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The PR description states that battery_maintenance_mode is three-phase only and that skip_if_none keeps the entity absent on single-phase inverters. However, in sensor.py (line 176), the GivEnergyInverterSensorDescription for battery_maintenance_mode does not have skip_if_none=True set.\n\nWithout skip_if_none=True, this entity will still be created on single-phase inverters but will remain permanently unknown or unavailable. Please update the sensor description in sensor.py to include skip_if_none=True to align with the intended behavior.

Comment on lines 117 to 119
from .sensor import _device_kind # local import to avoid module cycle

serial = coordinator.data.inverter_serial_number

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

There is no circular dependency between sensor.py and binary_sensor.py because sensor.py does not import binary_sensor. Therefore, the local import of _device_kind is unnecessary and can be moved to the top of the file to adhere to PEP 8 style guidelines.

Suggested change
from .sensor import _device_kind # local import to avoid module cycle
serial = coordinator.data.inverter_serial_number
serial = coordinator.data.inverter_serial_number
References
  1. PEP 8 recommends placing all imports at the top of the file, immediately after any module comments and docstrings, and before module globals and constants. (link)

@dewet22

dewet22 commented Jun 4, 2026

Copy link
Copy Markdown
Owner Author

Gemini's two findings addressed in 26b1ecd:

  1. battery_maintenance_mode missing skip_if_none: Added — the entity won't be created on single-phase installs where HR 1124 is absent. Was returning None from value_fn but the flag wasn't set, so it would appear as Unknown rather than simply not existing.

  2. _device_kind local import: Moved to module level — confirmed no circular dependency (sensor.py doesn't import from binary_sensor.py).

@dewet22 dewet22 enabled auto-merge (squash) June 4, 2026 06:36
dewet22 and others added 2 commits June 4, 2026 07:37
…tenance mode

- Surfaces the battery_out_of_spec binary sensor on the Overview Status
  glance and Diagnostics → Faults & Warnings.
- Adds AC output voltage/frequency/current to Diagnostics → Electrical,
  alongside the existing AC input metrics (relabelled for clarity).
- Adds battery_maintenance_mode to Diagnostics → Hardware & Firmware
  (three-phase only; skip_if_none handles the gating).
- Aligns binary_sensor's DeviceInfo with sensor.py so its entity_id slug
  picks up the GivEnergy Inverter device-name prefix consistently.
- Bumps DASHBOARD_VERSION to 9. Refs #78.
… import

Add skip_if_none=True to the battery_maintenance_mode sensor so the entity
doesn't appear as Unknown on single-phase installs where HR 1124 is absent.
Move the _device_kind import in binary_sensor.py to module level — no circular
dependency exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dewet22 dewet22 force-pushed the feat/dashboard-gaps-pr-b branch from 26b1ecd to e329364 Compare June 4, 2026 06:37
@dewet22 dewet22 merged commit cc4d61e into main Jun 4, 2026
10 checks passed
@dewet22 dewet22 deleted the feat/dashboard-gaps-pr-b branch June 4, 2026 06:38
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.

1 participant