Skip to content

fix(heishamon): reset the offset only after FTW wrote one (0.8.1) - #235

Merged
frahlg merged 1 commit into
mainfrom
233-heishamon-offset-reset
Nov 17, 2026
Merged

frahlg merged 1 commit into
mainfrom
233-heishamon-offset-reset

Conversation

@frahlg

@frahlg frahlg commented Nov 17, 2026

Copy link
Copy Markdown
Member

Closes #233.

Problem

driver_default_mode() and driver_cleanup() always published safe_offset (default 0) to set/Z1_Heat_Request_Temp. Core runs default mode at every start, on watchdog trips and on shutdown (go/internal/drivers/registry.go). An owner who sets the offset from Home Assistant had it put back to 0 each time, even on a site where FTW never commanded the pump. Reported by @Romaost on Discord, heishamon 0.8.0 on WH-SXC09H3E8.

Change

  • driver_command marks that FTW sent an offset, before it publishes. A failed publish may still have reached the broker, and a needless reset is the old, safe behaviour.
  • Default mode and cleanup reset to safe_offset only when the mark is set, then clear it. A failed reset keeps the mark, so the next default mode tries again.
  • No new setting. Core's observe_only would do the job of Roma's proposed control: false, but its config check requires battery_capacity_wh, so it does not fit a heat pump.
  • heishamon 0.8.0 → 0.8.1, with the catalog files regenerated by make bump-driver.

Known limit

After a Core crash the driver no longer knows FTW wrote, so that offset stays on the pump. Today only the operator's offset control on the heating card sends set_heat_curve_offset; no planner does. So the value that stays is one the owner chose. Planned heat control will need the device-side lease from ADR 0012.

Tests

  • New drivers/tests/lua_harness/test_heishamon_offset_reset.lua: no write at startup default mode or cleanup before a command; one reset to safe_offset after a command, then none; a rejected command arms nothing; a failed reset is retried.
  • The test fails on 0.8.0 (startup default mode overwrote an offset FTW never wrote) and passes on 0.8.1.
  • make test-driver ID=heishamon: 40 passed, 14 skipped.
  • make check: 5091 passed, 951 skipped.

The shared mock's host.mqtt_publish returns true, while FTW's host returns nothing on success and an error string on failure. heishamon reads any return value as an error, so the new test records publishes the way the host does. The mock itself is unchanged here.

Hardware

Not yet checked on hardware. @Romaost has offered to test on WH-SXC09H3E8: set an offset from HA, restart FTW, and the offset should stay.

Core picks this up when the pin in drivers/BUNDLED_SOURCE.json moves.

🤖 Generated with Claude Code

Default mode and cleanup always published safe_offset to
Z1_Heat_Request_Temp. Core runs default mode at every start and on
watchdog trips, so an owner who sets the offset from Home Assistant had
it put back to 0 each time, even when FTW never commanded the pump.

The driver now marks when FTW sends an offset and resets only then. A
failed reset keeps the mark for the next default mode. No new setting.

Closes #233

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-11-17T05:56:00.458206Z 8e4d56f 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.

@frahlg
frahlg merged commit 940a913 into main Nov 17, 2026
5 checks passed
@frahlg
frahlg deleted the 233-heishamon-offset-reset branch November 17, 2026 05:59
frahlg added a commit to srcfl/ftw that referenced this pull request Nov 17, 2026
…2036)

srcfl/device-drivers#235 makes default mode and cleanup reset
Z1_Heat_Request_Temp only after FTW wrote an offset. Core runs default
mode at every start and on watchdog trips, so an offset set from Home
Assistant went back to 0 each time (srcfl/device-drivers#233). The pin
moves 1e4b5de7 to 940a9136; heishamon is the only driver that changes.

The new test runs the driver through Core's own Lua host, whose
mqtt_publish returns nothing on success.

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

heishamon: reset the heat curve offset only after FTW wrote one

1 participant