diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index e3173c8c88d..46fd3b54bb4 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -78,17 +78,15 @@ 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: - exclude = extra_data.get('exclude', False) + extra_data = device_data.get(device.deviceId, {}) + exclude = extra_data.get('exclude', False) if exclude is not True: lights.append(VeraSwitch(device, extra_data)) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 0f4170fa806..71531253207 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -78,17 +78,15 @@ 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: - exclude = extra_data.get('exclude', False) + extra_data = device_data.get(device.deviceId, {}) + exclude = extra_data.get('exclude', False) if exclude is not True: vera_sensors.append(VeraSensor(device, extra_data)) diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 828212d70d2..800913e6850 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -79,17 +79,15 @@ 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: - exclude = extra_data.get('exclude', False) + extra_data = device_data.get(device.deviceId, {}) + exclude = extra_data.get('exclude', False) if exclude is not True: vera_switches.append(VeraSwitch(device, extra_data))