Fix for moisture sensors in isy994 (#12734)

* Fix for moisture sensors - previously never triggered

* Change quotes to be consistent
This commit is contained in:
Jason Albert 2018-03-04 15:59:54 -06:00 committed by Greg Laabs
parent d418355d4d
commit 70760b5d3b

View File

@ -56,24 +56,17 @@ def setup_platform(hass, config: ConfigType,
else: else:
device_type = _detect_device_type(node) device_type = _detect_device_type(node)
subnode_id = int(node.nid[-1]) subnode_id = int(node.nid[-1])
if device_type == 'opening': if (device_type == 'opening' or device_type == 'moisture'):
# Door/window sensors use an optional "negative" node # These sensors use an optional "negative" subnode 2 to snag
if subnode_id == 4: # all state changes
if subnode_id == 2:
parent_device.add_negative_node(node)
elif subnode_id == 4:
# Subnode 4 is the heartbeat node, which we will represent # Subnode 4 is the heartbeat node, which we will represent
# as a separate binary_sensor # as a separate binary_sensor
device = ISYBinarySensorHeartbeat(node, parent_device) device = ISYBinarySensorHeartbeat(node, parent_device)
parent_device.add_heartbeat_device(device) parent_device.add_heartbeat_device(device)
devices.append(device) devices.append(device)
elif subnode_id == 2:
parent_device.add_negative_node(node)
elif device_type == 'moisture':
# Moisture nodes have a subnode 2, but we ignore it because
# it's just the inverse of the primary node.
if subnode_id == 4:
# Heartbeat node
device = ISYBinarySensorHeartbeat(node, parent_device)
parent_device.add_heartbeat_device(device)
devices.append(device)
else: else:
# We don't yet have any special logic for other sensor types, # We don't yet have any special logic for other sensor types,
# so add the nodes as individual devices # so add the nodes as individual devices