Skip to content

Add PV input sensors and create sensors at their first value - #23

Merged
davmoz merged 1 commit into
mainfrom
feat/pv-inputs-and-reported-sensors
Nov 4, 2026
Merged

davmoz merged 1 commit into
mainfrom
feat/pv-inputs-and-reported-sensors

Conversation

@davmoz

@davmoz davmoz commented Nov 4, 2026

Copy link
Copy Markdown
Member

Release 1.1.2. A community user with an SMA inverter and no SMA Energy Meter saw 15 of 17 sensors unavailable on firmware 7.0.3.

Cause

/ders lists what a device is configured with, and on firmware 7 that includes DERs it never reads. This inverter lists solar, meter and inverter but /data/json only has solar. The integration created sensors from /ders, so the rest could never get a value. The mppt array it does send had no sensors at all.

Changes

  • PV input sensors: MPPT 1 and 2 Voltage, Current and Power, positive while generating.
  • Sensors are created at their first value, from a coordinator listener, so a firmware update that starts sending more needs no reload. A sensor that has had a value stays and shows unavailable when the value stops. This replaces _REQUIRES_INITIAL_VALUE, which only covered three sensors and only at setup.
  • L1-L3 from the inverter when the device has no grid meter, positive while supplying like Inverter Power. A grid meter on the same device keeps these sensors. Firmware does not send this for SMA yet; Solis and the other profiles with an inverter block get it today.
  • Release 1.1.2, which also ships the docs merged in Update docs for 1.1.1 #22, so HACS shows the corrected README and minimum version.

Existing installs

Sensors that never had a value stay in Home Assistant as "no longer provided" until the user deletes them. I did not remove them automatically, since that would also hit a sensor whose device is only temporarily not reporting.

Testing

  • pytest: 138 passed. black, isort, mypy clean, pylint 10/10. Two old tests pinned the old behaviour and were rewritten.
  • New fixture fw7_sma_data.json is a captured 7.0.3 payload with the serial replaced.
  • Real Home Assistant 2026.10.1 in a throwaway container, against a fake Zap replaying captured 7.0.3 responses:
    • 1.1.1 reproduces the report: 17 SMA sensors, 15 unavailable.
    • Upgrade: entity IDs unchanged, MPPT sensors added, the dead sensors marked restored, P1 unchanged with none unavailable.
    • Inverter block added while running: inverter power, temperature, frequency and L1-L3 get values under their existing entity IDs, with no restart.
    • Fresh install: 8 SMA sensors with clean names and IDs, none unavailable.

Not tested against a real SMA inverter end to end; the payloads are real, the HTTP server replaying them is not.

🤖 Generated with Claude Code

Firmware 7 sends a mppt array that had no sensors, and /ders lists DERs a
device never reads. An SMA inverter with no Energy Meter lists a meter and
an inverter stage but only sends solar, so 15 of its 17 sensors stayed
unavailable forever.

A device sensor is now created when its first value arrives, from a
coordinator listener, so nothing needs a reload when a firmware update
starts sending more. A sensor that has had a value stays and shows
unavailable when the value stops.

The L1-L3 sensors now also take an inverter's phases when the device has no
grid meter, positive while supplying like Inverter Power.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davmoz
davmoz merged commit 0a7700f into main Nov 4, 2026
3 checks passed
@davmoz
davmoz deleted the feat/pv-inputs-and-reported-sensors branch November 4, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant