Added spcific exception type for failure to communicate with Vera controller

This commit is contained in:
jamespcole 2015-03-09 07:46:26 +11:00
parent 6dc18ba603
commit 38fbc3595a
3 changed files with 6 additions and 7 deletions

View File

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

View File

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

View File

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