Patrick Schurig 955016cc47 sunspec: fix a dangling capture in the device suite and widen it
The suite captured a stack local of initTestCase() by reference in two
lambdas that outlive it. Once the function returned they wrote into a
stack slot reused by later frames, corrupting the running test: a
QSignalSpy reported a phantom emission, reading its recorded arguments
segfaulted, and the count changed when unrelated locals were added. Both
observed failures came from that, not from the plugin. The two flags are
members now.

Covers the two remaining claims the offline suites cannot reach: a meter
slave ID of 0 opens no second connection against a real device, and
losing the meter connection leaves the parent connected and the inverter
data flowing, marking only the meter child disconnected.

That last test drives one explicit block read first. This bench replaces
the plugin timer with a null object, on purpose, so nothing would
otherwise ever mark a child connected and the cut would prove nothing.

Run against the bench simulator: 8 tests, 8 green. Each of the two
corrections was confirmed able to fail by reintroducing its pre-F3 form.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 09:51:10 +02:00
..

SunSpec

Connect nymea to SunSpec devices over Modbus TCP

Supported Things

  • SunSpec Inverter
    • Model ID 101 & 111 Single phase inverter
    • Model ID 102 & 112 Split phase inverter
    • Model ID 103 & 113 Three phase inverter
  • SunSpec Meter
    • Model ID 201 & 211 Single phase meter
    • Model ID 202 & 212 Split phase meter
    • Model ID 203 & 213 Three phase meter
  • SunSpec Storage
    • Model ID 124

Tested connections

  • SolarEdge (with custom battery)

Requirements

  • The package 'nymea-plugin-sunspec' must be installed.
  • The SunSpec device must support SunSpec over modbus TCP

More

https://sunspec.org