From ffa37d3f97888c6106ce0666555b324f7a50f01d Mon Sep 17 00:00:00 2001 From: Axel Larsson Date: Sat, 4 Jan 2025 12:45:48 -0500 Subject: [PATCH 1/3] Fix Fan TURN_ON and TURN_OFF features for HA 2025.1 Fix supported Fan features as needed for HA 2025.1. Adds FanEntityFeatures.TURN_ON and FanEntityFeatures.TURN_OFF --- custom_components/vesync/fan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/vesync/fan.py b/custom_components/vesync/fan.py index a9b7f06..73f14fa 100644 --- a/custom_components/vesync/fan.py +++ b/custom_components/vesync/fan.py @@ -88,9 +88,9 @@ def __init__(self, fan, coordinator) -> None: def supported_features(self): """Flag supported features.""" return ( - FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE + FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF | FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE if self.speed_count > 1 - else FanEntityFeature.SET_SPEED + else FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF | FanEntityFeature.SET_SPEED ) @property From 1953e8826216aed006e9d4a1284ebd876f831938 Mon Sep 17 00:00:00 2001 From: Greg Gibeling Date: Mon, 6 Jan 2025 15:25:03 -0800 Subject: [PATCH 2/3] Fix merge breakages & lint issues --- custom_components/vesync/__init__.py | 6 +++++- custom_components/vesync/fan.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/custom_components/vesync/__init__.py b/custom_components/vesync/__init__.py index 3032acc..6ae5129 100644 --- a/custom_components/vesync/__init__.py +++ b/custom_components/vesync/__init__.py @@ -84,6 +84,7 @@ async def async_update_data(): hass.data[DOMAIN][config_entry.entry_id]["coordinator"] = coordinator device_dict = await async_process_devices(hass, manager) + platforms_list: list = [] for p, vs_p in PLATFORMS.items(): hass.data[DOMAIN][config_entry.entry_id][vs_p] = [] @@ -117,7 +118,10 @@ async def _add_new_devices(platform: str) -> None: _add_new_devices(k) if platforms_to_setup: - await hass.config_entries.async_forward_entry_setups(config_entry, platforms_to_setup) + await hass.config_entries.async_forward_entry_setups( + config_entry, platforms_to_setup + ) + hass.services.async_register( DOMAIN, SERVICE_UPDATE_DEVS, async_new_device_discovery diff --git a/custom_components/vesync/fan.py b/custom_components/vesync/fan.py index 73f14fa..b54e05b 100644 --- a/custom_components/vesync/fan.py +++ b/custom_components/vesync/fan.py @@ -88,9 +88,14 @@ def __init__(self, fan, coordinator) -> None: def supported_features(self): """Flag supported features.""" return ( - FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF | FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE + FanEntityFeature.TURN_ON + | FanEntityFeature.TURN_OFF + | FanEntityFeature.SET_SPEED + | FanEntityFeature.PRESET_MODE if self.speed_count > 1 - else FanEntityFeature.TURN_ON | FanEntityFeature.TURN_OFF | FanEntityFeature.SET_SPEED + else FanEntityFeature.TURN_ON + | FanEntityFeature.TURN_OFF + | FanEntityFeature.SET_SPEED ) @property From 542883b8bf596f9add102c759aaa36254580a34a Mon Sep 17 00:00:00 2001 From: Greg Gibeling Date: Mon, 6 Jan 2025 15:26:11 -0800 Subject: [PATCH 3/3] Whitespace lint failure --- custom_components/vesync/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/custom_components/vesync/__init__.py b/custom_components/vesync/__init__.py index 6ae5129..eb64116 100644 --- a/custom_components/vesync/__init__.py +++ b/custom_components/vesync/__init__.py @@ -121,7 +121,6 @@ async def _add_new_devices(platform: str) -> None: await hass.config_entries.async_forward_entry_setups( config_entry, platforms_to_setup ) - hass.services.async_register( DOMAIN, SERVICE_UPDATE_DEVS, async_new_device_discovery