mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Changed exception logging, and updated excluded device logic
This commit is contained in:
parent
7ee37648d8
commit
56622596e7
@ -78,17 +78,15 @@ 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')
|
||||||
except RequestException as inst:
|
except RequestException:
|
||||||
# There was a network related error connecting to the vera controller
|
# 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
|
return False
|
||||||
|
|
||||||
lights = []
|
lights = []
|
||||||
for device in devices:
|
for device in devices:
|
||||||
extra_data = device_data.get(device.deviceId, None)
|
extra_data = device_data.get(device.deviceId, {})
|
||||||
exclude = False
|
exclude = extra_data.get('exclude', False)
|
||||||
if extra_data:
|
|
||||||
exclude = extra_data.get('exclude', False)
|
|
||||||
|
|
||||||
if exclude is not True:
|
if exclude is not True:
|
||||||
lights.append(VeraSwitch(device, extra_data))
|
lights.append(VeraSwitch(device, extra_data))
|
||||||
|
@ -78,17 +78,15 @@ def get_devices(hass, config):
|
|||||||
devices = []
|
devices = []
|
||||||
try:
|
try:
|
||||||
devices = vera_controller.get_devices(categories)
|
devices = vera_controller.get_devices(categories)
|
||||||
except RequestException as inst:
|
except RequestException:
|
||||||
# There was a network related error connecting to the vera controller
|
# 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
|
return False
|
||||||
|
|
||||||
vera_sensors = []
|
vera_sensors = []
|
||||||
for device in devices:
|
for device in devices:
|
||||||
extra_data = device_data.get(device.deviceId, None)
|
extra_data = device_data.get(device.deviceId, {})
|
||||||
exclude = False
|
exclude = extra_data.get('exclude', False)
|
||||||
if extra_data:
|
|
||||||
exclude = extra_data.get('exclude', False)
|
|
||||||
|
|
||||||
if exclude is not True:
|
if exclude is not True:
|
||||||
vera_sensors.append(VeraSensor(device, extra_data))
|
vera_sensors.append(VeraSensor(device, extra_data))
|
||||||
|
@ -79,17 +79,15 @@ 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'])
|
||||||
except RequestException as inst:
|
except RequestException:
|
||||||
# There was a network related error connecting to the vera controller
|
# 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
|
return False
|
||||||
|
|
||||||
vera_switches = []
|
vera_switches = []
|
||||||
for device in devices:
|
for device in devices:
|
||||||
extra_data = device_data.get(device.deviceId, None)
|
extra_data = device_data.get(device.deviceId, {})
|
||||||
exclude = False
|
exclude = extra_data.get('exclude', False)
|
||||||
if extra_data:
|
|
||||||
exclude = extra_data.get('exclude', False)
|
|
||||||
|
|
||||||
if exclude is not True:
|
if exclude is not True:
|
||||||
vera_switches.append(VeraSwitch(device, extra_data))
|
vera_switches.append(VeraSwitch(device, extra_data))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user