Suppress traceback if network is not available

This commit is contained in:
Fabian Affolter 2018-12-29 23:55:43 +01:00
parent dc11e41cf0
commit b1c9f8d55d
No known key found for this signature in database
GPG Key ID: E23CD2DD36A4397F

View File

@ -172,10 +172,13 @@ async def async_setup(hass, config):
async def scan_devices(now): async def scan_devices(now):
"""Scan for devices.""" """Scan for devices."""
try:
results = await hass.async_add_job(_discover, netdisco) results = await hass.async_add_job(_discover, netdisco)
for result in results: for result in results:
hass.async_create_task(new_service_found(*result)) hass.async_create_task(new_service_found(*result))
except OSError:
logger.error("Network is unreachable")
async_track_point_in_utc_time( async_track_point_in_utc_time(
hass, scan_devices, dt_util.utcnow() + SCAN_INTERVAL) hass, scan_devices, dt_util.utcnow() + SCAN_INTERVAL)