Skip to content

foxess_h3_smart 0.12.2: discharge must not pin PV to a curtailed reading - #295

Draft
Leitet wants to merge 1 commit into
cursor/foxess-h3-smart-hold-ratchet-7b81from
cursor/foxess-h3-smart-pv-probe-7b81
Draft

Leitet wants to merge 1 commit into
cursor/foxess-h3-smart-hold-ratchet-7b81from
cursor/foxess-h3-smart-pv-probe-7b81

Conversation

@Leitet

@Leitet Leitet commented Dec 3, 2026

Copy link
Copy Markdown
Member

Summary

Stacked on #293. 0.12.1 only released remote control for target 0. On the 1K5-HI-10-V1, after that overlay restarted at 13:57, core was in self-consumption and asked for discharge, target −740 to −2889 W, never 0. foxess_hold_released stayed 0, remote control stayed on, SoC was 99%, and PV sat at 143–190 W and slid down while several kW of sun were available. The discharge formula is the same ratchet: AC = last_pv_w × 0.977 + |target|, and last_pv_w was already curtailed, so PV never got room.

Why a probe, not nameplate and not a window maximum

After a restart the only PV samples are the curtailed ones, so the highest reading in a window is still ~190 W. Using nameplate (10 kW) as the PV term would set AC to about 10000 × 0.977 + discharge and the battery would fill that hole until the array recovered. The probe gives a bounded step instead: the greater of 800 W and half the current reference, capped at nameplate. A curtailed or falling sample never lowers the reference. When PV rises into the offered room, the next poll steps again. When it stops rising, the reference stays one step above the sun, so the battery overshoot is one step, not the nameplate.

Behaviour while the pack cannot take surplus

Same latch as 0.12.1: SoC ≥ 98% until SoC ≤ 96%, or DC PV sitting on the last PV cap that was offered.

  • Hold (target 0) still releases to self-use, unless core set an explicit curtail cap.
  • Discharge ≤ house load (39225–39226) releases too. Self-use on a full pack covers the house and exports PV, which is the same result, and it takes the cap off the array. Unknown load is not treated as zero, so a missing read does not release an export command.
  • Discharge > house load (export / arbitrage) stays in remote control. setpoint = pv_ref × 0.977 + |target|. The first sample is trusted (a steady 3000 W is not treated as curtailed). A slide or a reading sitting on the offered PV cap steps pv_ref up and never back down.
  • Charge is refused for the whole latch, not only at 99%, so a charge command does not write a setpoint from curtailed PV.
  • An explicit curtail cap is still applied on top, unchanged. It can still hold AC at the number core asked for.

foxess_pv_ref_w is the PV term after the setpoint refresh.

Overlay (includes 0.12.0 and 0.12.1; this branch is based on #293):

https://raw.githubusercontent.com/srcfl/device-drivers/cursor/foxess-h3-smart-pv-probe-7b81/drivers/lua/foxess_h3_smart.lua

Driver evidence

  • Driver id: foxess_h3_smart
  • Device make/model: Fox ESS 1K5-HI-10-V1
  • Firmware tested: not recorded
  • Protocol/register source: the driver's existing remote-control model (46003/46004 is AC active power). House load is the already-read total at 39225–39226.
  • Hardware test performed: the discharge ratchet was observed live after the 0.12.1 restart (13:57). This fix has not been run on the inverter yet.
  • Known limits: the first sample after a restart is trusted once. The slide 190 → 150 W is what steps the probe. A discharge within house load releases immediately, including on that first sample. One probe step of battery overshoot is accepted when the reference is briefly above the sun.

Safety

  • A driver that can command its device has control on, or says in its description why it cannot.
  • Vendor signs are converted at the driver boundary.
  • Cached telemetry becomes stale instead of being re-emitted as fresh.
  • No credentials, serial numbers, private addresses or site data are included.

Control evidence

  • Hardware evidence, or not yet: the bug is from the live 1K5 after 13:57. The fix is not yet confirmed on that hardware. 0.12.1's hold tests and the existing charge/discharge harness still pass.
  • New cases in drivers/tests/test_foxess_h3_smart_discharge_pv.py: discharge −740 W with house load 2500 W releases; PV 190 → 150 W at targets −740 then −2889 (load 400 W) writes ac(990) + 2889 rather than ac(150) + 2889; a following 990 W steps further up and a later 150 W does not pull the term back down; an explicit 600 W curtail cap still wins; a steady 3000 W at SoC 99% still uses that reading for discharge −1000 W.

Checks

  • Commits include Signed-off-by.
  • make test-driver ID=foxess_h3_smart — 108 passed, 5 skipped, before the version bump; the same tests pass in make check.
  • make check — 5594 passed, 927 skipped.

What to check on the site

Sun up, SoC near 99%, PV currently ~150–190 W:

  1. If core's discharge is within house load (the −740 W end of today's range, if the house is using more than that): 46001 goes to 0 within a poll, foxess_hold_released is 1, and PV climbs toward the available sun instead of sliding down.
  2. If core's discharge is larger than house load (the −2889 W end): 46001 stays 1, foxess_pv_ref_w steps up from ~190 (by at least 800 W per poll while PV is still falling or sitting on the offer) and does not follow PV back down. 46003 is about foxess_pv_ref_w × 0.977 + |target|. PV should rise toward the reference over the next few polls, not stay at 150 W.
  3. SoC 97% after a 99% latch stays in this mode. SoC 96% or below with PV no longer on a cap goes back to using the fresh PV reading.
  4. A real curtail command still caps 46003 at the asked number.
  5. A charge command at SoC ≥ 98% is refused and does not write a new AC setpoint.
Open in Web Open in Cursor 

…eading

0.12.1 released remote control only for target 0. A discharge still
wrote AC = curtailed_pv * 0.977 + |target|, so PV stayed crushed.
0.12.2 releases when that discharge is within house load, and otherwise
uses an upward-only PV probe capped at nameplate.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Johan Leitet <johan@sourceful-labs.com>
@cursor
cursor Bot force-pushed the cursor/foxess-h3-smart-pv-probe-7b81 branch from 3c5de7d to ad6a7c7 Compare December 5, 2026 14:18

This branch has not been deployed

No deployments
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