Raise not ready when no data from API is retrieved (#25182)

pull/25190/head
cgtobi 2019-07-16 17:16:35 +02:00 committed by Fabian Affolter
parent 4afc19ff3a
commit 9c2625f0a5
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import voluptuous as vol
from homeassistant.components.air_quality import (
PLATFORM_SCHEMA, AirQualityEntity)
from homeassistant.const import CONF_NAME
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
@ -40,7 +41,7 @@ async def async_setup_platform(
if 'name' not in osm_api.api.data:
_LOGGER.error("Station %s is not available", station_id)
return
raise PlatformNotReady
station_name = osm_api.api.data['name'] if name is None else name