Skip to content

fix(solaredge_pv): no MPPT reading from a register that did not answer (1.2.4) - #302

Open
frahlg wants to merge 1 commit into
mainfrom
fix/solaredge-pv-no-zeros
Open

frahlg wants to merge 1 commit into
mainfrom
fix/solaredge-pv-no-zeros

Conversation

@frahlg

@frahlg frahlg commented Dec 4, 2026

Copy link
Copy Markdown
Member

Problem

MPPT current and voltage live in SolarEdge's own block past Model 103: scale factors at 40123, string 1 at 40140, string 2 at 40160. Many inverters do not have it. solaredge_pv 1.2.3 started each value at 0 and each scale factor at 0, so:

  • a model without the block reported mppt1_v = 0, mppt1_a = 0 and the same for string 2, on every poll, and the pv_mppt* metrics with them; that reads as two strings producing nothing;
  • a refused scale factor left a string's raw register value unscaled.

This breaks the repo's rule that a failed read is nil, never 0. After three misses those registers were also left alone until restart; #298 put only the serial on a five-minute retry.

Change

  • A value is sent only when its register and its scale factor both answered. Otherwise the field and its metric are left out.
  • Every register through probe_read that misses three times is asked again every five minutes, not only the serial. Core keeps a poll fresh when the device refuses one read and others answer, so on a model without the block this costs three refused reads in sixty polls.
  • A short reply counts as a miss, so a missing second register cannot raise mid-poll.
  • The Model 103 read, the serial handling from fix(solaredge_pv, solaredge_legacy): keep reading the serial after the inverter wakes (1.2.3, 0.3.4) #298, register addresses and scales are unchanged.

Test evidence

  • New test_solaredge_pv_mppt_absent.lua (run by test_solaredge_pv_mppt_absent.py): block refused for six polls; scale factors refused; string 2 refused; block refused three times then answering. 1.2.3 fails: no MPPT block 1: mppt1_v = 0 from a register that did not answer.
  • test_wakes_after_silence.lua (run by test_solaredge_pv_wakes.py), the shared harness from fix(saj): read the serial and battery again after the inverter wakes (1.3.1) #301: silent start, silent spell mid-session, each register refused six times. 1.2.3 fails: register 40123 was not asked again within five minutes.
  • test_solaredge_serial_retry.lua from fix(solaredge_pv, solaredge_legacy): keep reading the serial after the inverter wakes (1.2.3, 0.3.4) #298 still passes.
  • make test-driver ID=solaredge_pv: 47 passed, 10 skipped. make absent-register-report: every address settles except the Model 103 block, which emits nothing while it fails.
  • make check: 5576 passed, 927 skipped.

Not yet verified

  • No hardware run. Fields that used to read 0 on an inverter without the block now go missing; nobody has checked how the apps show an absent MPPT field.
  • solaredge_legacy and solaredge are separate drivers and not changed here.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

…r (1.2.4)

MPPT current and voltage live in SolarEdge's own block past Model 103
(scale factors at 40123, strings at 40140 and 40160), and many inverters
do not have it. 1.2.3 sent 0 V and 0 A for a string whose register, or
whose scale factor, did not answer, which reads as a string producing
nothing. After three misses those registers were also never asked again
until restart.

A value is now sent only when its register and its scale factor both
answered; otherwise the field and its metric are left out. Every
register that misses three times is asked again every five minutes, not
only the serial number, and a short reply counts as a miss.

Two harness tests cover it: test_solaredge_pv_mppt_absent.lua refuses
the block, its scale factors and one string, then lets the block answer
after it was given up; test_wakes_after_silence.lua checks every register
is asked again within five minutes. 1.2.3 fails both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T18:20:43.282548Z 44c255b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@miravoss26 miravoss26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solaredge_pv 1.2.4: an MPPT value is now sent only when both its register and its scale factor answered, and refused registers are retried every five minutes instead of being dropped until restart.

  • No blocking findings. scale() and the new metric() helper both handle nil, and complete() closes the short-reply case.
  • Security: no secrets, new dependencies, new network destinations or control-path changes in the driver diff.
  • Open, as the description says: no hardware run, and nobody has checked how the apps show a missing MPPT field.

Safe to merge from my read. I read the driver diff and CI is green; I did not run the tests myself.

This branch has not been deployed

No deployments
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.

2 participants