Skip to content

Report the blockers switched off when a later request fails - #159

Open
baylanger wants to merge 2 commits into
mezz64:masterfrom
baylanger:error-also-changed
Open

baylanger wants to merge 2 commits into
mezz64:masterfrom
baylanger:error-also-changed

Conversation

@baylanger

Copy link
Copy Markdown
Contributor

set_image_setting() and set_image_linked_setting() resolve conflicts by switching the blocking settings off, in a request of their own, before they retry the change. If the retry (or the read before it) then raised, for example a timeout or a rejected password, the caller only saw the error and never learned that the device had already changed. A consumer that shows those settings is then wrong until its next poll, and nobody is told that a setting was switched off.

ISAPIError now has an also_changed attribute ({path: new value}, like ImageWriteResult.also_changed). It is empty for every error except those raised by the conflict handling after a blocker was switched off. Existing code that catches the error is not affected. Documented in the README.

Tests: 5 new cases in test/test_image_write.py (a connection error and a 401 after the blockers were switched off, a linked setting, nothing to report when the first request fails, the default). The whole suite passes (283 tests).

Written with Claude Code (Claude Sonnet 5.5).

set_image_setting() and set_image_linked_setting() switch off the settings in
the way before they retry a write. If the retry, or the read before it,
raised, the caller only saw the error and never learned that the device had
already changed, and a consumer showing those settings was wrong until its
next poll.

The raised ISAPIError now has an also_changed attribute with the same
{path: value} content as ImageWriteResult.also_changed. It is empty for every
other error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@baylanger

Copy link
Copy Markdown
Contributor Author

This too is from comments left in HA PRs for improvement.

set_image_setting reads the current values again before switching a
blocker off. A document that could not be parsed there raised
ET.ParseError, which callers do not expect, and without also_changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqtSBY5RLaetEg5m4j4r6U
@baylanger
baylanger marked this pull request as ready for review November 22, 2026 16:53

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