Move imports to top for smhi (#29545)
parent
a857148560
commit
1bb499aec2
|
@ -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 @@ class SmhiFlowHandler(config_entries.ConfigFlow):
|
|||
|
||||
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)
|
||||
|
|
|
@ -6,6 +6,8 @@ from typing import Dict, List
|
|||
|
||||
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 @@ class SmhiWeather(WeatherEntity):
|
|||
session: aiohttp.ClientSession = None,
|
||||
) -> None:
|
||||
"""Initialize the SMHI weather entity."""
|
||||
from smhi import Smhi
|
||||
|
||||
self._name = name
|
||||
self._latitude = latitude
|
||||
|
@ -107,7 +108,6 @@ class SmhiWeather(WeatherEntity):
|
|||
@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."""
|
||||
|
|
Loading…
Reference in New Issue