Changed exception logging, and updated excluded device logic

This commit is contained in:
jamespcole 2015-03-09 09:11:59 +11:00
parent 7ee37648d8
commit 56622596e7
3 changed files with 12 additions and 18 deletions

View File

@ -78,16 +78,14 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
devices = []
try:
devices = controller.get_devices('Switch')
except RequestException as inst:
except RequestException:
# There was a network related error connecting to the vera controller
_LOGGER.error("Could not find Vera lights: %s", inst)
_LOGGER.exception("Error communicating with Vera API")
return False
lights = []
for device in devices:
extra_data = device_data.get(device.deviceId, None)
exclude = False
if extra_data:
extra_data = device_data.get(device.deviceId, {})
exclude = extra_data.get('exclude', False)
if exclude is not True:

View File

@ -78,16 +78,14 @@ def get_devices(hass, config):
devices = []
try:
devices = vera_controller.get_devices(categories)
except RequestException as inst:
except RequestException:
# There was a network related error connecting to the vera controller
_LOGGER.error("Could not find Vera sensors: %s", inst)
_LOGGER.exception("Error communicating with Vera API")
return False
vera_sensors = []
for device in devices:
extra_data = device_data.get(device.deviceId, None)
exclude = False
if extra_data:
extra_data = device_data.get(device.deviceId, {})
exclude = extra_data.get('exclude', False)
if exclude is not True:

View File

@ -79,16 +79,14 @@ def get_devices(hass, config):
devices = []
try:
devices = vera_controller.get_devices(['Switch', 'Armable Sensor'])
except RequestException as inst:
except RequestException:
# There was a network related error connecting to the vera controller
_LOGGER.error("Could not find Vera switches: %s", inst)
_LOGGER.exception("Error communicating with Vera API")
return False
vera_switches = []
for device in devices:
extra_data = device_data.get(device.deviceId, None)
exclude = False
if extra_data:
extra_data = device_data.get(device.deviceId, {})
exclude = extra_data.get('exclude', False)
if exclude is not True: