Fix subentry type compatibility

This commit is contained in:
2026-02-13 19:08:13 +01:00
parent 83518c88ab
commit 2175e5919e
4 changed files with 13 additions and 5 deletions

View File

@@ -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
),
}

View File

@@ -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",