mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
Cleanup code
This commit is contained in:
parent
2b8fa6e444
commit
a2fc11ddbd
6 changed files with 6 additions and 9 deletions
|
@ -7,7 +7,8 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryError
|
||||
|
||||
from .const import DOMAIN, PLATFORMS, CONF_DARK_MODE, CONF_STYLE_STD, CONF_STYLE
|
||||
from .const import (CONF_DARK_MODE, CONF_STYLE, CONF_STYLE_STD, DOMAIN,
|
||||
PLATFORMS)
|
||||
from .coordinator import IrmKmiCoordinator
|
||||
from .weather import IrmKmiWeather
|
||||
|
||||
|
@ -16,10 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up this integration using UI."""
|
||||
_LOGGER.debug(f"Setting up entry v{entry.version}")
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
||||
hass.data[DOMAIN][entry.entry_id] = coordinator = IrmKmiCoordinator(hass, entry)
|
||||
|
||||
try:
|
||||
|
@ -58,7 +56,6 @@ async def async_migrate_entry(hass, config_entry: ConfigEntry):
|
|||
|
||||
new = {**config_entry.data}
|
||||
if config_entry.version == 1:
|
||||
|
||||
new = new | {CONF_STYLE: CONF_STYLE_STD, CONF_DARK_MODE: True}
|
||||
config_entry.version = 2
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class IrmKmiConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_user(self, user_input: dict | None = None) -> FlowResult:
|
||||
"""Define the user step of the configuration flow."""
|
||||
print(f"IN CONFIG FLOW HERE with {user_input}")
|
||||
if user_input is not None:
|
||||
_LOGGER.debug(f"Provided config user is: {user_input}")
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ OUT_OF_BENELUX: Final = ["außerhalb der Benelux (Brussels)",
|
|||
"Buiten de Benelux (Brussel)"]
|
||||
LANGS: Final = ['en', 'fr', 'nl', 'de']
|
||||
|
||||
|
||||
CONF_STYLE_STD: Final = 'standard_style'
|
||||
CONF_STYLE_CONTRAST: Final = 'contrast_style'
|
||||
CONF_STYLE_YELLOW_RED: Final = 'yellow_red_style'
|
||||
|
|
|
@ -135,7 +135,8 @@ class IrmKmiCoordinator(DataUpdateCoordinator):
|
|||
|
||||
for frame in animation_data:
|
||||
if frame.get('uri', None) is not None:
|
||||
coroutines.append(self._api_client.get_image(frame.get('uri'), params={'rs': STYLE_TO_PARAM_MAP[style]}))
|
||||
coroutines.append(
|
||||
self._api_client.get_image(frame.get('uri'), params={'rs': STYLE_TO_PARAM_MAP[style]}))
|
||||
async with async_timeout.timeout(20):
|
||||
images_from_api = await asyncio.gather(*coroutines)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"step": {
|
||||
"user": {
|
||||
"title": "Choisissez une zone",
|
||||
"data" : {
|
||||
"data": {
|
||||
"zone": "Zone"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ async def patched(url: str, params: dict | None = None) -> bytes:
|
|||
with open(file_name, "rb") as file:
|
||||
return file.read()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def auto_enable_custom_integrations(enable_custom_integrations):
|
||||
yield
|
||||
|
|
Loading…
Add table
Reference in a new issue