Skip to content

fix: keep Nuos optimistic cache in sync with target temperature getter - #180

Merged
astrinh0 merged 6 commits into
fustom:mainfrom
dpmworld:fix/nuos-setter-cache-desync
Nov 13, 2026
Merged

astrinh0 merged 6 commits into
fustom:mainfrom
dpmworld:fix/nuos-setter-cache-desync

Conversation

@dpmworld

@dpmworld dpmworld commented May 6, 2026

Copy link
Copy Markdown
Contributor

AristonNuosSplitDevice._set_water_heater_temperature (and its async counterpart) wrote the new comfort temperature into NuosSplitProperties.PROC_REQ_TEMP, but
water_heater_target_temperature reads from
NuosSplitProperties.COMFORT_TEMP. As a result, after a successful set_water_heater_temperature(...) call the property continued to return the old value until the next update_state() round-trip, producing a misleading stale read for any consumer (e.g. a Home Assistant entity displaying the setpoint).

The cloud /temperatures endpoint updates comfortTemp and reducedTemp on the server side, so mirroring those exact fields in the local cache is the correct optimistic update. procReqTemp is a distinct, device-driven field and should not be overwritten by the client.

`AristonNuosSplitDevice._set_water_heater_temperature` (and its async
counterpart) wrote the new comfort temperature into
`NuosSplitProperties.PROC_REQ_TEMP`, but
`water_heater_target_temperature` reads from
`NuosSplitProperties.COMFORT_TEMP`. As a result, after a successful
`set_water_heater_temperature(...)` call the property continued to
return the old value until the next `update_state()` round-trip,
producing a misleading stale read for any consumer (e.g. a Home
Assistant entity displaying the setpoint).

The cloud `/temperatures` endpoint updates `comfortTemp` and
`reducedTemp` on the server side, so mirroring those exact fields in
the local cache is the correct optimistic update. `procReqTemp` is a
distinct, device-driven field and should not be overwritten by the
client.
dpmworld added a commit to dpmworld/python-ariston-api that referenced this pull request May 6, 2026
`AristonNuosSplitDevice.set_water_heater_operation_mode` (and its
async counterpart) wrote the new operative mode into
`NuosSplitProperties.MODE` (the generic Velis `mode` field), but
`water_heater_mode_value` reads from `NuosSplitProperties.OP_MODE`
(the Nuos-specific `opMode` field).

The Nuos cloud payload exposes both fields with distinct semantics:
`mode` is the plant mode shared with other Velis devices, while
`opMode` is the Nuos operative mode (GREEN / COMFORT / FAST /
IMEMORY). The `set_nuos_mode` API call posts to `/operativeMode`, so
the server only updates `opMode`. Mirroring `mode` in the local cache
therefore had two unwanted effects:

* `water_heater_mode_value` continued to return the stale `opMode`
  value until the next `update_state()` round-trip.
* The unrelated `mode` field was clobbered with an `opMode` value,
  briefly corrupting any caller reading the plant mode from the cache
  before the next refresh.

This is the same class of bug that fustom#180 fixes for the temperature
setter; the operation mode setter just slipped through the same
review.

@astrinh0 astrinh0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add regression assertions that water_heater_target_temperature reflects the requested target immediately after both sync and async setters. The existing Nuos test only checks the API call and PROC_REQ_TEMP, so it cannot detect this stale-cache bug. No test files are changed in this PR.

dpmworld and others added 2 commits November 13, 2026 10:08
Assert water_heater_target_temperature reflects the requested value right after the sync and async setters, and that procReqTemp is not written. Update the existing test to read comfortTemp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dpmworld
dpmworld requested a review from astrinh0 November 13, 2026 11:00
@dpmworld

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Added the regression assertions in de852a0: water_heater_target_temperature and comfortTemp must reflect the requested value right after both the sync and async setters, and procReqTemp must not be written. I also fixed the existing Nuos test, which still read procReqTemp. I verified the new assertions fail with the old behavior and pass with the fix. CI is green. Ready for another look.

@astrinh0
astrinh0 merged commit 68b00db into fustom:main Nov 13, 2026
5 checks passed
@dpmworld
dpmworld deleted the fix/nuos-setter-cache-desync branch November 15, 2026 12:39
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.

2 participants