Skip to content

fix(api): raise NetworkException when register write fails - #64

Open
tst-038 wants to merge 1 commit into
klejejs:mainfrom
tst-038:fix/raise-on-register-write-failure
Open

tst-038 wants to merge 1 commit into
klejejs:mainfrom
tst-038:fix/raise-on-register-write-failure

Conversation

@tst-038

@tst-038 tst-038 commented Oct 2, 2026

Copy link
Copy Markdown

Summary

Currently, __set_register_value logs an error on non-200 HTTP responses and network errors, but silently returns None.

In caller applications like Home Assistant (ha-thermia-heat-pump-integration#146), this causes the integration to assume register writes (e.g. setting target temperatures or toggling switches) succeeded, optimistically updating the UI state when the physical heat pump never accepted the command.

Changes

  • Catch requests.exceptions.RequestException during POST /Registers and raise NetworkException.
  • Raise NetworkException on non-200 response codes.
  • Added unit tests in ThermiaOnlineAPI/tests/test_set_register_value.py.

- Catch requests.exceptions.RequestException and raise NetworkException
- Raise NetworkException on non-200 HTTP response codes
- Add unit tests verifying exception raising on write failures
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