mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
Use relative import paths
This commit is contained in:
parent
6476f0e57a
commit
1a33b3b594
6 changed files with 14 additions and 14 deletions
|
@ -10,7 +10,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
from homeassistant.util import dt
|
from homeassistant.util import dt
|
||||||
|
|
||||||
from custom_components.irm_kmi import DOMAIN, IrmKmiCoordinator
|
from . import DOMAIN, IrmKmiCoordinator
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.components.weather import (ATTR_CONDITION_CLEAR_NIGHT,
|
||||||
ATTR_CONDITION_SUNNY)
|
ATTR_CONDITION_SUNNY)
|
||||||
from homeassistant.const import Platform, UnitOfPressure, UnitOfSpeed, UnitOfTemperature, DEGREE
|
from homeassistant.const import Platform, UnitOfPressure, UnitOfSpeed, UnitOfTemperature, DEGREE
|
||||||
|
|
||||||
from custom_components.irm_kmi.irm_kmi_api.const import OPTION_STYLE_CONTRAST, OPTION_STYLE_YELLOW_RED, \
|
from .irm_kmi_api.const import OPTION_STYLE_CONTRAST, OPTION_STYLE_YELLOW_RED, \
|
||||||
OPTION_STYLE_SATELLITE, OPTION_STYLE_STD
|
OPTION_STYLE_SATELLITE, OPTION_STYLE_STD
|
||||||
|
|
||||||
DOMAIN: Final = 'irm_kmi'
|
DOMAIN: Final = 'irm_kmi'
|
||||||
|
|
|
@ -14,12 +14,12 @@ from zoneinfo import ZoneInfo
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
from custom_components.irm_kmi.irm_kmi_api.const import WEEKDAYS, STYLE_TO_PARAM_MAP, OPTION_STYLE_SATELLITE, \
|
from .const import WEEKDAYS, STYLE_TO_PARAM_MAP, OPTION_STYLE_SATELLITE, \
|
||||||
MAP_WARNING_ID_TO_SLUG as SLUG_MAP
|
MAP_WARNING_ID_TO_SLUG as SLUG_MAP
|
||||||
from custom_components.irm_kmi.irm_kmi_api.data import CurrentWeatherData, IrmKmiForecast, Forecast, \
|
from .data import CurrentWeatherData, IrmKmiForecast, Forecast, \
|
||||||
IrmKmiRadarForecast, RadarAnimationData, AnimationFrameData, WarningData
|
IrmKmiRadarForecast, RadarAnimationData, AnimationFrameData, WarningData
|
||||||
from custom_components.irm_kmi.irm_kmi_api.pollen import PollenParser
|
from .pollen import PollenParser
|
||||||
from custom_components.irm_kmi.utils import next_weekday
|
from .utils import next_weekday
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
|
|
||||||
|
|
8
custom_components/irm_kmi/irm_kmi_api/utils.py
Normal file
8
custom_components/irm_kmi/irm_kmi_api/utils.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
|
def next_weekday(current, weekday):
|
||||||
|
days_ahead = weekday - current.weekday()
|
||||||
|
if days_ahead < 0:
|
||||||
|
days_ahead += 7
|
||||||
|
return current + timedelta(days_ahead)
|
|
@ -1,5 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
from datetime import timedelta
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -41,8 +40,3 @@ def preferred_language(hass: HomeAssistant, config_entry: ConfigEntry) -> str:
|
||||||
return get_config_value(config_entry, CONF_LANGUAGE_OVERRIDE)
|
return get_config_value(config_entry, CONF_LANGUAGE_OVERRIDE)
|
||||||
|
|
||||||
|
|
||||||
def next_weekday(current, weekday):
|
|
||||||
days_ahead = weekday - current.weekday()
|
|
||||||
if days_ahead < 0:
|
|
||||||
days_ahead += 7
|
|
||||||
return current + timedelta(days_ahead)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue