From 67d30371aeeedaccac697a684c72b1271d36bfc6 Mon Sep 17 00:00:00 2001 From: Francesco Dipietromaria Date: Wed, 6 May 2026 10:40:55 +0000 Subject: [PATCH 1/2] fix: keep Nuos optimistic cache in sync with target temperature getter `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. --- ariston/nuos_split_device.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ariston/nuos_split_device.py b/ariston/nuos_split_device.py index bfc6fe7..fafd072 100644 --- a/ariston/nuos_split_device.py +++ b/ariston/nuos_split_device.py @@ -125,7 +125,12 @@ async def async_set_water_heater_boost(self, boost: bool): def _set_water_heater_temperature(self, temperature: float, reduced: float): """Set water heater temperature""" self.api.set_nuos_temperature(self.gw, temperature, reduced, self.water_heater_target_temperature, self.water_heater_reduced_temperature) - self.data[NuosSplitProperties.PROC_REQ_TEMP] = temperature + # Mirror what the cloud now stores. The /temperatures endpoint sets + # `comfortTemp` and `reducedTemp`; `procReqTemp` is a separate, + # device-driven field. Writing to it here did not match what the + # `water_heater_target_temperature` getter reads back, so the + # optimistic cache update was invisible until the next refresh. + self.data[NuosSplitProperties.COMFORT_TEMP] = temperature self.data[NuosSplitProperties.REDUCED_TEMP] = reduced def set_water_heater_temperature(self, temperature: float): @@ -142,7 +147,10 @@ async def _async_set_water_heater_temperature( ): """Async set water heater temperature""" await self.api.async_set_nuos_temperature(self.gw, temperature, reduced, self.water_heater_target_temperature, self.water_heater_reduced_temperature) - self.data[NuosSplitProperties.PROC_REQ_TEMP] = temperature + # See note in `_set_water_heater_temperature`: the cloud /temperatures + # endpoint updates `comfortTemp` and `reducedTemp`, so the optimistic + # cache must mirror those fields, not `procReqTemp`. + self.data[NuosSplitProperties.COMFORT_TEMP] = temperature self.data[NuosSplitProperties.REDUCED_TEMP] = reduced async def async_set_water_heater_temperature(self, temperature: float): From de852a0d7225ebeca8a5d85ed06eba174439b0a3 Mon Sep 17 00:00:00 2001 From: Francesco Dipietromaria Date: Fri, 13 Nov 2026 10:08:23 +0100 Subject: [PATCH 2/2] test: cover Nuos target temperature cache sync 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 --- tests/test_device_models.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_device_models.py b/tests/test_device_models.py index a36fd25..8871827 100644 --- a/tests/test_device_models.py +++ b/tests/test_device_models.py @@ -298,15 +298,21 @@ def test_nuos_split_properties_sync_async_and_missing_state_defaults(self): device.set_water_heater_boost(False) device.set_water_heater_temperature(60) + # The getter must reflect the requested target immediately, without + # waiting for the next cloud refresh (regression: setter used to write + # procReqTemp while the getter reads comfortTemp). + self.assertEqual(device.water_heater_target_temperature, 60) + self.assertEqual(device.data[NuosSplitProperties.COMFORT_TEMP], 60) + self.assertNotIn(NuosSplitProperties.PROC_REQ_TEMP, device.data) device.set_water_heater_reduced_temperature(42) device.set_water_heater_operation_mode("FAST") device.set_min_setpoint_temp(35) device.set_preheating(True) device.set_heating_rate(5) - self.assertEqual(device.data[NuosSplitProperties.PROC_REQ_TEMP], 43) + self.assertEqual(device.data[NuosSplitProperties.COMFORT_TEMP], 43) self.assertEqual(device.data[NuosSplitProperties.REDUCED_TEMP], 42) self.assertEqual(device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.FAST.value) - device.api.set_nuos_temperature.assert_called_with("gw-1", 43, 42, 55, 40) + device.api.set_nuos_temperature.assert_called_with("gw-1", 43, 42, 60, 40) device.api.set_velis_plant_setting.assert_called() device.api.async_set_nous_boost = AsyncMock() @@ -317,6 +323,9 @@ def test_nuos_split_properties_sync_async_and_missing_state_defaults(self): async def set_values(): await device.async_set_water_heater_boost(True) await device.async_set_water_heater_temperature(62) + self.assertEqual(device.water_heater_target_temperature, 62) + self.assertEqual(device.data[NuosSplitProperties.COMFORT_TEMP], 62) + self.assertNotIn(NuosSplitProperties.PROC_REQ_TEMP, device.data) await device.async_set_water_heater_reduced_temperature(39) await device.async_set_water_heater_operation_mode("GREEN") await device.async_set_min_setpoint_temp(36)