Stop treating a queued write as a failed one - #164
Open
mathieuletyrant wants to merge 1 commit into
Open
Conversation
The execution poller tested state 1 in an if of its own, then opened a fresh if/elif chain on state 2. So state 1 -- "waiting execution", the normal first answer to a write -- logged "waiting execution" and immediately fell into the else of the second chain, logged "Execution_state error" and broke out. completed stayed False, so the optimistic local write that follows the loop never ran and the entity kept its old value until the next scheduled poll, up to a minute later. Nothing had actually failed; the write went through. Turning that second if into an elif closes the chain. A queued execution now falls through to the retry sleep like an in-progress one: queued then ok waiting -> waiting -> in progress -> completed immediate ok completed real error waiting -> ERROR The giveaway in the logs was an "Execution_state waiting execution" followed straight away by "Execution_state error" on a write that had succeeded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mmnlfrrr
pushed a commit
to mmnlfrrr/cozytouch
that referenced
this pull request
Sep 10, 2026
A write whose execution comes back in state 1, queued, fell through the state handling: the first branch logged it, the next one tested for state 2 with a fresh if instead of an elif, so state 1 reached the else, was logged as an error and broke out of the polling loop. The write was then never confirmed and the new value never applied locally, even though the appliance went on to carry it out. State 1 is uncommon but real: it shows up once across the 47 executions of a field capture, which makes this an intermittent failure of every write path, including the mode select, the boost switch and the setpoints added here. Upstream PR gduteil#164 proposes the same one-line change, so either can be dropped when the other lands. Also refreshes the coordinator after writing a programmed setpoint, otherwise the entity keeps showing the old value until the next poll, matching what upstream PR gduteil#170 does for the other number entities. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ACWv1DVSmVzzfdVBRBarZF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-character fix: an
ifthat should be anelif.In
set_capability_value, the execution poller tests state 1 in anifof its own, then opens a freshif/elifchain on state 2:So state 1 — waiting execution, the normal first answer to a write — logs
waiting execution, falls into theelseof the second chain, logsExecution_state errorand breaks out.completedstaysFalse, so the optimisticcapability["value"] = valueafter the loop never runs, and the entity keeps its old value until the next scheduled poll, up to a minute later. Nothing had failed: the write went through.Closing the chain makes a queued execution fall through to the retry sleep, like an in-progress one:
The giveaway in the logs is an
Execution_state waiting executionfollowed immediately byExecution_state erroron a write that visibly succeeded.Running on my installation: entities now reflect a change as soon as the write completes, instead of waiting for the next poll.
Independent of #160, #161, #162 and #163.
🤖 Generated with Claude Code