From 9413d4a181ea20c1b4cad75775f8b7e9946f6af3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Sun, 22 Dec 2024 16:14:32 +0000 Subject: [PATCH] issue #713 - config_entry is deprecated --- custom_components/versatile_thermostat/config_flow.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/custom_components/versatile_thermostat/config_flow.py b/custom_components/versatile_thermostat/config_flow.py index d36af96..7e824a9 100644 --- a/custom_components/versatile_thermostat/config_flow.py +++ b/custom_components/versatile_thermostat/config_flow.py @@ -915,7 +915,7 @@ async def async_step_finalize(self, _): ) -class VersatileThermostatConfigFlow( +class VersatileThermostatConfigFlow( # pylint: disable=abstract-method VersatileThermostatBaseConfigFlow, HAConfigFlow, domain=DOMAIN ): """Handle a config flow for Versatile Thermostat.""" @@ -929,6 +929,8 @@ def __init__(self) -> None: @callback def async_get_options_flow(config_entry: ConfigEntry): """Get options flow for this handler""" + # #713 doesn't work as explained here:https://developers.home-assistant.io/blog/2024/11/12/options-flow + # should be - return VersatileThermostatOptionsFlowHandler() but hass is not initialized return VersatileThermostatOptionsFlowHandler(config_entry) async def async_step_finalize(self, _): @@ -947,8 +949,12 @@ class VersatileThermostatOptionsFlowHandler( def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" + + self._conf_app_id: str | None = None + super().__init__(config_entry.data.copy()) - self.config_entry = config_entry + # #713 + # self.config_entry = config_entry _LOGGER.debug( "CTOR VersatileThermostatOptionsFlowHandler info: %s, entry_id: %s", self._infos,