Improve logging and error handling

This commit is contained in:
Daniel Høyer Iversen 2018-12-02 15:35:59 +01:00
parent b7e2522083
commit 08dbd792cd
3 changed files with 10 additions and 10 deletions

View file

@ -35,15 +35,15 @@ async def async_setup_platform(hass, config, async_add_entities,
tibber_connection = hass.data.get(TIBBER_DOMAIN)
try:
dev = []
for home in tibber_connection.get_homes():
dev = []
for home in tibber_connection.get_homes():
try:
await home.update_info()
dev.append(TibberSensorElPrice(home))
if home.has_real_time_consumption:
dev.append(TibberSensorRT(home))
except (asyncio.TimeoutError, aiohttp.ClientError):
raise PlatformNotReady()
except (asyncio.TimeoutError, aiohttp.ClientError):
pass
dev.append(TibberSensorElPrice(home))
if home.has_real_time_consumption:
dev.append(TibberSensorRT(home))
async_add_entities(dev, True)