mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Move imports to top for smhi (#29545)
This commit is contained in:
parent
a857148560
commit
1bb499aec2
@ -1,4 +1,5 @@
|
|||||||
"""Config flow to configure SMHI component."""
|
"""Config flow to configure SMHI component."""
|
||||||
|
from smhi.smhi_lib import Smhi, SmhiForecastException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
@ -96,7 +97,6 @@ class SmhiFlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
async def _check_location(self, longitude: str, latitude: str) -> bool:
|
async def _check_location(self, longitude: str, latitude: str) -> bool:
|
||||||
"""Return true if location is ok."""
|
"""Return true if location is ok."""
|
||||||
from smhi.smhi_lib import Smhi, SmhiForecastException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
session = aiohttp_client.async_get_clientsession(self.hass)
|
session = aiohttp_client.async_get_clientsession(self.hass)
|
||||||
|
@ -6,6 +6,8 @@ from typing import Dict, List
|
|||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
from smhi import Smhi
|
||||||
|
from smhi.smhi_lib import SmhiForecastException
|
||||||
|
|
||||||
from homeassistant.components.weather import (
|
from homeassistant.components.weather import (
|
||||||
ATTR_FORECAST_CONDITION,
|
ATTR_FORECAST_CONDITION,
|
||||||
@ -90,7 +92,6 @@ class SmhiWeather(WeatherEntity):
|
|||||||
session: aiohttp.ClientSession = None,
|
session: aiohttp.ClientSession = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the SMHI weather entity."""
|
"""Initialize the SMHI weather entity."""
|
||||||
from smhi import Smhi
|
|
||||||
|
|
||||||
self._name = name
|
self._name = name
|
||||||
self._latitude = latitude
|
self._latitude = latitude
|
||||||
@ -107,7 +108,6 @@ class SmhiWeather(WeatherEntity):
|
|||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
"""Refresh the forecast data from SMHI weather API."""
|
"""Refresh the forecast data from SMHI weather API."""
|
||||||
from smhi.smhi_lib import SmhiForecastException
|
|
||||||
|
|
||||||
def fail():
|
def fail():
|
||||||
"""Postpone updates."""
|
"""Postpone updates."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user