Repository navigation
fix(pixii): detect active battery calibration via Modbus - #228
Conversation
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
ef41395 to
a5ded98
Compare
miravoss26
left a comment
There was a problem hiding this comment.
Pixii 2.1.10: reads StVnd (40108) and treats code 116 as calibration, so dispatch is suspended when SunSpec ChaSt is unsupported. Version, index, manifest and sha256 are bumped consistently, and the new test covers 116, 0xffff (keeps the last verdict) and 119 (clears).
- Needs a human decision: this adds
host.set_calibratingtospec/host-api-profile.json. Older Core falls back toset_device_fault, which is fine. But is the Core side that implementsset_calibratingmerged or planned? If not, the new API is spec-only for now. - Nit: the 101-129 range for
service_knownis from the Pixii mapping (table 23). A one-line link in the comment would help whoever extends it. - No secrets, no new hosts or dependencies.
Logic looks right to me. Safe to merge from my read once the Core question is answered.
|
Thanks, Mira. I haven’t confirmed whether |
miravoss26
left a comment
There was a problem hiding this comment.
Treats Pixii StVnd (40108) == 116 as battery calibration as well as ChaSt == 7, so dispatch still pauses when the SunSpec status reads 0xffff. Uses host.set_calibrating when the host has it and falls back to the device-fault gate on older cores.
Read the whole diff, found nothing blocking.
- Security: nothing. No new hosts, deps or secrets.
- Logic: the verdict only updates when
ChaStis recognised orStVndis in 101–129, and holds the last verdict otherwise. That matches the test (0xffff keeps calibrating, 119 clears it). - Low, host support:
set_calibratingis a new entry inhost-api-profile.json. The fallback covers older hosts, but it's worth confirming ftw-core actually implements it. Otherwise the "legacy fault" path stays the only live one. - Low, test gap: the fallback branch (
set_calibrating == nilwith service 116) andChaSt == 7through the new code path aren't covered by the new test. Both look right on read.
Safe to merge from my read.
|
|
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
00807c6 to
46c0aac
Compare
miravoss26
left a comment
There was a problem hiding this comment.
What it does: pixii now reads StVnd (reg 40108) and treats service 116 as battery calibration, so dispatch is suspended even when SunSpec ChaSt is unsupported. It reports through a new host.set_calibrating, falling back to set_device_fault on older Core.
- question:
host.set_calibratingis a new host API entry (added tospec/host-api-profile.json). Is it already implemented in Core, or does this ride on the fallback until it lands? Either way the driver behaves correctly, I just want to be sure nobody expects the new path yet. - note: a recognised StVnd value in 101-129 clears calibration even when ChaSt is unknown. That matches the stated intent (StVnd is the better signal), and the test covers 0xffff keeping the last verdict.
- security screen: no secrets, no new dependencies, no new network destinations. The only new URL is a doc link in the manifest.
Safe to merge from my read, pending the answer on set_calibrating. CI is green on 6b45928.
Signed-off-by: Segran <goran@andersson-stehag.se>
Signed-off-by: Segran <goran@andersson-stehag.se>
419e4e5 to
e852a90
Compare
|
@miravoss26, following up on your The test suite now covers both gaps you identified. |
Signed-off-by: Segran <goran@andersson-stehag.se>
miravoss26
left a comment
There was a problem hiding this comment.
Adds a second calibration signal for Pixii (StVnd 40108 == 116) alongside SunSpec ChaSt == 7, and uses host.set_calibrating when the host has it, falling back to the device-fault gate on older Core.
- Logic reads right: a recognized value from either register can set or clear the verdict, and if both reads are inconclusive the last verdict is kept. The two new tests cover that, including the legacy fallback.
- Minor:
service_known(101-129) is a hard-coded range from Table 23. If Pixii extends the table, an out-of-range code is treated as inconclusive, which fails safe (keeps the last verdict). - Security screen: no secrets, no new dependencies, no new network hosts. The only new URL is a Pixii PDF in the manifest.
- Open item from the description: the full scheduled-calibration run on the packaged 2.1.10 build is still pending hardware. I'd treat that as the merge gate.
Safe to merge from my read, once the 2.1.10 hardware run is confirmed.
Signed-off-by: Segran <goran@andersson-stehag.se>
The charge-ceiling branch now also carries the calibration changes from main, so size_bytes and sha256 are regenerated with sync_manifests and generate_index. Signed-off-by: Lödkolven <lodkolven@users.noreply.github.com>
* feat(pixii): report the Pixii's own charge ceiling (2.2.0) A Pixii can stop charging below 100 %. On one site its SoC held at 90 while Core kept planning and ordering charge to 95 %, and the Pixii app showed 100 % (#175). Pixii's Modbus mapping (U8022_06ENG rev 2.20) gives the SoC register as a percentage and names the upper limits on the same scale: SoCMax (40128), SoCRsvMax (40130) and the maximum SoC safety limit (39917, per mille, where "regulation will stop"). The driver reports the lowest valid one as max_soc_fract, the `@srcful/data-models` name for a battery's own maximum SoC. The SoC stays as read: the document does not say how the Pixii app maps it to 100 %. Every limit, the lower ones and the gross SoC go to history so a field check can show which one holds. Refs #175 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> * fix(pixii): take the ceiling only from SoC-scale limits, with a floor Review findings: - 39917 is a gross safety limit in tenths of a percent, and Pixii does not document how gross relates to the SoC at 40132. max_soc_fract now comes only from SoCMax (40128) and SoCRsvMax (40130), which share the SoC's scale factor. 39915-39917 stay in history. - A limit below 50 % is taken as a misread and left out. Real ceilings sit around 80-100 %, and Core applies the same bound. - read_sf treats 0x8000, SunSpec's unimplemented scale factor, as no scaling. Read as -32768 it scaled the SoC and every limit to zero. Refs #175 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> * chore(pixii): refresh 2.2.0 manifest hash after rebase onto #228 The charge-ceiling branch now also carries the calibration changes from main, so size_bytes and sha256 are regenerated with sync_manifests and generate_index. Signed-off-by: Lödkolven <lodkolven@users.noreply.github.com> --------- Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Signed-off-by: Lödkolven <lodkolven@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Lödkolven <lodkolven@users.noreply.github.com>
Moves the driver pin from srcfl/device-drivers b07a409b to 8aeecee3. Only tibber and pixii change: - tibber 1.1.3 (srcfl/device-drivers#282) declares ws_hosts = { "websocket-api.tibber.com" }, so a box set up from the UI opens the live stream (#1822). - pixii 2.1.10 (srcfl/device-drivers#228) reports calibration with host.set_calibrating (#2017). - pixii 2.2.0 (srcfl/device-drivers#281) reports max_soc_fract (#2083). Two Core tests ran the bundled Pixii and expected calibration as a device fault, as pixii 2.1.9 reported it. They now expect Calibrating set, control off, no fault and the driver still online, which is what 2.1.10 reports on a Core with host.set_calibrating. Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
On a Pixii undergoing scheduled SoC calibration, a read of SunSpec 802 register 40137 (
ChaSt) returned0xffffwhile Pixii register 40108 (StVnd) returned 116, the documented battery calibration service. FTW kept requesting idle and the battery continued charging under its local calibration.Recognize either calibration signal and keep battery and meter telemetry live. Use the Core calibration state when the host provides it. Older hosts continue to suspend control through the existing fault gate.
On the affected Pixii, the local driver derived from this change reported service 116 and stopped dispatching power commands once calibration was detected. The Pi journal shows no Pixii power setpoints between calibration detection at 01:24:41 and the status transition at 03:00:11 CET on 15 November 2026. The same FTW process resumed dispatch automatically and issued a 463 W Modbus charge setpoint at 03:00:12, then 0 W at 03:00:17. A later live read confirmed calibration was cleared and battery telemetry remained fresh.
Remaining hardware validation
The earlier run used a local driver derived from this change. A full scheduled calibration on the exact packaged Pixii 2.1.10 build remains pending. On 22 November, the field box was running 2.1.8, and 2.1.9 was the newest version available in its signed driver catalog. The final hardware run can take place once 2.1.10 is available for installation on that box.
During the run, capture
StVndandChaStto verify thatStVnd = 116is sufficient whenChaStis unavailable. Confirm that FTW suspends battery dispatch while telemetry stays fresh, then clears the calibration state and makes the battery eligible for dispatch when calibration finishes. The automated tests already cover bothhost.set_calibratingand the legacy fault gate.Companion Core change: srcfl/ftw#2017.