Skip to content

[driver] Pixii: driver goes offline when meter energy scale factor (40288) is absent #15

Closed

Description

@tommylindgren

Environment

Component Version / source
FTW core v1.10.5 (local dev build; /api/status reports version: dev)
Pixii driver in use 1.2.0 — bundled drivers/pixii.lua in the FTW repo
device-drivers catalog 1.1.0 (manifests/pixii.yaml; same 40288 read pattern, also affected once installed via repository)
Host behaviour Poll-scoped Modbus evidence (requiresFreshModbusRead) — fails poll on any failed host.modbus_read

Device make, model and firmware

Pixii PowerShaper, Modbus TCP. Two units on the same site:

Unit Firmware Register 40288
pixii-1 (affected) CPU1 v2.0.17, CPU2 v2.0.20 absent — Modbus exception 0x02
pixii-2 (working) CPU1 v2.0.23, CPU2 v2.0.23 present, value 0

The failing unit runs older firmware than the working one; 40288 may have been added or fixed in a later release.

Sanitized FTW driver diagnostics

driver: pixii-1
status: offline
last_error: driver_poll: 1 of 37 modbus reads failed
consecutive_errors: 151+
endpoint: modbus://<redacted>:502
observe_only: true

After workaround: status: ok, consecutive_errors: 0.

What happened?

On some Pixii PowerShaper firmware, holding register 40288 (meter_energy_sf, SunSpec model 213 offset 53) returns Modbus exception 0x02 (Illegal Data Address). The driver already wraps the read in pcall and defaults meter_energy_sf to 0, but FTW core (since poll-scoped Modbus evidence) counts every failed host.modbus_read during driver_poll, even when Lua catches the error. One failed read out of 37 fails the whole poll, so the driver stays offline and emits no telemetry.

Direct probe with FTW stopped (correct Modbus TCP framing):

  • pixii-1 (CPU1 v2.0.17 / CPU2 v2.0.20): 36/37 reads OK — 40288 fails with exception 0x02
  • pixii-2 (CPU1 v2.0.23 / CPU2 v2.0.23): 37/37 reads OK — 40288 present, value 0 (no scaling applied)

Defaulting to sf=0 on unit A matches unit B's behaviour for energy counters.

Steps to reproduce

  1. Configure a Pixii driver against a PowerShaper whose firmware omits register 40288.
  2. Run FTW with a recent core build that enforces fresh Modbus read evidence (requiresFreshModbusRead).
  3. Observe driver health: driver_poll: 1 of 37 modbus reads failed, driver offline.
  4. Probe register 40288 directly (FC 0x03) → Modbus exception 0x02.

Expected result

Driver stays online when an optional scale-factor register is absent; import/export Wh use sf=0 (same as units where 40288 exists but reads 0).

Proposed fix

Probe 40288 once in driver_init (outside poll evidence) and skip the read in driver_poll when absent. Verified locally in FTW's bundled drivers/pixii.lua; driver recovers to status: ok.

Notes

  • Affected file: drivers/lua/pixii.lua (current code uses pcall on 40288 every poll — insufficient with strict host evidence).
  • Core-side improvement (optional, separate repo): treat Modbus exception 0x02 on optional registers differently from transport failures.
  • Primary site metering was not from Pixii; missing 40288 does not affect dispatch-critical meter_w / phase readings.

Activity

  1. added a commit that references this issue on Aug 10, 2026
    af0a229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions