From 38fbc3595a9e61afd8ef6a066f6ec697a38cf67d Mon Sep 17 00:00:00 2001 From: jamespcole Date: Mon, 9 Mar 2015 07:46:26 +1100 Subject: [PATCH] Added spcific exception type for failure to communicate with Vera controller --- homeassistant/components/light/vera.py | 4 ++-- homeassistant/components/sensor/vera.py | 4 ++-- homeassistant/components/switch/vera.py | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index e744252ced4..8f73b3400a7 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -83,8 +83,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): devices = [] try: devices = controller.get_devices('Switch') - # pylint: disable=broad-except - except Exception as inst: + except IOError as inst: + # There was a network related error connecting to the vera controller _LOGGER.error("Could not find Vera lights: %s", inst) return False diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index bd36ad16bff..8f9ede0182d 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -83,8 +83,8 @@ def get_devices(hass, config): devices = [] try: devices = vera_controller.get_devices(categories) - # pylint: disable=broad-except - except Exception as inst: + except IOError as inst: + # There was a network related error connecting to the vera controller _LOGGER.error("Could not find Vera sensors: %s", inst) return False diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 70865b84fa5..16613648580 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -82,8 +82,8 @@ def get_devices(hass, config): devices = [] try: devices = vera_controller.get_devices(['Switch', 'Armable Sensor']) - # pylint: disable=broad-except - except Exception as inst: + except IOError as inst: + # There was a network related error connecting to the vera controller _LOGGER.error("Could not find Vera switches: %s", inst) return False @@ -175,7 +175,6 @@ class VeraSwitch(ToggleDevice): @property def is_on(self): """ True if device is on. """ - self.update() return self.is_on_status def update(self):