From 157f980b8060b1d3a8f2e75e977ce303e836b106 Mon Sep 17 00:00:00 2001 From: Rob Hofmann Date: Wed, 23 Sep 2026 22:50:52 +0200 Subject: [PATCH] Keep switches available when "Disable Available Check" is on Since #508, the xfan, lights, health, powersave, 8 degC heat, sleep and air switches took their availability from `_device_online`. With "Disable Available Check" on, the climate entity never sets that field, so it stays None and the seven switches were unavailable for good. The climate entity itself stayed available, because its `available` checks the option first. `_prop_supported()` now uses the climate entity's `available`, so the switches follow the same rule as the climate entity. --- custom_components/gree/switch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/gree/switch.py b/custom_components/gree/switch.py index 4b87cad..e58dad3 100644 --- a/custom_components/gree/switch.py +++ b/custom_components/gree/switch.py @@ -36,7 +36,8 @@ def _prop_supported(device, prop: str) -> bool: missing as "not supported" so we don't expose non-functional switches. While the device is offline / not yet synced we can't tell, so mirror the - device's online state (as the base entity does) instead of hiding. + climate entity's availability instead of hiding. That also honours + "Disable Available Check", which leaves ``_device_online`` unset. """ value = device._acOptions.get(prop, "") if value in ("", None): @@ -44,9 +45,9 @@ def _prop_supported(device, prop: str) -> bool: # have synced at least once and the value is still empty, the unit # genuinely doesn't support this property. if getattr(device, "_firstTimeRun", False): - return getattr(device, "_device_online", True) + return bool(device.available) return False - return getattr(device, "_device_online", True) if hasattr(device, "_device_online") else True + return bool(device.available) @dataclass