From 9c2625f0a5f703363680472c059998bd138f7d79 Mon Sep 17 00:00:00 2001 From: cgtobi Date: Tue, 16 Jul 2019 17:16:35 +0200 Subject: [PATCH] Raise not ready when no data from API is retrieved (#25182) --- homeassistant/components/opensensemap/air_quality.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/opensensemap/air_quality.py b/homeassistant/components/opensensemap/air_quality.py index 3f859724fc3..2aa587dc8ae 100644 --- a/homeassistant/components/opensensemap/air_quality.py +++ b/homeassistant/components/opensensemap/air_quality.py @@ -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