Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 11 additions & 7 deletions custom_components/plugwise/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from copy import deepcopy
from typing import Any, Self

from plugwise import Smile
Expand All @@ -22,7 +23,6 @@
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
OptionsFlowWithConfigEntry,
)

# Upstream
Expand Down Expand Up @@ -247,35 +247,39 @@ 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)


# 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

if coordinator.api.smile_type == THERMOSTAT:
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

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/plugwise/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
}
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"sensor",
"switch"
],
"homeassistant": "2024.12.0",
"homeassistant": "2024.12.0b2",
"render_readme": true
}
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down