From 4347fad2202201628f3d734fd1036d004e0a5871 Mon Sep 17 00:00:00 2001 From: cptshrk108 Date: Wed, 8 Jan 2025 10:35:00 -0500 Subject: [PATCH 1/2] Ajout version check pour config_entry init dans config_flow depuis que c'est no longer allowed dans HA > 24.11.99 --- custom_components/hilo/config_flow.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_components/hilo/config_flow.py b/custom_components/hilo/config_flow.py index ce421c0..b187b73 100755 --- a/custom_components/hilo/config_flow.py +++ b/custom_components/hilo/config_flow.py @@ -4,9 +4,10 @@ import logging from typing import Any +from awesomeversion import AwesomeVersion from homeassistant import config_entries from homeassistant.config_entries import ConfigEntry -from homeassistant.const import CONF_SCAN_INTERVAL +from homeassistant.const import CONF_SCAN_INTERVAL, __version__ as HAVERSION from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers import config_validation as cv, selector @@ -152,8 +153,9 @@ class HiloOptionsFlowHandler(config_entries.OptionsFlow): """Handle a Hilo options flow.""" def __init__(self, config_entry: ConfigEntry) -> None: - """Initialize.""" - self._config_entry = config_entry + """Initialize""" + if AwesomeVersion(HAVERSION) < "2024.11.99": + self.config_entry = config_entry async def async_step_init( self, user_input: dict[str, Any] | None = None From c29dedeb6b9137463b1f7c44d9f7fd441484aaf6 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:09:37 -0500 Subject: [PATCH 2/2] Update config_flow.py Ajout de forward compatibility. --- custom_components/hilo/config_flow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/hilo/config_flow.py b/custom_components/hilo/config_flow.py index b187b73..520e9cf 100755 --- a/custom_components/hilo/config_flow.py +++ b/custom_components/hilo/config_flow.py @@ -156,6 +156,8 @@ def __init__(self, config_entry: ConfigEntry) -> None: """Initialize""" if AwesomeVersion(HAVERSION) < "2024.11.99": self.config_entry = config_entry + else: + self._config_entry = config_entry async def async_step_init( self, user_input: dict[str, Any] | None = None