From 3579bed49d502c63b7b9f8dff9e5f051e6fd17b1 Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Thu, 24 Sep 2026 00:22:22 +0200 Subject: [PATCH] Only hold commanded values for VRF sub-units #508 re-applies the commanded values over the read-back for up to 8 s, so a VRF gateway's stale cache does not revert the UI. It did that for every unit. A standalone unit is read directly, and when it corrects a value it cannot take (for example an unsupported swing mode), it reports its own value. The hold then kept the refused value on screen for up to 8 s, where before the UI showed the corrected value at once. The hold and the 2 s follow-up read now only apply when the device is a sub-unit (sub MAC differs from the gateway MAC). Standalone units behave as before #508. The same change went into the 5.0 port (#522). --- custom_components/gree/climate.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/custom_components/gree/climate.py b/custom_components/gree/climate.py index ed78602..5c31e43 100644 --- a/custom_components/gree/climate.py +++ b/custom_components/gree/climate.py @@ -647,12 +647,16 @@ async def SyncState(self, acOptions={}): # stale gateway read-back on the next poll(s) doesn't # revert the UI before the change propagates. Merge with # any still-unconfirmed options from earlier commands. - self._pending_options.update(acOptions) - self._pending_expiry = time.monotonic() + self._pending_ttl - # Schedule a quick follow-up read so the UI confirms the - # change within a couple of seconds instead of waiting - # for the next scan interval (up to 60s). - self._schedule_pending_refresh() + # Only VRF sub-units are held. A standalone unit that + # corrects a value it cannot take (e.g. an unsupported + # swing mode) should show the corrected value at once. + if self._sub_mac_addr != self._mac_addr: + self._pending_options.update(acOptions) + self._pending_expiry = time.monotonic() + self._pending_ttl + # Schedule a quick follow-up read so the UI confirms the + # change within a couple of seconds instead of waiting + # for the next scan interval (up to 60s). + self._schedule_pending_refresh() else: # loop used once for Gree Climate initialisation only self._firstTimeRun = False