Skip to content

feat(discovery): Solis Cloud configured through discovery; coordinator writes reported tuning, user wins - #6523

Merged
springfall2008 merged 10 commits into
mainfrom
feat/solis-discovery
Dec 4, 2026
Merged

springfall2008 merged 10 commits into
mainfrom
feat/solis-discovery

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

Fourth slice of discovery-driven inverter configuration, after GE Cloud (#6188), GivTCP (#6514) and Fox Cloud (#6517). Solis Cloud's automatic_config() no longer writes apps.yaml args itself: Solis opts in to the discovery coordinator, which configures from the record Solis already files.

Spec: docs/superpowers/specs/2026-12-04-solis-discovery-automatic-config-design.md. Plan: docs/superpowers/plans/2026-12-04-solis-discovery.md.

Coordinator: written tuning (bindings.py)

  • New WRITTEN_TUNING: inverter_limit_charge, inverter_limit_discharge, battery_export_permitted, soc_max_fallback. They stay out of BINDING_SETTINGS.
  • A tuning setting is decided only when some discovered record binds it; otherwise it is never read, written or cleared, as today.
  • The user wins per slot. A list in apps.yaml keeps the user's entry at every slot that has one; a single value is inverter 0's.
  • A discovered slot whose record binds it takes the record's entity where the user gives none; a manual slot keeps its live entry; a moved inverter takes its cap with it.
  • The contract's REPORTED_TUNING is now this constant.

Solis

  • automatic_config() opts in with allow_automatic_config(...): include_pv_only=True (every non-driven inverter's PV still counts, [Solis Cloud] A PV-only inverter is dropped from pv_today/pv_power as well as from battery control #4922), the PV/load settings skipped under solis_cloud_pv_load_ignore, and fallback_user_settings=SOLIS_FALLBACK_USER_SETTINGS, so a hand-set soc_max (as the Solis Cloud template tells users to set) survives.
  • No retry loop: an unread inverter files no entities, and its record fills in on a later cycle.
  • No coordinator: one Warn line, nothing configured. No battery inverter: one Warn, or one Info while details are unread.
  • The parallel-slave fold stays Solis's own control-path latch, and is now additive: a slave read after its master joins the fold instead of being driven alone.
  • A slave whose master's detail is unread is not driven until the master is read.
  • drives_battery() is sticky: one poll missing the SoH reading no longer releases the slot; only Solis Cloud reporting "no battery" does.
  • The old configuration survives as a pure _legacy_bindings(), and a passive checker compares it with what discovery wrote (caps compared only where apps.yaml gives the slot no value; battery_power_invert as a bool). A leftover Solis Modbus or hand-set SolisCloud slot beside the discovered inverters is warned about.

Behaviour changes for the release note

  • Solis Cloud configures through discovery; apps.yaml inverter entries are replaced from Solis's records, as with GE Cloud and Fox.
  • An inverter's PV joins the totals once its detail is read, rather than when the whole configuration first succeeds.
  • A Solis inverter configured by hand beside the discovered ones is kept, not overwritten, and a leftover Solis Modbus slot is warned about.
  • A single (non-list) inverter_limit_charge/_discharge or soc_max value in apps.yaml applies to inverter 0 only. On a two-inverter Solis site, the second inverter gets its record's cap and an estimated size instead. Single-inverter sites are unaffected.

Overlap with #6518

Both PRs add a "Fallback settings" bullet to docs/discovery-catalogue.md; whichever merges second has a one-line docs conflict.

Testing

  • Bindings: written tuning from the record, user wins (list and scalar), left alone when no record binds it, moves with its inverter, a user list survives a late inverter.
  • Solis: opt-in arguments, solis_cloud_pv_load_ignore, fallback-settings coverage, no-battery logging, no coordinator, opting in before the first report, fold latch timing, seven checker tests.
  • Acceptance through the real Coordinator (args equal _legacy_bindings() applied with today's rules, checker quiet): one battery, two, battery plus PV-only, parallel folded, PV/load ignore, user charge cap, details unread then read, leftover Modbus slot, no battery, slave read after master, slave waiting for its master, SoH missing from one poll.
  • Full suite passed locally (4 workers, 933s); ./run_pre_commit --checks-only clean.

🤖 Generated with Claude Code

CI and others added 9 commits December 4, 2026 14:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ves none

WRITTEN_TUNING (inverter_limit_charge, inverter_limit_discharge,
battery_export_permitted, soc_max_fallback) is decided only when some
discovered record binds it, with the kept-setting rule: the user's
apps.yaml value wins at its slot (a single value is inverter 0's), a
manual slot keeps its live entry, and it is never cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dings()

automatic_config() keeps its behaviour, applying the dict through
set_arg_auto (SOLIS_LEGACY_USER_WINS with overwrite=False) and then
latching the fold. The tests read _legacy_bindings() instead of
recording set_arg_auto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
automatic_config() opts in (solis_cloud_pv_load_ignore skips the four
load/PV settings, every inverter's PV counts, SOLIS_FALLBACK_USER_SETTINGS
keeps hand-set values such as soc_max) before the first report, and no
longer retries. latch_fold_when_ready() latches the parallel fold under
the previous conditions. No battery logs one Warn, or one Info while
details are unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…configuration

Mirrors Fox's: per-slot settings at the device's slot, summed settings by
content (an unread inverter is Info, a double count is Warn), caps only
where apps.yaml gives none, battery_power_invert as a bool, and a Warn
for a leftover Solis Modbus slot. Never raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A real SolisAPI on a real Coordinator matches _legacy_bindings() for one
and two batteries, a PV-only inverter, a folded parallel pair,
solis_cloud_pv_load_ignore and a user charge cap; the template's single
soc_max survives as inverter 0's; unread details, a leftover Modbus slot
and no battery log as designed. Black reformatting of earlier tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t for their master; caps survive a shorter pass

Final review findings:
- a parallel slave read after the latch joins the fold rather than taking
  a slot of its own and counting the shared battery twice;
- a slave read before its master is not driven alone meanwhile;
- one poll without batteryHealthSoh no longer releases a slot and
  reorders the inverters: drives_battery() is sticky, dropped only on a
  positive no-battery;
- a user cap list shortened by a pass with fewer slots is restored from
  apps.yaml for an inverter that joins late.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the BOT_REVIEW Trigger an autotriage label Dec 4, 2026

@springfall2008 springfall2008 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Automated comment from the triage bot.

Verdict: 🟡 Amber - Recommend addressing the feedback, then approval

The conversion is sound and the acceptance coverage through the real Coordinator is thorough, but three things need a small change inside this PR: the build_discovery() docstring now contradicts a side effect it gained, the 'only a no-battery report releases a battery inverter' half of the sticky predicate has no test, and the shipped Solis template still sets soc_max as a single value that now sizes only inverter 0.

Reviewed head 6b01679 (6b016796826a934098ce0037b907f5d87496cbda). 3 findings inline and 1 in the body.

apps/predbat/tests/test_solis.py:1679

test_solis_catalogue_filed_even_when_automatic_config_configures_nothing no longer proves its name. automatic_config() now writes no arg itself, so the api.set_arg_auto = lambda ...: configured.__setitem__ stub is never called and configured is always {}; the assertion "inverter_type" not in configured is vacuous. The comment at line 1704 ("It returns details_read (True here), so automatic_config_done DOES become True") still describes the old return value, which is now True because the component opted in. Drop the stub or assert on the coordinator's live base.args["inverter_type"] instead, and update the comment, so a regression that did configure an inverter here would be caught.

Comment thread apps/predbat/solis.py Resolved
Comment thread docs/components.md Resolved
@springfall2008 springfall2008 removed the BOT_REVIEW Trigger an autotriage label Dec 4, 2026
…n a "No Battery" report tested; soc_max template is a per-inverter list

- drives_battery() is now read-only: the detail poll records what it saw
  (note_battery_state()), so build_discovery() and the checker no longer change
  which inverters count as battery inverters. build_discovery()'s docstring
  describes the shared test it now uses.
- New acceptance test: an inverter Solis Cloud later reports battery-less loses
  its slot and stays released through polls carrying neither reading.
- test_solis_catalogue_filed_even_when_automatic_config_configures_nothing
  asserts on the report's records instead of a setter the component no longer calls.
- templates/solis_cloud.yaml: soc_max left unset for automatic size calculation,
  with the list form shown for setting it per inverter; the "ignored" comment
  now says settings Solis does not configure keep their apps.yaml value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@springfall2008

Copy link
Copy Markdown
Owner Author

Body finding (test_solis.py:1679): fixed in 8cacc67. test_solis_catalogue_filed_even_when_automatic_config_configures_nothing no longer stubs set_arg_auto. It asserts that no record in the filed report carries an inverter_type, which is what "configures nothing" means now that the coordinator configures from the report. The stale comment about automatic_config_done is gone. Mutation-checked: forcing build_discovery() to drive every inverter makes the test fail on its own.

@springfall2008
springfall2008 enabled auto-merge (squash) December 4, 2026 20:46
@springfall2008
springfall2008 merged commit 26bec12 into main Dec 4, 2026
8 checks passed
@springfall2008
springfall2008 deleted the feat/solis-discovery branch December 4, 2026 20:47
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