diff --git a/CHANGELOG.md b/CHANGELOG.md index b12e71d8f..635b4f1c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ Versions from 0.40 and up -## Ongoing +## v0.55.1 - Bugfix for Issue #776 - Support python 3.13 / HA-Core 2024.12 - Link to plugwise [v1.6.1](https://github.com/plugwise/python-plugwise/releases/tag/v1.6.1) +- Make Config-OptionsFlow compatible with HA 2024.12.0 ## v0.55.0 diff --git a/custom_components/plugwise/config_flow.py b/custom_components/plugwise/config_flow.py index 539fbbc77..2cfcaca03 100644 --- a/custom_components/plugwise/config_flow.py +++ b/custom_components/plugwise/config_flow.py @@ -2,6 +2,7 @@ from __future__ import annotations +from copy import deepcopy from typing import Any, Self from plugwise import Smile @@ -22,7 +23,6 @@ ConfigFlow, ConfigFlowResult, OptionsFlow, - OptionsFlowWithConfigEntry, ) # Upstream @@ -247,7 +247,7 @@ async def async_step_user( @callback def async_get_options_flow( config_entry: PlugwiseConfigEntry, - ) -> OptionsFlow: # pw-beta options + ) -> PlugwiseOptionsFlowHandler: # pw-beta options """Get the options flow for this handler.""" return PlugwiseOptionsFlowHandler(config_entry) @@ -255,15 +255,19 @@ def async_get_options_flow( # pw-beta - change the scan-interval via CONFIGURE # pw-beta - add homekit emulation via CONFIGURE # pw-beta - change the frontend refresh interval via CONFIGURE -class PlugwiseOptionsFlowHandler(OptionsFlowWithConfigEntry): # pw-beta options +class PlugwiseOptionsFlowHandler(OptionsFlow): # pw-beta options """Plugwise option flow.""" + def __init__(self, config_entry: ConfigEntry) -> None: + """Initialize options flow.""" + self.options = deepcopy(dict(config_entry.options)) + def _create_options_schema(self, coordinator: PlugwiseDataUpdateCoordinator) -> vol.Schema: interval = DEFAULT_SCAN_INTERVAL[coordinator.api.smile_type] # pw-beta options schema = { vol.Optional( CONF_SCAN_INTERVAL, - default=self._options.get(CONF_SCAN_INTERVAL, interval.seconds), + default=self.options.get(CONF_SCAN_INTERVAL, interval.seconds), ): vol.All(cv.positive_int, vol.Clamp(min=10)), } # pw-beta @@ -271,11 +275,11 @@ def _create_options_schema(self, coordinator: PlugwiseDataUpdateCoordinator) -> schema.update({ vol.Optional( CONF_HOMEKIT_EMULATION, - default=self._options.get(CONF_HOMEKIT_EMULATION, False), + default=self.options.get(CONF_HOMEKIT_EMULATION, False), ): vol.All(cv.boolean), vol.Optional( CONF_REFRESH_INTERVAL, - default=self._options.get(CONF_REFRESH_INTERVAL, 1.5), + default=self.options.get(CONF_REFRESH_INTERVAL, 1.5), ): vol.All(vol.Coerce(float), vol.Range(min=1.5, max=10.0)), }) # pw-beta @@ -287,7 +291,7 @@ async def async_step_none( """No options available.""" if user_input is not None: # Apparently not possible to abort an options flow at the moment - return self.async_create_entry(title="", data=self._options) + return self.async_create_entry(title="", data=self.options) return self.async_show_form(step_id="none") async def async_step_init(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: diff --git a/custom_components/plugwise/manifest.json b/custom_components/plugwise/manifest.json index 12da7baa4..9be770a6e 100644 --- a/custom_components/plugwise/manifest.json +++ b/custom_components/plugwise/manifest.json @@ -8,6 +8,6 @@ "iot_class": "local_polling", "loggers": ["plugwise"], "requirements": ["plugwise==1.6.1"], - "version": "0.55.0", + "version": "0.55.1", "zeroconf": ["_plugwise._tcp.local."] } diff --git a/hacs.json b/hacs.json index 32497bfd2..2c6f7e9b7 100644 --- a/hacs.json +++ b/hacs.json @@ -9,6 +9,6 @@ "sensor", "switch" ], - "homeassistant": "2024.12.0", + "homeassistant": "2024.12.0b2", "render_readme": true } diff --git a/pyproject.toml b/pyproject.toml index 49e3bb6aa..3c726382b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "plugwise-beta" -version = "0.55.0" +version = "0.55.1" description = "Plugwise beta custom-component" readme = "README.md" -requires-python = ">=3.13" +requires-python = ">=3.12" license = {file = "LICENSE"} keywords = ["Plugwise", "Adam", "Anna", "P1", "Stretch", "Smile"] authors = [