Skip to content

Hold VRF sub-unit UI state until gateway catches up; hide unsupported switches - #508

Open
meirlo wants to merge 1 commit into
RobHofmann:masterfrom
meirlo:feat/vrf-stale-read
Open

meirlo wants to merge 1 commit into
RobHofmann:masterfrom
meirlo:feat/vrf-stale-read

Conversation

@meirlo

@meirlo meirlo commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Problem

On multi-split (VRF) setups the gateway caches each indoor unit's state and answers with a stale snapshot for a few seconds after a command. That surfaces as two annoyances:

  1. Commands appear to "bounce back". After changing e.g. the target temperature, the next poll (up to 60 s away) can read the gateway's old cached value and revert the UI, so the change looks like it didn't take.
  2. Non-functional switches are shown. Many VRF indoor units return an empty string for properties they don't implement (Lig, Health, StHt, …), yet the switches are still exposed and do nothing.

Changes

climate.py — hold commanded state until the device confirms

  • After a successful send, remember the commanded options and re-assert them over the read-back until either the device's own reported value confirms the change, or an 8 s TTL expires.
  • Confirmation is checked against what the device actually reported this cycle (not our optimistic overlay), so a genuinely rejected command isn't forced forever.
  • A one-shot ~2 s delayed refresh lets the UI confirm quickly instead of waiting for the next scan interval. The handle is cancelled on entity removal.

switch.py — hide unsupported switches

  • Add _prop_supported(): a supported property comes back as an integer; empty string / None / missing after a successful sync means the unit doesn't implement it. xfan/lights/health/powersave/eightdegheat/sleep/air are hidden accordingly. State is left untouched until the first sync so nothing flickers on startup.

Scope / safety

Standalone (non-VRF) units are unaffected: they report real integers, so switches stay available and the pending overlay just confirms on the next read.

Related

Part of a small VRF series (see #507 for reliable VRF discovery, and #454 for per-unit device_info). Independent of both — can merge in any order.

Testing

Tested on my own setup:

  • Gateway: Gree GR-Gcloud VRF WiFi module fronting 4 indoor units (MACs in subMAC@gatewayMAC form).
  • Encryption: v1 (ECB).
  • Home Assistant: current stable release.

Verified on the 4 indoor units: changing target temperature / mode no longer bounces back to the gateway's stale cached value on the next poll, and the change is confirmed in the UI within a couple of seconds. Switches the units don't implement (e.g. lights/health) are correctly hidden after the first sync, while the switches they do support remain available and functional.

…rted switches

Two VRF (multi-split) usability issues, both caused by the gateway caching
each indoor unit's state and answering with a stale snapshot for a few
seconds after a command.

1. Commands appeared to "bounce back". After setting e.g. a new target
   temperature, the next poll (up to 60s away) could read the gateway's old
   cached value and revert the UI. climate.py now remembers the options it
   just commanded and re-asserts them over the read-back until the device's
   own reported value confirms the change or an 8s TTL expires. Confirmation
   is checked against the value the device actually reported this cycle, not
   the optimistic overlay, so a genuinely-rejected command is not forced
   forever. A one-shot delayed refresh (~2s) also lets the UI confirm the
   change quickly instead of waiting for the next scan interval. The pending
   refresh handle is cancelled on entity removal.

2. Non-functional switches were shown. Many VRF indoor units return an empty
   string for properties they do not implement (Lig, Health, StHt, ...). A
   real, supported property comes back as an integer. switch.py adds a
   _prop_supported() check so xfan/lights/health/powersave/eightdegheat/
   sleep/air are hidden when the unit reports the property as empty after a
   successful sync. State is left untouched until the first sync so nothing
   flickers on startup.

Standalone (non-VRF) units are unaffected: they report real integers, so the
switches stay available and the pending overlay simply confirms on the next
read.
@RobHofmann

Copy link
Copy Markdown
Owner

I need some testers with VRF devices for this one!

@RobHofmann RobHofmann added help wanted Extra attention is needed to test This issue needs testing labels Sep 20, 2026
@meirlo

meirlo commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Hi @vellad1, @Ilya-Draigor and @ItayGo — you all run VRF setups. @RobHofmann needs a VRF owner to validate this PR. Could any of you give it a quick test and report back? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed to test This issue needs testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants