From b1c9f8d55d23da29d0b9b491a46899163a0c6543 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 29 Dec 2018 23:55:43 +0100 Subject: [PATCH] Suppress traceback if network is not available --- homeassistant/components/discovery.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/discovery.py b/homeassistant/components/discovery.py index 17425309943..3974deda9a4 100644 --- a/homeassistant/components/discovery.py +++ b/homeassistant/components/discovery.py @@ -172,10 +172,13 @@ async def async_setup(hass, config): async def scan_devices(now): """Scan for devices.""" - results = await hass.async_add_job(_discover, netdisco) + try: + results = await hass.async_add_job(_discover, netdisco) - for result in results: - hass.async_create_task(new_service_found(*result)) + for result in results: + hass.async_create_task(new_service_found(*result)) + except OSError: + logger.error("Network is unreachable") async_track_point_in_utc_time( hass, scan_devices, dt_util.utcnow() + SCAN_INTERVAL)