diff --git a/custom_components/vesync/__init__.py b/custom_components/vesync/__init__.py index 1c01f89..eb64116 100644 --- a/custom_components/vesync/__init__.py +++ b/custom_components/vesync/__init__.py @@ -84,15 +84,15 @@ 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 _, vs_p in PLATFORMS.items(): + for p, vs_p in PLATFORMS.items(): hass.data[DOMAIN][config_entry.entry_id][vs_p] = [] if device_dict[vs_p]: hass.data[DOMAIN][config_entry.entry_id][vs_p].extend(device_dict[vs_p]) + platforms_list.append(p) - await hass.config_entries.async_forward_entry_setups( - config_entry, list(PLATFORMS.keys()) - ) + await hass.config_entries.async_forward_entry_setups(config_entry, platforms_list) async def async_new_device_discovery(service: ServiceCall) -> None: """Discover if new devices should be added.""" diff --git a/custom_components/vesync/fan.py b/custom_components/vesync/fan.py index a9b7f06..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.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