[Zwave] Add check for missing discovery_service

This commit is contained in:
Arthur Andersen 2015-11-07 15:57:28 +01:00
parent 0c97280479
commit 5b4fc4f346

View File

@ -31,6 +31,16 @@ DEVICE_MAPPINGS = {
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up Z-Wave sensors. """
# Return on empty `discovery_info`. Given you configure HA with:
#
# sensor:
# platform: zwave
#
# `setup_platform` will be called without `discovery_info`.
if discovery_info is None:
return
node = zwave.NETWORK.nodes[discovery_info[zwave.ATTR_NODE_ID]]
value = node.values[discovery_info[zwave.ATTR_VALUE_ID]]