diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4d1e9..c96c2ed 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. + ### heishamon 0.8.1 Default mode and cleanup reset `Z1_Heat_Request_Temp` to `safe_offset` only diff --git a/SUPPORT_STATUS.md b/SUPPORT_STATUS.md index 5c50b7c..78cb266 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 f758c58..d9f3bd2 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..dc2e1ea 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,11 @@ 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) local battery_state = read_status_u16(REG_BATTERY_STATE) local vendor_state = read_status_u16(REG_BATTERY_STATE_VENDOR) @@ -320,36 +326,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 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 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 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 is calibrating" or "") + end end return { 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 0fe786c..1608478 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: 32887 + sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" - name: "pixii_pv" version: "0.3.3" tier: core diff --git a/manifests/pixii.yaml b/manifests/pixii.yaml index c8a2088..e5795df 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: 32887 dkb_id: "pixii" -sha256: "77e233e2d24e970ebff8eaacd67967f57b651677d25ce7b57a1f97c3eaeb71fe" +sha256: "368e69898b87265bad6127673a66c9a595b13428a976c2c078ace2cf5ea73c77" signature: "" bytecode_sha256: "" 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", diff --git a/support-status.json b/support-status.json index c6ee121..291cb06 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": {