forked from home-assistant/core
Added spcific exception type for failure to communicate with Vera controller
This commit is contained in:
@@ -83,8 +83,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
devices = []
|
devices = []
|
||||||
try:
|
try:
|
||||||
devices = controller.get_devices('Switch')
|
devices = controller.get_devices('Switch')
|
||||||
# pylint: disable=broad-except
|
except IOError as inst:
|
||||||
except Exception as inst:
|
# There was a network related error connecting to the vera controller
|
||||||
_LOGGER.error("Could not find Vera lights: %s", inst)
|
_LOGGER.error("Could not find Vera lights: %s", inst)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@@ -83,8 +83,8 @@ def get_devices(hass, config):
|
|||||||
devices = []
|
devices = []
|
||||||
try:
|
try:
|
||||||
devices = vera_controller.get_devices(categories)
|
devices = vera_controller.get_devices(categories)
|
||||||
# pylint: disable=broad-except
|
except IOError as inst:
|
||||||
except Exception as inst:
|
# There was a network related error connecting to the vera controller
|
||||||
_LOGGER.error("Could not find Vera sensors: %s", inst)
|
_LOGGER.error("Could not find Vera sensors: %s", inst)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@@ -82,8 +82,8 @@ def get_devices(hass, config):
|
|||||||
devices = []
|
devices = []
|
||||||
try:
|
try:
|
||||||
devices = vera_controller.get_devices(['Switch', 'Armable Sensor'])
|
devices = vera_controller.get_devices(['Switch', 'Armable Sensor'])
|
||||||
# pylint: disable=broad-except
|
except IOError as inst:
|
||||||
except Exception as inst:
|
# There was a network related error connecting to the vera controller
|
||||||
_LOGGER.error("Could not find Vera switches: %s", inst)
|
_LOGGER.error("Could not find Vera switches: %s", inst)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -175,7 +175,6 @@ class VeraSwitch(ToggleDevice):
|
|||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
""" True if device is on. """
|
""" True if device is on. """
|
||||||
self.update()
|
|
||||||
return self.is_on_status
|
return self.is_on_status
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
Reference in New Issue
Block a user