Bugfix: ctach Runtime errors (#3153)

"RuntimeError: Disable scan failed" has been seen in a live installation
This commit is contained in:
Open Home Automation 2016-09-04 01:47:11 +02:00 committed by Robbie Trencheny
parent 290ec9b4ac
commit db7f6a328f

View File

@ -58,10 +58,13 @@ def setup_scanner(hass, config, see):
def discover_ble_devices():
"""Discover Bluetooth LE devices."""
_LOGGER.debug("Discovering Bluetooth LE devices")
service = DiscoveryService()
devices = service.discover(duration)
_LOGGER.debug("Bluetooth LE devices discovered = %s", devices)
try:
service = DiscoveryService()
devices = service.discover(duration)
_LOGGER.debug("Bluetooth LE devices discovered = %s", devices)
except RuntimeError as error:
_LOGGER.error("Error during Bluetooth LE scan: %s", error)
devices = []
return devices
yaml_path = hass.config.path(YAML_DEVICES)