diff --git a/homeassistant/components/smhi/config_flow.py b/homeassistant/components/smhi/config_flow.py index 3b60cb66165015..2c04896497a1fc 100644 --- a/homeassistant/components/smhi/config_flow.py +++ b/homeassistant/components/smhi/config_flow.py @@ -1,4 +1,5 @@ """Config flow to configure SMHI component.""" +from smhi.smhi_lib import Smhi, SmhiForecastException import voluptuous as vol from homeassistant import config_entries @@ -96,7 +97,6 @@ async def _show_config_form( async def _check_location(self, longitude: str, latitude: str) -> bool: """Return true if location is ok.""" - from smhi.smhi_lib import Smhi, SmhiForecastException try: session = aiohttp_client.async_get_clientsession(self.hass) diff --git a/homeassistant/components/smhi/weather.py b/homeassistant/components/smhi/weather.py index 5f6722b72a6df3..574b8d8576725c 100644 --- a/homeassistant/components/smhi/weather.py +++ b/homeassistant/components/smhi/weather.py @@ -6,6 +6,8 @@ import aiohttp import async_timeout +from smhi import Smhi +from smhi.smhi_lib import SmhiForecastException from homeassistant.components.weather import ( ATTR_FORECAST_CONDITION, @@ -90,7 +92,6 @@ def __init__( session: aiohttp.ClientSession = None, ) -> None: """Initialize the SMHI weather entity.""" - from smhi import Smhi self._name = name self._latitude = latitude @@ -107,7 +108,6 @@ def unique_id(self) -> str: @Throttle(MIN_TIME_BETWEEN_UPDATES) async def async_update(self) -> None: """Refresh the forecast data from SMHI weather API.""" - from smhi.smhi_lib import SmhiForecastException def fail(): """Postpone updates."""