Skip to content

Commit

Permalink
Use is_fan, name check for SwitchLevel lights
Browse files Browse the repository at this point in the history
Restore name check for potential SwitchLevel lights. Also check whether
a potential light is a fan.

references #46
  • Loading branch information
jason0x43 committed May 19, 2020
1 parent 61873cf commit 22543f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/hubitat/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 22543f1

Please sign in to comment.