From 3498625de7d21821aa195fc741c5e020d7bef891 Mon Sep 17 00:00:00 2001 From: Vincent Le Bourlot Date: Mon, 11 Jul 2022 12:02:53 +0200 Subject: [PATCH] Add display switch to fan devices. (#32) * Improve night_light feature discovery * add display switch to fans * revert night_light removal from humidifier * Improve switch detection * Update light.py * fix style --- custom_components/vesync/common.py | 1 + custom_components/vesync/switch.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/custom_components/vesync/common.py b/custom_components/vesync/common.py index be0e154..03ccb16 100644 --- a/custom_components/vesync/common.py +++ b/custom_components/vesync/common.py @@ -59,6 +59,7 @@ async def async_process_devices(hass, manager): else: if hasattr(fan, "config_dict"): devices[VS_NUMBERS].append(fan) + devices[VS_SWITCHES].append(fan) # for automatic stop and display devices[VS_FANS].append(fan) _LOGGER.info("%d VeSync fans found", len(manager.fans)) diff --git a/custom_components/vesync/switch.py b/custom_components/vesync/switch.py index 7980cb1..ceea339 100644 --- a/custom_components/vesync/switch.py +++ b/custom_components/vesync/switch.py @@ -52,6 +52,8 @@ def _setup_entities(devices, async_add_entities): VeSyncHumidifierAutoOnHA(dev), ) ) + elif getattr(dev, "turn_on_display", None): + entities.append(VeSyncHumidifierDisplayHA(dev)) else: _LOGGER.warning(