Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions SUPPORT_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion devices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
37 changes: 21 additions & 16 deletions drivers/lua/pixii.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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/...
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
18 changes: 18 additions & 0 deletions drivers/tests/test_pixii_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
''')
6 changes: 3 additions & 3 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions manifests/pixii.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: ""
Expand Down
1 change: 1 addition & 0 deletions spec/host-api-profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"now_ms",
"sleep",
"set_device_fault",
"set_calibrating",
"set_poll_interval",
"millis",
"set_watchdog_timeout_s",
Expand Down
2 changes: 1 addition & 1 deletion support-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@
},
{
"catalog_source": true,
"catalog_version": "2.1.9",
"catalog_version": "2.1.10",
"driver_id": "pixii",
"targets": {
"blixt-l1": {
Expand Down
Loading