From 020dafec17df162ec6e8c76075d7b15df85a7860 Mon Sep 17 00:00:00 2001 From: Segran Date: Sun, 15 Nov 2026 01:36:33 +0100 Subject: [PATCH 1/6] 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 aaf58aa4..39735996 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 15745538..3e70c88f 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 317220bd..7c4d8150 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 d2e8f8d4..0c45c96a 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 0f09d7f3..5db6118e 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 c8a20883..458547ad 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 65543b7d..142fa3eb 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/6] 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 0c45c96a..dc2e1eaf 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 eeb2a2b3..f1019049 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 5db6118e..bb1e8552 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 458547ad..e5795dfc 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/6] 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 92d2e4af..45d06f99 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", From 7ead500457318aae7494e562cd5f382fd1f1241a Mon Sep 17 00:00:00 2001 From: Segran Date: Sat, 21 Nov 2026 15:15:07 +0100 Subject: [PATCH 4/6] Link Pixii Table 23 beside service status check Signed-off-by: Segran --- drivers/lua/pixii.lua | 3 ++- manifests/pixii.yaml | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/lua/pixii.lua b/drivers/lua/pixii.lua index dc2e1eaf..78e41998 100644 --- a/drivers/lua/pixii.lua +++ b/drivers/lua/pixii.lua @@ -309,7 +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). + -- Pixii PowerShaper Modbus Mapping, Table 23 (StVnd service types). + -- https://www.pixii.com/wp-content/uploads/2026/06/U8022_06ENG_2v20_Configuration_Guide_Pixii_Powershaper_Modbus_Mapping.pdf#page=41 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 diff --git a/manifests/pixii.yaml b/manifests/pixii.yaml index e5795dfc..91e1dc8c 100644 --- a/manifests/pixii.yaml +++ b/manifests/pixii.yaml @@ -16,6 +16,10 @@ tested_devices: min_driver_version: "1.1.0" min_host_version: "2.0.0" upstream_docs: + - url: "https://www.pixii.com/wp-content/uploads/2026/06/U8022_06ENG_2v20_Configuration_Guide_Pixii_Powershaper_Modbus_Mapping.pdf" + title: "Pixii PowerShaper Modbus Mapping, Table 23: StVnd service types" + kind: register_map + url_stability: stable - url: "https://sunspec.org/wp-content/uploads/2025/01/SunSpec-Device-Information-Model-Specificiation-V1-1-final-1.pdf" title: "SunSpec Device Information Model 1.1: unsupported enum16 and uint16 values" kind: manual @@ -24,9 +28,9 @@ upstream_docs: title: "SunSpec model 802: battery charge and control states" kind: register_map url_stability: stable -size_bytes: 32887 +size_bytes: 33031 dkb_id: "pixii" -sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" +sha256: "30cbb86aa19b8f9176e02cf5a751e11b73135ac78a7b7432b7bc587cc94f8e0d" signature: "" bytecode_sha256: "" From 46c0aac006c8a441ed2bdb4a25f3b8dae647d8ca Mon Sep 17 00:00:00 2001 From: Segran Date: Sat, 21 Nov 2026 15:15:24 +0100 Subject: [PATCH 5/6] Refresh Pixii source metadata in driver index Signed-off-by: Segran --- index.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.yaml b/index.yaml index 16084784..3d58887d 100644 --- a/index.yaml +++ b/index.yaml @@ -514,8 +514,8 @@ drivers: connectivity: local ders: [battery, meter] control: false - size_bytes: 32887 - sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" + size_bytes: 33031 + sha256: "30cbb86aa19b8f9176e02cf5a751e11b73135ac78a7b7432b7bc587cc94f8e0d" - name: "pixii_pv" version: "0.3.3" tier: core From bb5f404cee4c6299cec4c4fcc82fe6266a22d15d Mon Sep 17 00:00:00 2001 From: Segran Date: Sun, 22 Nov 2026 22:05:05 +0100 Subject: [PATCH 6/6] test(pixii): cover both calibration host APIs Signed-off-by: Segran --- drivers/tests/test_pixii_status.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/tests/test_pixii_status.py b/drivers/tests/test_pixii_status.py index f1019049..c752b911 100644 --- a/drivers/tests/test_pixii_status.py +++ b/drivers/tests/test_pixii_status.py @@ -114,13 +114,14 @@ def test_pixii_control_readback_without_troubleshooting(): ''') -def test_pixii_reports_service_calibration_without_legacy_fault() -> None: - run_lua(''' +@pytest.mark.parametrize(("charge_status", "service"), [(0xffff, 116), (7, 0xffff)]) +def test_pixii_reports_calibration_without_legacy_fault(charge_status: int, service: int) -> None: + run_lua(f''' 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") +host._modbus_registers.holding[40108] = {service} +poll({charge_status}) +assert(calibrating == true, "Pixii calibration did not block dispatch") assert(not host._faulted, "calibration was also reported as a device fault") host._modbus_registers.holding[40108] = 0xffff poll(0xffff) @@ -130,3 +131,18 @@ def test_pixii_reports_service_calibration_without_legacy_fault() -> None: assert(calibrating == false, "normal Pixii service did not clear calibration") assert(#host._emitted.meter == 3, "calibration stopped meter telemetry") ''') + + +def test_pixii_service_calibration_uses_legacy_fault() -> None: + run_lua(''' +host.set_calibrating = nil +host._modbus_registers.holding[40108] = 116 +poll(0xffff) +assert(host._faulted, "Pixii service 116 did not set the legacy device fault") +host._modbus_registers.holding[40108] = 0xffff +poll(0xffff) +assert(host._faulted, "inconclusive reads cleared the legacy device fault") +host._modbus_registers.holding[40108] = 119 +poll(0xffff) +assert(not host._faulted, "normal Pixii service did not clear the legacy device fault") +''')