Skip to content

Implement V1 TOU cloud support (CID 103) and enforce CID 6798 V2 gate - #27

Merged
fboundy merged 1 commit into
mainfrom
patch
Jul 3, 2026
Merged

fboundy merged 1 commit into
mainfrom
patch

Conversation

@fboundy

@fboundy fboundy commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Combines issues #16 and #19 in one PR since both relate to TOU, per request.

#19 — SolisCloud V1 TOU (Time-Charging) via control CID 103:

  • New CloudCidMapping for CID 103 covering all 26 V1 TOU registers (43141/43142 global current + 3 slots × 8 time registers) as one composite 18-value string (ChargeCurrent, DischargeCurrent, ChargeStart, ChargeEnd, DischargeStart, DischargeEnd × 3 slots).
  • SolisCloud models charge/discharge current per slot; Modbus only has one global register for each. Decode takes slot 1's current as the representative Modbus value; encode broadcasts the single Modbus value to all 3 cloud slots — an unavoidable compromise, documented and flagged.
  • Writes to any subset of the 26 registers (single register for current, paired registers for a time field) route through the existing _execute_tou_time_write, reused as-is rather than duplicated — it already generically composes a partial write against the full cached/read state.
  • Not live-verified against a real inverter — the issue's own verification gate (CID 103 support on other product lines, partial-write behavior, whether the broadcast-current compromise is accepted) requires real hardware access I don't have in this session. Clearly flagged in docs/source/tou.md.

#16 — Enforce SolisCloud CID 6798 TOU V2 enablement gate:

  • CloudDataRetrieval reads CID 6798 once at first poll in cloud-only mode; if the device doesn't report support (43605), disables every sensor covering the V2 register range (43707-43791), matching the existing _disable_unmapped_sensors treatment.
  • A failed/undeterminable read never disables anything.

Test plan

  • tests/test_cloud_mapping.py: V1 TOU register span, worked-example decode (from the issue spec), current-broadcast encode, rejection cases
  • tests/test_cloud_writes.py: current-broadcast write, partial time-field write preserving other registers, compose-from-cid-read fallback, TestV2EnablementGate (disable/stay-enabled/never-guess)
  • Full suite: 322 passed
  • ruff check / ruff format --check clean

Closes #16, Closes #19

…#16, #19)

Adds a CloudCidMapping for control CID 103 covering all 26 V1 TOU
registers (global charge/discharge current + 3 slots of 8 time
registers each) as one composite 18-value string. Since SolisCloud
models current per-slot but Modbus only has one global register,
decode takes slot 1's values as representative and encode broadcasts
the single Modbus value to all 3 cloud slots. Writes to any subset of
these registers route through the existing _execute_tou_time_write
(reused, not duplicated), which already generically composes a
partial write against the full cached/read state.

Also reads SolisCloud CID 6798 once at first poll in cloud-only mode
and disables the TOU V2 entities if the device doesn't report support,
matching the existing _disable_unmapped_sensors treatment. A failed
read changes nothing.

The V1 TOU cloud path is implemented and unit-tested but not yet
live-verified against a real inverter, per the issue's own
verification gate - flagged in docs/source/tou.md.

Fixes #16, Fixes #19
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@fboundy
fboundy merged commit 979d950 into main Jul 3, 2026
6 checks passed
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.

Implement SolisCloud support for V1 TOU (Time-Charging) via control CID 103 Enforce SolisCloud CID 6798 TOU V2 enablement gate

1 participant