From 9a740bff2a7317e28dbcaba4bb7e5be090f9bf97 Mon Sep 17 00:00:00 2001 From: Justyn Shull Date: Thu, 18 Feb 2016 18:12:00 -0600 Subject: [PATCH] Return early from setup_platform when zwave NETWORK is not configured --- homeassistant/components/light/zwave.py | 2 +- homeassistant/components/sensor/zwave.py | 2 +- homeassistant/components/switch/zwave.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index 62c970badc1..10d8cdef4d9 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -19,7 +19,7 @@ from homeassistant.components.zwave import ( def setup_platform(hass, config, add_devices, discovery_info=None): """ Find and add Z-Wave lights. """ - if discovery_info is None: + if discovery_info is None or NETWORK is None: return node = NETWORK.nodes[discovery_info[ATTR_NODE_ID]] diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index fc3e27b212f..ddca961f3a5 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -52,7 +52,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # platform: zwave # # `setup_platform` will be called without `discovery_info`. - if discovery_info is None: + if discovery_info is None or NETWORK is None: return node = NETWORK.nodes[discovery_info[ATTR_NODE_ID]] diff --git a/homeassistant/components/switch/zwave.py b/homeassistant/components/switch/zwave.py index 97254ed702f..150b8ba42be 100644 --- a/homeassistant/components/switch/zwave.py +++ b/homeassistant/components/switch/zwave.py @@ -15,7 +15,7 @@ from homeassistant.components.zwave import ( # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """ Find and return demo switches. """ - if discovery_info is None: + if discovery_info is None or NETWORK is None: return node = NETWORK.nodes[discovery_info[ATTR_NODE_ID]]