feat: add glance mode (mode: glance) for the givenergy dashboard strategy (#131)#137
Conversation
…tegy
Adds a Glance panel to the custom:givenergy dashboard strategy, selectable
via `strategy: { type: custom:givenergy, mode: glance }`.
The panel is a new `custom:givenergy-glance` card (no additional install)
that renders:
- A natural-language status sentence with a pulsing amber/green dot:
"Solar covering the house and charging the battery, exporting the
surplus." and eight other states derived from live grid/battery/solar
sign combinations.
- Three large Fraunces numerals: Solar today (kWh), Battery SOC (%),
House today (kWh), each with a contextual sub-line (string breakdown,
per-pack SOC, import/export direction).
- Health pills: battery count, per-pack SOC when multiple packs present,
imported/exported kWh today, active per-string generation.
EMS plants fall back to the classic view set (no glance panel), matching
the flow mode behaviour. Kiosk-mode hints are emitted when the
integration is detected.
Four new JS tests (29 total); _STRATEGY_VERSION bumped to 6.
Part of #131.
|
Warning Review limit reached
More reviews will be available in 44 minutes and 49 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 selected for processing (4)
📝 WalkthroughWalkthroughThis PR introduces a new "glance" dashboard mode for the GivEnergy Home Assistant integration. The changes add glance view generation, mode dispatcher routing, a custom card component for metrics display, comprehensive tests, and a cache-busting version bump to ensure clients fetch the updated JavaScript bundle. ChangesGlance Dashboard Mode
Sequence DiagramsequenceDiagram
participant Lovelace as Lovelace
participant dispatcher as generateDashboard
participant generator as glanceViews
participant card as custom:givenergy-glance
Lovelace->>dispatcher: generateDashboard({mode:"glance"})
dispatcher->>generator: route to glanceViews
generator->>dispatcher: return glance panel with card refs
dispatcher->>Lovelace: dashboard with glance panel
Lovelace->>card: load and render component
card->>card: compute status from entity states
card->>Lovelace: display big 3 metrics + pills
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'glance' mode to the GivEnergy dashboard. It adds a custom element givenergy-glance that displays a natural-language status sentence, key metrics (solar today, battery SOC, and house today), and health pills. The strategy version is bumped to 6, and corresponding unit tests are added to verify the glance mode functionality. There are no review comments to address.
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.
… README Restructure the status sentence logic to check the net grid direction (exporting / importing / idle) within the solarOn group before deciding what to say. Previously `solarOn` took priority over `importing`, so e.g. solar=200 W with grid=-1500 W produced "Solar covering the house" despite heavy grid import. The new structure: solarOn + exporting -> "ahead of demand" / "exporting the surplus" / etc. solarOn + importing -> "Solar and grid supplying..." (admits the import) solarOn + idle grid -> "Solar covering..." / "...and charging..." no solar -> battery/grid/idle branches (unchanged) Also adds the `#### mode: glance` section to the README and updates the mode comment and "still to come" line to reflect the shipped state.
Replace the single 100 W threshold with a Schmitt-trigger pair: THRESH_ON=200 W to enter a state, THRESH_OFF=80 W to leave it. Persisted via this._flowState between renders. Prevents the sentence from flipping between states when readings are near a threshold -- e.g. solar=170 W / grid=+150 W briefly claiming "Solar ahead of demand" at dusk when sensor timing skew tips the grid reading just above the old 100 W entry threshold.
Temporary dev convenience: a single dashboard with all mode panels (Glance, Flow, then the six classic tabs). Intended to be removed when modes are split into separate dashboards at release time. _STRATEGY_VERSION bumped to 7.
Adds a dense terminal-aesthetic Analyst view that combines live power metrics, an energy sources/sinks ledger with percentages, inverter diagnostics, a 24h apexcharts power overlay (placeholder if absent), and per-pack cell heatmaps in a multi-card non-panel layout. Also folds Analyst into mode: all (Glance -> Flow -> Analyst -> classic tabs) and bumps _STRATEGY_VERSION to 8. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
I’ve started re-reviewing this PR. |
Adds README sections for mode:analyst and mode:all (same pattern as mode:flow and mode:glance). Updates the mode hint comment in the strategy yaml example to list all five modes. Removes the "dev convenience" label from the mode:all comment in ge-strategy.js now that all four UX modes are implemented. Addresses coderabbitai feedback on PR #137. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the three-point review. Quick status on each: Status sentence logic — the concern was already addressed by the fix commits ( README missing glance docs — also covered by
|
Summary
Closes part of #131 — introduces
mode: glanceas a third selectable mode for thecustom:givenergydashboard strategy.What's new
mode: glanceprepends a full-viewport Glance panel (panel: true) to the existing classic view set.custom:givenergy-glance— a new vanilla custom element (no build step) that renders:flowmode behaviour.hide_header,hide_sidebar) are feature-detected and omitted when the integration is absent._STRATEGY_VERSIONbumped to6for cache-busting.Tests
Four new JS tests (29 total): view set shape, EMS fallback, registry resolution under the
loft_area prefix, and missing-entity omission.Test plan
strategy: { type: custom:givenergy, mode: glance }to a dashboard.mode: glancefalls back to the classic EMS view set.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores