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
pull/12598/head
Greg Laabs 2018-02-21 22:20:40 -08:00 committed by Paulus Schoutsen
parent c6480e46c4
commit 184a54cc58
1 changed files with 10 additions and 2 deletions

View File

@ -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