feat(time): Smart Load slot 1–10 time entities + givenergy-modbus 2.1.0b15#106
Conversation
Smart Load slots (HR 554-573) are now fully writable via the new set_smart_load_slot_start/end helpers in givenergy-modbus 2.1.0b15. Exposes all 10 slots as start/end time entities in EntityCategory.CONFIG, following the same pattern as charge/discharge slots. No capability gating — smart load slots are populated by load_config() on all non-EMS inverters. Also picks up the b15 identify helpers (testing/cross-correlation use). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 19 minutes and 6 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 |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Jun 2, 2026 3:04p.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.
There was a problem hiding this comment.
Code Review
This pull request introduces support for smart load slot entities (slots 1 to 10) in the GivEnergy Local integration, enabling configuration of start and end times. It also bumps the givenergy-modbus dependency to version 2.1.0b15 and adds corresponding unit tests. Feedback was provided to use defensive attribute access with getattr when retrieving smart load slots to prevent potential AttributeError on inverter models or firmware versions where these slots are not supported.
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.
|
I’ve started reviewing this PR. |
…rters ThreePhaseInverter has no smart_load_slot_* fields (only SinglePhaseInverter does), but the time entities are created unconditionally. Direct attribute access would raise AttributeError in native_value on a three-phase install; getattr(..., None) lets the entity report unavailable instead. Addresses Gemini review on #106. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Smart load entities are created unconditionally for every inverter. Both SinglePhaseInverter and ThreePhaseInverter define smart_load_slot_* as optional pydantic fields (default None), so direct access is safe today — getattr(..., None) is cheap insurance against a future model that drops the field, letting the entity report unavailable instead of raising. Adds a regression test pinning the None-not-raise contract. Addresses Gemini review on #106. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
361353b to
7ed8fbe
Compare
Smart Load slots are inverter-level scheduling that the EMS controller supersedes — the library only populates HR(554-573) on non-EMS inverters. Creating all 20 entities unconditionally left an EMS plant with a block of permanently-unavailable config entities and silent-no-op writes. Gate them on coordinator.data.ems is None, mirroring the existing EMS-entity gating (now mutually exclusive: EMS plants get EMS slots, others get Smart Load). Adds an EMS-setup assertion that no smart_load_slot_* entities are created. Addresses Codex review on #106. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… 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>
Summary
givenergy-modbusfrom2.1.0b14to2.1.0b15timeentitiesSmart Load slots
Ten start/end time entities (
smart_load_slot_1_start…smart_load_slot_10_end) created unconditionally for all non-EMS inverters. The slots are populated byload_config()and written via the newset_smart_load_slot_start/endhelpers added in b15. Pattern mirrors charge/discharge slots — fixed registers, noslot_mapneeded.b15 changelog (cumulative from b8, the previous pin)
WRITE_SAFE_REGISTERSexpanded with app-confirmed registers (#48)enable_inverter_parallel_mode; deprecated alias in place — no hass code changes needed.smart_load_slot_1..10decode addedset_smart_load_slot_start/end/slotwrite helpers; register cross-correlation identify helpers (testing use)Test plan
uv run pytest --tb=short -q)test_all_time_slot_entities_createdupdated to include all 20 smart load slot entitiestest_smart_load_slot_1_start/end_initial_value— value from fixturetest_set_smart_load_slot_1_start_sends_command— write path exercisedtest_set_smart_load_slot_5_end_sends_command— spot-check mid-range idx capture🤖 Generated with Claude Code