From 22543f1cca2f420551169c2152327f940ff9eb8c Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Tue, 19 May 2020 08:20:38 -0400 Subject: [PATCH] Use is_fan, name check for SwitchLevel lights Restore name check for potential SwitchLevel lights. Also check whether a potential light is a fan. references #46 --- custom_components/hubitat/light.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_components/hubitat/light.py b/custom_components/hubitat/light.py index b35f526..4f33b1b 100644 --- a/custom_components/hubitat/light.py +++ b/custom_components/hubitat/light.py @@ -35,6 +35,7 @@ from .cover import is_cover from .device import HubitatEntity from .entities import create_and_add_entities +from .fan import is_fan from .types import EntityAdder _LOGGER = getLogger(__name__) @@ -166,7 +167,12 @@ def is_light(device: Device) -> bool: return True if CAP_SWITCH in device.capabilities and MATCH_LIGHT.match(device.name): return True - if CAP_SWITCH_LEVEL in device.capabilities and not is_cover(device): + if ( + CAP_SWITCH_LEVEL in device.capabilities + and MATCH_LIGHT.match(device.name) + and not is_cover(device) + and not is_fan(device) + ): return True return False