Raise not ready when no data from API is retrieved (#25182)
parent
4afc19ff3a
commit
9c2625f0a5
|
@ -7,6 +7,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.air_quality import (
|
from homeassistant.components.air_quality import (
|
||||||
PLATFORM_SCHEMA, AirQualityEntity)
|
PLATFORM_SCHEMA, AirQualityEntity)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
@ -40,7 +41,7 @@ async def async_setup_platform(
|
||||||
|
|
||||||
if 'name' not in osm_api.api.data:
|
if 'name' not in osm_api.api.data:
|
||||||
_LOGGER.error("Station %s is not available", station_id)
|
_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
|
station_name = osm_api.api.data['name'] if name is None else name
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue