Repository navigation
Conversation
`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.
| # `opMode`. The `water_heater_mode_value` getter also reads `opMode`, | ||
| # so the optimistic cache update has to mirror that field, not the | ||
| # generic `mode`. | ||
| self.data[NuosSplitProperties.OP_MODE] = NuosSplitOperativeMode[ |
There was a problem hiding this comment.
Please update test_nuos_split_properties_sync_async_and_missing_state_defaults with this cache-key correction. Its fixture has no MODE entry, but the sync and async assertions still read device.data[NuosSplitProperties.MODE]; this change writes OP_MODE, so the existing test raises KeyError and does not verify the getter-backed field. Assert OP_MODE/water_heater_mode_value for both paths.
Assert water_heater_mode_value reflects the requested mode right after the sync and async setters, and that the generic mode key is not written. Update the existing test to read opMode instead of mode. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mode-cache-desync
The GREEN_PLUS test merged from main still read the generic `mode` key. The setter now writes `opMode`, which is what water_heater_mode_value reads. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the review. Updated test_nuos_split_properties_sync_async_and_missing_state_defaults in caa739f: it now asserts OP_MODE and water_heater_mode_value for both the sync and async paths, and that the generic mode key is not written. I also merged the current main and fixed test_nuos_split_green_plus_mode_is_exposed_and_settable in 19d7273, which still read mode. I verified the assertions fail with the old behavior and pass with the fix. CI is green. Ready for another look. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Sry, should be fixed now. |
|
Superseded: upstream main already contains the OP_MODE cache fix, with GREEN via R2. Closing. |
AristonNuosSplitDevice.set_water_heater_operation_mode(and its async counterpart) wrote the new operative mode intoNuosSplitProperties.MODE(the generic Velismodefield), butwater_heater_mode_valuereads fromNuosSplitProperties.OP_MODE(the Nuos-specificopModefield).The Nuos cloud payload exposes both fields with distinct semantics:
modeis the plant mode shared with other Velis devices, whileopModeis the Nuos operative mode (GREEN / COMFORT / FAST / IMEMORY). Theset_nuos_modeAPI call posts to/operativeMode, so the server only updatesopMode. Mirroringmodein the local cache therefore had two unwanted effects:water_heater_mode_valuecontinued to return the staleopModevalue until the nextupdate_state()round-trip.modefield was clobbered with anopModevalue, briefly corrupting any caller reading the plant mode from the cache before the next refresh.This is the same class of bug that #180 fixes for the temperature setter; the operation mode setter just slipped through the same review.