Skip to content

feat(time): Smart Load slot 1–10 time entities + givenergy-modbus 2.1.0b15#106

Merged
dewet22 merged 3 commits into
mainfrom
feat/smart-load-slots
Jun 2, 2026
Merged

feat(time): Smart Load slot 1–10 time entities + givenergy-modbus 2.1.0b15#106
dewet22 merged 3 commits into
mainfrom
feat/smart-load-slots

Conversation

@dewet22

@dewet22 dewet22 commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bumps givenergy-modbus from 2.1.0b14 to 2.1.0b15
  • Exposes Smart Load slots 1–10 (HR 554–573) as writable time entities

Smart Load slots

Ten start/end time entities (smart_load_slot_1_startsmart_load_slot_10_end) created unconditionally for all non-EMS inverters. The slots are populated by load_config() and written via the new set_smart_load_slot_start/end helpers added in b15. Pattern mirrors charge/discharge slots — fixed registers, no slot_map needed.

b15 changelog (cumulative from b8, the previous pin)

Beta Change
b11 Battery detect: continue past absent/invalid LV slots (non-contiguous pack fix)
b12 Spurious alignment warning removed; MockPlant PDU debug logging
b13 WRITE_SAFE_REGISTERS expanded with app-confirmed registers (#48)
b14 HR(199) renamed enable_inverter_parallel_mode; deprecated alias in place — no hass code changes needed. smart_load_slot_1..10 decode added
b15 set_smart_load_slot_start/end/slot write helpers; register cross-correlation identify helpers (testing use)

Test plan

  • 182 tests pass (uv run pytest --tb=short -q)
  • mypy at 15-error baseline (no regression)
  • ruff clean
  • test_all_time_slot_entities_created updated to include all 20 smart load slot entities
  • test_smart_load_slot_1_start/end_initial_value — value from fixture
  • test_set_smart_load_slot_1_start_sends_command — write path exercised
  • test_set_smart_load_slot_5_end_sends_command — spot-check mid-range idx capture

🤖 Generated with Claude Code

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

coderabbitai Bot commented Jun 2, 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 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 @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: d0c46bc6-a390-4b34-8777-0615c4ea6ebc

📥 Commits

Reviewing files that changed from the base of the PR and between e0b9d16 and 2ef62c8.

⛔ 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/time.py
  • pyproject.toml
  • tests/conftest.py
  • tests/test_ems.py
  • tests/test_time.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/smart-load-slots

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 2, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in e0b9d16...2ef62c8 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 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.

@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 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.

Comment thread custom_components/givenergy_local/time.py Outdated
@dewet22-codex

Copy link
Copy Markdown
Collaborator

I’ve started reviewing this PR.

dewet22 added a commit that referenced this pull request Jun 2, 2026
…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>
Comment thread custom_components/givenergy_local/time.py Outdated
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>
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>
@dewet22 dewet22 merged commit b61971f into main Jun 2, 2026
10 checks passed
@dewet22 dewet22 deleted the feat/smart-load-slots branch June 2, 2026 18:20
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