From 020dafec17df162ec6e8c76075d7b15df85a7860 Mon Sep 17 00:00:00 2001 From: Segran Date: Sun, 15 Nov 2026 01:36:33 +0100 Subject: [PATCH 1/3] Report Pixii calibration from running service Signed-off-by: Segran --- CHANGELOG.md | 6 ++++++ SUPPORT_STATUS.md | 4 ++-- devices.yaml | 2 +- drivers/lua/pixii.lua | 35 +++++++++++++++++++---------------- index.yaml | 6 +++--- manifests/pixii.yaml | 6 +++--- support-status.json | 2 +- 7 files changed, 35 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf58aa..3973599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +### pixii 2.1.10 + +Recognize battery calibration from Pixii's running-service register when +the SunSpec charge status is unsupported. Keep measurements live and +suspend FTW dispatch until calibration ends. + ### easee_cloud 1.4.1 The driver says its session energy is coarse, with `session_wh_coarse`. Easee diff --git a/SUPPORT_STATUS.md b/SUPPORT_STATUS.md index 1574553..3e70c88 100644 --- a/SUPPORT_STATUS.md +++ b/SUPPORT_STATUS.md @@ -114,8 +114,8 @@ Catalog source is not proof that a target can install or run a driver. | p1_hdlc | 2.0.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | p1_meter | 2.0.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | | p1_meter | 2.0.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | -| pixii | 2.1.9 | ftw-core | not_assessed | — | not_recorded | not_assessed | -| pixii | 2.1.9 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | +| pixii | 2.1.10 | ftw-core | not_assessed | — | not_recorded | not_assessed | +| pixii | 2.1.10 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | pixii_pv | 0.3.3 | ftw-core | not_assessed | — | not_recorded | not_assessed | | pixii_pv | 0.3.3 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | remne_p1ib | 0.1.0 | ftw-core | not_assessed | — | not_recorded | not_assessed | diff --git a/devices.yaml b/devices.yaml index 317220b..7c4d815 100644 --- a/devices.yaml +++ b/devices.yaml @@ -1045,7 +1045,7 @@ manufacturers: protocols: - protocol: modbus driver: "pixii" - version: "2.1.9" + version: "2.1.10" ders: [battery, meter] control: false firmware_versions: "" diff --git a/drivers/lua/pixii.lua b/drivers/lua/pixii.lua index d2e8f8d..0c45c96 100644 --- a/drivers/lua/pixii.lua +++ b/drivers/lua/pixii.lua @@ -29,7 +29,7 @@ DRIVER = { id = "pixii", name = "Pixii PowerShaper", manufacturer = "Pixii", - version = "2.1.9", + version = "2.1.10", protocols = { "modbus" }, capabilities = { "battery", "meter" }, description = "Pixii PowerShaper commercial battery storage via Modbus TCP.", @@ -61,6 +61,7 @@ local REG_SETPOINT_LO = 39906 -- int32 LSB -- SunSpec model 802 battery status points. Pixii's SoC is already read -- from this block at 40132, so these adjacent points are cheap diagnostics. local REG_BATTERY_SOC = 40132 +local REG_PIXII_RUNNING_SERVICE = 40108 -- StVnd: 116 is battery SoC calibration local REG_BATTERY_CHARGE_STATUS = 40137 -- ChaSt: OFF/EMPTY/DISCHARGING/... local REG_BATTERY_CONTROL_MODE = 40138 -- LocRemCtl: REMOTE/LOCAL local REG_BATTERY_STATE = 40143 -- State: CONNECTED/STANDBY/FAULT/... @@ -307,6 +308,9 @@ local last_charge_label = nil local function read_battery_status() local charge_status = read_status_u16(REG_BATTERY_CHARGE_STATUS) + local running_service = read_status_u16(REG_PIXII_RUNNING_SERVICE) + local calibrating = charge_status == 7 or running_service == 116 + if running_service ~= nil then host.emit_metric("pixii_running_service_code", running_service) end local control_mode = read_status_u16(REG_BATTERY_CONTROL_MODE) local battery_state = read_status_u16(REG_BATTERY_STATE) local vendor_state = read_status_u16(REG_BATTERY_STATE_VENDOR) @@ -320,36 +324,35 @@ local function read_battery_status() local charge_label = label_for(charge_status_labels, charge_status) local charge_status_known = charge_status ~= nil and charge_status_labels[charge_status] ~= nil - if not charge_status_known and charge_label ~= last_charge_label then + if not charge_status_known and running_service == nil and charge_label ~= last_charge_label then host.log("warn", "Pixii: charge status " .. charge_label - .. "; calibration state is unknown; retaining any previous calibration fault") + .. "; calibration state is unknown; retaining any previous calibration state") end last_charge_label = charge_label local control_label = label_for(control_mode_labels, control_mode) local state_label = label_for(battery_state_labels, battery_state) - local key = charge_label .. "/" .. control_label .. "/" .. state_label .. "/" .. tostring(vendor_state) .. "/" .. tostring(event1) + local key = charge_label .. "/" .. control_label .. "/" .. state_label .. "/" .. tostring(vendor_state) .. "/" .. tostring(event1) .. "/" .. tostring(running_service) if key ~= last_status_key then host.log("info", "Pixii: status charge=" .. charge_label .. " control=" .. control_label .. " state=" .. state_label .. " vendor_state=" .. tostring(vendor_state) .. " event1=" .. tostring(event1)) - if charge_status == 7 then - host.log("warn", "Pixii: charge status is TESTING; excluding from dispatch until calibration finishes") + if calibrating then + host.log("info", "Pixii: battery calibration detected; excluding from dispatch until calibration finishes") end last_status_key = key end - -- SunSpec 802 ChaSt=testing (7): Pixii is calibrating and ignores - -- external setpoints. Flag a device fault so dispatch + MPC exclude it - -- while keeping telemetry and site-meter data live. Only a recognized - -- status can clear it: absent, unsupported or unknown values do not - -- prove calibration has finished. Unknown status at startup is not - -- evidence of calibration either, so it does not invent a fault. - if charge_status_known then - local calibrating = charge_status == 7 - host.set_device_fault(calibrating, - calibrating and "Pixii battery calibrating/testing (SunSpec ChaSt=testing)" or "") + -- StVnd can report calibration when the SunSpec charge status is + -- unsupported. Keep the last verdict if both reads are unknown. + if charge_status_known or running_service ~= nil then + if host.set_calibrating then + host.set_calibrating(calibrating) + else + -- Older Core versions use the fault gate to suspend dispatch. + host.set_device_fault(calibrating, calibrating and "Pixii battery calibration is active" or "") + end end return { diff --git a/index.yaml b/index.yaml index 0f09d7f..5db6118 100644 --- a/index.yaml +++ b/index.yaml @@ -508,14 +508,14 @@ drivers: size_bytes: 19344 sha256: "29f2bd2f73c0d39d809839ca60b40c3e4281f1dda267ba2b26e66bd9ab80c27b" - name: "pixii" - version: "2.1.9" + version: "2.1.10" tier: core protocol: modbus connectivity: local ders: [battery, meter] control: false - size_bytes: 32519 - sha256: "77e233e2d24e970ebff8eaacd67967f57b651677d25ce7b57a1f97c3eaeb71fe" + size_bytes: 32738 + sha256: "5895d78bc2a0824f77daac980022d9847f42cb6b8d7e14f91d29fd699af1b292" - name: "pixii_pv" version: "0.3.3" tier: core diff --git a/manifests/pixii.yaml b/manifests/pixii.yaml index c8a2088..458547a 100644 --- a/manifests/pixii.yaml +++ b/manifests/pixii.yaml @@ -1,5 +1,5 @@ name: "pixii" -version: "2.1.9" +version: "2.1.10" tier: core author: "Sourceful Labs AB and community contributors" protocol: modbus @@ -24,9 +24,9 @@ upstream_docs: title: "SunSpec model 802: battery charge and control states" kind: register_map url_stability: stable -size_bytes: 32519 +size_bytes: 32738 dkb_id: "pixii" -sha256: "77e233e2d24e970ebff8eaacd67967f57b651677d25ce7b57a1f97c3eaeb71fe" +sha256: "5895d78bc2a0824f77daac980022d9847f42cb6b8d7e14f91d29fd699af1b292" signature: "" bytecode_sha256: "" diff --git a/support-status.json b/support-status.json index 65543b7..142fa3e 100644 --- a/support-status.json +++ b/support-status.json @@ -1157,7 +1157,7 @@ }, { "catalog_source": true, - "catalog_version": "2.1.9", + "catalog_version": "2.1.10", "driver_id": "pixii", "targets": { "blixt-l1": { From cdd08651a718daeb2466d99daa61f971b103b5d1 Mon Sep 17 00:00:00 2001 From: Segran Date: Sun, 15 Nov 2026 01:37:48 +0100 Subject: [PATCH 2/3] Preserve calibration across unsupported service reads Signed-off-by: Segran --- drivers/lua/pixii.lua | 8 +++++--- drivers/tests/test_pixii_status.py | 18 ++++++++++++++++++ index.yaml | 4 ++-- manifests/pixii.yaml | 4 ++-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/lua/pixii.lua b/drivers/lua/pixii.lua index 0c45c96..dc2e1ea 100644 --- a/drivers/lua/pixii.lua +++ b/drivers/lua/pixii.lua @@ -309,6 +309,8 @@ local last_charge_label = nil local function read_battery_status() local charge_status = read_status_u16(REG_BATTERY_CHARGE_STATUS) local running_service = read_status_u16(REG_PIXII_RUNNING_SERVICE) + -- StVnd service codes start at 101 (Pixii mapping, table 23). + local service_known = running_service ~= nil and running_service >= 101 and running_service <= 129 local calibrating = charge_status == 7 or running_service == 116 if running_service ~= nil then host.emit_metric("pixii_running_service_code", running_service) end local control_mode = read_status_u16(REG_BATTERY_CONTROL_MODE) @@ -324,7 +326,7 @@ local function read_battery_status() local charge_label = label_for(charge_status_labels, charge_status) local charge_status_known = charge_status ~= nil and charge_status_labels[charge_status] ~= nil - if not charge_status_known and running_service == nil and charge_label ~= last_charge_label then + if not charge_status_known and not service_known and charge_label ~= last_charge_label then host.log("warn", "Pixii: charge status " .. charge_label .. "; calibration state is unknown; retaining any previous calibration state") end @@ -346,12 +348,12 @@ local function read_battery_status() -- StVnd can report calibration when the SunSpec charge status is -- unsupported. Keep the last verdict if both reads are unknown. - if charge_status_known or running_service ~= nil then + if charge_status_known or service_known then if host.set_calibrating then host.set_calibrating(calibrating) else -- Older Core versions use the fault gate to suspend dispatch. - host.set_device_fault(calibrating, calibrating and "Pixii battery calibration is active" or "") + host.set_device_fault(calibrating, calibrating and "Pixii battery is calibrating" or "") end end diff --git a/drivers/tests/test_pixii_status.py b/drivers/tests/test_pixii_status.py index eeb2a2b..f101904 100644 --- a/drivers/tests/test_pixii_status.py +++ b/drivers/tests/test_pixii_status.py @@ -112,3 +112,21 @@ def test_pixii_control_readback_without_troubleshooting(): assert(battery.setpoint_w == nil, "failed read invented zero") assert(battery.control_power_w == nil and battery.control_power_available == false) ''') + + +def test_pixii_reports_service_calibration_without_legacy_fault() -> None: + run_lua(''' +local calibrating +host.set_calibrating = function(active) calibrating = active end +host._modbus_registers.holding[40108] = 116 +poll(0xffff) +assert(calibrating == true, "Pixii service 116 did not block dispatch") +assert(not host._faulted, "calibration was also reported as a device fault") +host._modbus_registers.holding[40108] = 0xffff +poll(0xffff) +assert(calibrating == true, "inconclusive reads cleared calibration") +host._modbus_registers.holding[40108] = 119 +poll(0xffff) +assert(calibrating == false, "normal Pixii service did not clear calibration") +assert(#host._emitted.meter == 3, "calibration stopped meter telemetry") +''') diff --git a/index.yaml b/index.yaml index 5db6118..bb1e855 100644 --- a/index.yaml +++ b/index.yaml @@ -514,8 +514,8 @@ drivers: connectivity: local ders: [battery, meter] control: false - size_bytes: 32738 - sha256: "5895d78bc2a0824f77daac980022d9847f42cb6b8d7e14f91d29fd699af1b292" + size_bytes: 32887 + sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" - name: "pixii_pv" version: "0.3.3" tier: core diff --git a/manifests/pixii.yaml b/manifests/pixii.yaml index 458547a..e5795df 100644 --- a/manifests/pixii.yaml +++ b/manifests/pixii.yaml @@ -24,9 +24,9 @@ upstream_docs: title: "SunSpec model 802: battery charge and control states" kind: register_map url_stability: stable -size_bytes: 32738 +size_bytes: 32887 dkb_id: "pixii" -sha256: "5895d78bc2a0824f77daac980022d9847f42cb6b8d7e14f91d29fd699af1b292" +sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" signature: "" bytecode_sha256: "" From a5ded98d3811207eb662e4701ea02e4ef69110cc Mon Sep 17 00:00:00 2001 From: Segran Date: Sun, 15 Nov 2026 01:38:36 +0100 Subject: [PATCH 3/3] Declare Core calibration hook in host API profile Signed-off-by: Segran --- spec/host-api-profile.json | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/host-api-profile.json b/spec/host-api-profile.json index 92d2e4a..45d06f9 100644 --- a/spec/host-api-profile.json +++ b/spec/host-api-profile.json @@ -27,6 +27,7 @@ "now_ms", "sleep", "set_device_fault", + "set_calibrating", "set_poll_interval", "millis", "set_watchdog_timeout_s",