From 2175e5919ea31a6d8df0f5bc90b15e3b3d07ddb8 Mon Sep 17 00:00:00 2001 From: bahmcloud Date: Fri, 13 Feb 2026 19:08:13 +0100 Subject: [PATCH] Fix subentry type compatibility --- CHANGELOG.md | 3 +++ README.md | 2 +- custom_components/ha_knx_bridge/config_flow.py | 11 ++++++++--- custom_components/ha_knx_bridge/manifest.json | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c96f60a..87d2627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.0.6 - 2026-02-13 +- Fix config flow subentry type compatibility with older Home Assistant versions. + ## 0.0.5 - 2026-02-13 - Centralize DPT auto-selection for KNX event registration per address. diff --git a/README.md b/README.md index fe0d98a..2e7b500 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,6 @@ Each group address has `invert incoming` and `invert outgoing` toggles to flip K - Advanced DPT mapping options and inversion settings. ## Versioning and Releases -- Current version: 0.0.5 +- Current version: 0.0.6 - `CHANGELOG.md` lists versions with the newest entries at the top. - Release creation is manual and only done when explicitly requested. diff --git a/custom_components/ha_knx_bridge/config_flow.py b/custom_components/ha_knx_bridge/config_flow.py index a1f7c6c..8e570a7 100644 --- a/custom_components/ha_knx_bridge/config_flow.py +++ b/custom_components/ha_knx_bridge/config_flow.py @@ -28,6 +28,9 @@ from .const import ( _LOGGER = logging.getLogger(__name__) KNX_DOMAIN = "knx" +_SUBENTRY_TYPE = getattr( + config_entries, "SubentryType", getattr(config_entries, "ConfigEntrySubentryType", None) +) class HAKnxBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @@ -65,14 +68,16 @@ class HAKnxBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @staticmethod @callback def async_get_supported_subentry_types(config_entry): + if _SUBENTRY_TYPE is None: + raise NotImplementedError("Subentry types are not supported in this HA version") return { - "binary_sensor": config_entries.SubentryType( + "binary_sensor": _SUBENTRY_TYPE( name="Binary Sensor Port", flow_class=BinarySensorPortSubentryFlow ), - "switch": config_entries.SubentryType( + "switch": _SUBENTRY_TYPE( name="Switch Port", flow_class=SwitchPortSubentryFlow ), - "cover": config_entries.SubentryType( + "cover": _SUBENTRY_TYPE( name="Cover Port", flow_class=CoverPortSubentryFlow ), } diff --git a/custom_components/ha_knx_bridge/manifest.json b/custom_components/ha_knx_bridge/manifest.json index 1421e3a..be49e4a 100644 --- a/custom_components/ha_knx_bridge/manifest.json +++ b/custom_components/ha_knx_bridge/manifest.json @@ -1,7 +1,7 @@ { "domain": "ha_knx_bridge", "name": "HA KNX Bridge", - "version": "0.0.5", + "version": "0.0.6", "config_flow": true, "documentation": "https://github.com/bahmcloud/HA-KNX-Bridge", "issue_tracker": "https://github.com/bahmcloud/HA-KNX-Bridge/issues",