From 184a54cc58393b1edd5065873684a2799b150b51 Mon Sep 17 00:00:00 2001 From: Greg Laabs Date: Wed, 21 Feb 2018 22:20:40 -0800 Subject: [PATCH] Fix fix isy994 fan detection (#12595) * Fixed 3 small issues in isy994 component 1. FanLincs have two nodes: one light and one fan motor. In order for each node to get detected as different Hass entity types, I removed the device-type check for FanLinc. The logic will now fall back on the uom checks which should work just fine. (An alternative approach here would be to special case FanLincs and handle them directly - but seeing as the newer 5.x ISY firmware already handles this much better using NodeDefs, I think this quick and dirty approach is fine for the older firmware.) Fixes #12030 2. Some non-dimming switches were appearing as `light`s in Hass due to an duplicate NodeDef being in the light domain filter. Removed! Fixes #12340 3. The `unqiue_id` property was throwing an error for certain entity types that don't have an `_id` property from the ISY. This issue has always been present, but was exposed by the entity registry which seems to be the first thing to actually try reading the `unique_id` property from the isy994 component. * Fix ISY994 fan detection ISY reports "med" in the uom, not "medium" * Add special-case for FanLincs so the light node is detected properly * Re-add insteon-type filter for fans, which dropped in a merge error --- homeassistant/components/isy994.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/isy994.py b/homeassistant/components/isy994.py index fbdf6e48143..48a9499d1a9 100644 --- a/homeassistant/components/isy994.py +++ b/homeassistant/components/isy994.py @@ -83,9 +83,9 @@ NODE_FILTERS = { }, 'fan': { 'uom': [], - 'states': ['off', 'low', 'medium', 'high'], + 'states': ['off', 'low', 'med', 'high'], 'node_def_id': ['FanLincMotor'], - 'insteon_type': [] + 'insteon_type': ['1.46.'] }, 'cover': { 'uom': ['97'], @@ -173,6 +173,14 @@ def _check_for_insteon_type(hass: HomeAssistant, node, for domain in domains: if any([device_type.startswith(t) for t in set(NODE_FILTERS[domain]['insteon_type'])]): + + # Hacky special-case just for FanLinc, which has a light module + # as one of its nodes. Note that this special-case is not necessary + # on ISY 5.x firmware as it uses the superior NodeDefs method + if domain == 'fan' and int(node.nid[-1]) == 1: + hass.data[ISY994_NODES]['light'].append(node) + return True + hass.data[ISY994_NODES][domain].append(node) return True