mirror of
https://github.com/home-assistant/core.git
synced 2025-08-07 06:35:10 +02:00
add timeout error
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
"""Support for NWS weather service."""
|
"""Support for NWS weather service."""
|
||||||
|
import asyncio
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
@@ -149,7 +150,8 @@ async def async_setup_platform(hass, config, async_add_entities,
|
|||||||
try:
|
try:
|
||||||
with async_timeout.timeout(10, loop=hass.loop):
|
with async_timeout.timeout(10, loop=hass.loop):
|
||||||
stations = await nws.stations()
|
stations = await nws.stations()
|
||||||
except aiohttp.ClientError, JSONDecodeError as status:
|
except (aiohttp.ClientError, JSONDecodeError,
|
||||||
|
asyncio.CancelledError) as status:
|
||||||
_LOGGER.error("Error getting station list for %s: %s",
|
_LOGGER.error("Error getting station list for %s: %s",
|
||||||
nws.latlon, status)
|
nws.latlon, status)
|
||||||
raise PlatformNotReady
|
raise PlatformNotReady
|
||||||
|
Reference in New Issue
Block a user