Skip to content

fix(atmoce): read the gateway again after a silent start (1.1.2) - #316

Open
frahlg wants to merge 1 commit into
mainfrom
fix/atmoce-wake
Open

frahlg wants to merge 1 commit into
mainfrom
fix/atmoce-wake

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

atmoce 1.1.1 read every register through probe_read, which leaves a register alone until restart after three misses. A gateway that was off, restarting or held by another Modbus client when FTW started used up every try while answering nothing. The driver then sent PV, battery and meter streams full of zeros until FTW restarted it.

A register that did not answer went out as zero (13 fields in the invented-number baseline). The ESS status defaulted to 99 (idle) when it did not answer, so the battery went out as 0 W even when the power register had answered.

Change

  • A miss counts only in a poll where another read answered, so a silent gateway uses up no tries and is read again on the first poll it answers. A register that misses three times on a gateway that does answer is asked again every five minutes instead of never.
  • PV goes out only when 60069 answered. The battery goes out only when 60071 (power) and 60067 (status, which gives the sign) both answered. The meter goes out only when 60073 answered.
  • Generation (60100), SoC (60095), phase V/A (60089), export (60178) and import (60184) are left out when their register did not answer.
  • Signs are unchanged: status 1 charges (+), 2 discharges (−), and any other status the gateway reports still gives 0 W. Grid power already matches site convention.
  • driver_command and driver_default_mode are unchanged; they write and never read.
  • driver_cleanup resets the guard and the poll state.
  • atmoce leaves invented-number-baseline.json.

Test evidence

  • drivers/tests/test_atmoce_wakes.py, 11 tests. 7 fail on 1.1.1 and pass on 1.1.2:

    • test_wakes_after_silence.lua (shared with the rest of the series): silent from start-up, silent mid-session, each register refused six times;
    • ten silent polls, then every field on the first poll that answers;
    • PV, battery or meter left out when its power (or the battery status) does not answer, four cases;
    • fields that do not answer left out.

    The other 4 pass on both and guard what must not change: the battery sign for status 1, 2 and 99, and the charge command's writes after a silent start.

  • make test-driver ID=atmoce: 59 passed, 6 skipped.

  • make absent-register-report ID=atmoce: every address prints SETTLED 1.

  • make invented-number-report ID=atmoce: none.

  • make check: 5585 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs an ATMOCE gateway that is off or held by another client when FTW starts.
  • The driver has no DRIVER table, as on main; this PR does not add one.
  • CHANGELOG.md, drivers/tests/lua_harness/test_wakes_after_silence.lua and invented-number-baseline.json are shared with the other PRs in this series; whichever merges later needs a rebase there.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

Every read went through a guard that left a register alone until restart
after three misses. A gateway that was off, restarting or held by another
Modbus client at start-up used up every try, and the driver then sent
zeros until FTW restarted it. A battery status that did not answer read
as idle, so the battery went out as 0 W.

A miss now counts only in a poll where another read answered, and a
register given up is asked again every five minutes. A field whose
register did not answer is left out. PV goes out only when 60069
answered, the battery only when 60071 and 60067 answered, the meter only
when 60073 answered. Control is unchanged.

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 5, 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-05T03:56:35.757597Z 660c7f9 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.

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.

1 participant