mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Updated exception type for errors when connecting to vera
This commit is contained in:
parent
95852db18d
commit
7ee37648d8
@ -52,6 +52,7 @@ it should be set to "true" if you want this device excluded
|
||||
|
||||
"""
|
||||
import logging
|
||||
from requests.exceptions import RequestException
|
||||
from homeassistant.components.switch.vera import VeraSwitch
|
||||
# pylint: disable=no-name-in-module, import-error
|
||||
import homeassistant.external.vera.vera as veraApi
|
||||
@ -77,7 +78,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
devices = []
|
||||
try:
|
||||
devices = controller.get_devices('Switch')
|
||||
except IOError as inst:
|
||||
except RequestException as inst:
|
||||
# There was a network related error connecting to the vera controller
|
||||
_LOGGER.error("Could not find Vera lights: %s", inst)
|
||||
return False
|
||||
@ -93,4 +94,3 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
lights.append(VeraSwitch(device, extra_data))
|
||||
|
||||
add_devices_callback(lights)
|
||||
|
||||
|
@ -48,6 +48,7 @@ it should be set to "true" if you want this device excluded
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
from homeassistant.helpers import Device
|
||||
from homeassistant.const import (
|
||||
@ -77,7 +78,7 @@ def get_devices(hass, config):
|
||||
devices = []
|
||||
try:
|
||||
devices = vera_controller.get_devices(categories)
|
||||
except IOError as inst:
|
||||
except RequestException as inst:
|
||||
# There was a network related error connecting to the vera controller
|
||||
_LOGGER.error("Could not find Vera sensors: %s", inst)
|
||||
return False
|
||||
|
@ -50,6 +50,7 @@ it should be set to "true" if you want this device excluded
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
from homeassistant.helpers import ToggleDevice
|
||||
from homeassistant.const import (
|
||||
@ -78,7 +79,7 @@ def get_devices(hass, config):
|
||||
devices = []
|
||||
try:
|
||||
devices = vera_controller.get_devices(['Switch', 'Armable Sensor'])
|
||||
except IOError as inst:
|
||||
except RequestException as inst:
|
||||
# There was a network related error connecting to the vera controller
|
||||
_LOGGER.error("Could not find Vera switches: %s", inst)
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user