mirror of
https://github.com/bahmcloud/HA-KNX-Bridge.git
synced 2026-04-06 22:41:14 +00:00
Compare commits
4 Commits
d91d3edc5a
...
v0.0.8
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b20cf4744 | |||
| 6de191b10b | |||
| 2175e5919e | |||
| 83518c88ab |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.0.8 - 2026-02-13
|
||||||
|
- Improve subentry type detection for HA versions exposing different class names.
|
||||||
|
|
||||||
|
## 0.0.7 - 2026-02-13
|
||||||
|
- Avoid crashing config entries when subentries are unsupported.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
## 0.0.4 - 2026-02-13
|
## 0.0.4 - 2026-02-13
|
||||||
- Add per-group-address invert toggles for incoming and outgoing KNX payloads.
|
- Add per-group-address invert toggles for incoming and outgoing KNX payloads.
|
||||||
|
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -47,6 +47,17 @@ Each group address has `invert incoming` and `invert outgoing` toggles to flip K
|
|||||||
## Notes
|
## Notes
|
||||||
- For DPT 1.008 (Up/Down), the bridge treats `0 = Up/Open` and `1 = Down/Close`.
|
- For DPT 1.008 (Up/Down), the bridge treats `0 = Up/Open` and `1 = Down/Close`.
|
||||||
- For DPT 5.001, values are interpreted as 0-100 percent where 0 = closed and 100 = open.
|
- For DPT 5.001, values are interpreted as 0-100 percent where 0 = closed and 100 = open.
|
||||||
|
- DPTs are auto-selected per address:
|
||||||
|
- Binary sensor `state_address`: DPT 1
|
||||||
|
- Switch `command_address`: DPT 1
|
||||||
|
- Switch `state_address`: DPT 1
|
||||||
|
- Cover `move_long_address`: DPT 1.008
|
||||||
|
- Cover `move_short_address`: DPT 1.007
|
||||||
|
- Cover `stop_address`: DPT 1
|
||||||
|
- Cover `position_address`: DPT 5.001
|
||||||
|
- Cover `position_state_address`: DPT 5.001
|
||||||
|
- Cover `angle_address`: DPT 5.001
|
||||||
|
- Cover `angle_state_address`: DPT 5.001
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
- Optional standalone KNX connection (without requiring the HA KNX integration).
|
- Optional standalone KNX connection (without requiring the HA KNX integration).
|
||||||
@@ -54,6 +65,6 @@ Each group address has `invert incoming` and `invert outgoing` toggles to flip K
|
|||||||
- Advanced DPT mapping options and inversion settings.
|
- Advanced DPT mapping options and inversion settings.
|
||||||
|
|
||||||
## Versioning and Releases
|
## Versioning and Releases
|
||||||
- Current version: 0.0.4
|
- Current version: 0.0.8
|
||||||
- `CHANGELOG.md` lists versions with the newest entries at the top.
|
- `CHANGELOG.md` lists versions with the newest entries at the top.
|
||||||
- Release creation is manual and only done when explicitly requested.
|
- Release creation is manual and only done when explicitly requested.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ from homeassistant.helpers import event as event_helper
|
|||||||
from .const import (
|
from .const import (
|
||||||
CONF_ANGLE_ADDRESS,
|
CONF_ANGLE_ADDRESS,
|
||||||
CONF_ANGLE_STATE_ADDRESS,
|
CONF_ANGLE_STATE_ADDRESS,
|
||||||
|
ADDRESS_VALUE_TYPE,
|
||||||
CONF_COMMAND_ADDRESS,
|
CONF_COMMAND_ADDRESS,
|
||||||
CONF_INVERT_INCOMING,
|
CONF_INVERT_INCOMING,
|
||||||
CONF_INVERT_OUTGOING,
|
CONF_INVERT_OUTGOING,
|
||||||
@@ -227,7 +228,7 @@ class BridgeManager:
|
|||||||
continue
|
continue
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
port.state_address,
|
port.state_address,
|
||||||
None,
|
_get_value_type(CONF_STATE_ADDRESS),
|
||||||
port.state_invert_incoming,
|
port.state_invert_incoming,
|
||||||
port.state_invert_outgoing,
|
port.state_invert_outgoing,
|
||||||
)
|
)
|
||||||
@@ -242,7 +243,7 @@ class BridgeManager:
|
|||||||
continue
|
continue
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
port.state_address,
|
port.state_address,
|
||||||
None,
|
_get_value_type(CONF_STATE_ADDRESS),
|
||||||
port.state_invert_incoming,
|
port.state_invert_incoming,
|
||||||
port.state_invert_outgoing,
|
port.state_invert_outgoing,
|
||||||
)
|
)
|
||||||
@@ -258,14 +259,14 @@ class BridgeManager:
|
|||||||
if port.position_state_address:
|
if port.position_state_address:
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
port.position_state_address,
|
port.position_state_address,
|
||||||
"percent",
|
_get_value_type(CONF_POSITION_STATE_ADDRESS),
|
||||||
port.position_state_invert_incoming,
|
port.position_state_invert_incoming,
|
||||||
port.position_state_invert_outgoing,
|
port.position_state_invert_outgoing,
|
||||||
)
|
)
|
||||||
if port.angle_state_address:
|
if port.angle_state_address:
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
port.angle_state_address,
|
port.angle_state_address,
|
||||||
"percent",
|
_get_value_type(CONF_ANGLE_STATE_ADDRESS),
|
||||||
port.angle_state_invert_incoming,
|
port.angle_state_invert_incoming,
|
||||||
port.angle_state_invert_outgoing,
|
port.angle_state_invert_outgoing,
|
||||||
)
|
)
|
||||||
@@ -289,7 +290,7 @@ class BridgeManager:
|
|||||||
for port in cover_ports:
|
for port in cover_ports:
|
||||||
self._register_knx_address(
|
self._register_knx_address(
|
||||||
port.move_long_address,
|
port.move_long_address,
|
||||||
None,
|
CONF_MOVE_LONG_ADDRESS,
|
||||||
port.move_long_invert_incoming,
|
port.move_long_invert_incoming,
|
||||||
port.move_long_invert_outgoing,
|
port.move_long_invert_outgoing,
|
||||||
port,
|
port,
|
||||||
@@ -297,7 +298,7 @@ class BridgeManager:
|
|||||||
)
|
)
|
||||||
self._register_knx_address(
|
self._register_knx_address(
|
||||||
port.move_short_address,
|
port.move_short_address,
|
||||||
None,
|
CONF_MOVE_SHORT_ADDRESS,
|
||||||
port.move_short_invert_incoming,
|
port.move_short_invert_incoming,
|
||||||
port.move_short_invert_outgoing,
|
port.move_short_invert_outgoing,
|
||||||
port,
|
port,
|
||||||
@@ -305,7 +306,7 @@ class BridgeManager:
|
|||||||
)
|
)
|
||||||
self._register_knx_address(
|
self._register_knx_address(
|
||||||
port.stop_address,
|
port.stop_address,
|
||||||
None,
|
CONF_STOP_ADDRESS,
|
||||||
port.stop_invert_incoming,
|
port.stop_invert_incoming,
|
||||||
port.stop_invert_outgoing,
|
port.stop_invert_outgoing,
|
||||||
port,
|
port,
|
||||||
@@ -313,7 +314,7 @@ class BridgeManager:
|
|||||||
)
|
)
|
||||||
self._register_knx_address(
|
self._register_knx_address(
|
||||||
port.position_address,
|
port.position_address,
|
||||||
"percent",
|
CONF_POSITION_ADDRESS,
|
||||||
port.position_invert_incoming,
|
port.position_invert_incoming,
|
||||||
port.position_invert_outgoing,
|
port.position_invert_outgoing,
|
||||||
port,
|
port,
|
||||||
@@ -321,7 +322,7 @@ class BridgeManager:
|
|||||||
)
|
)
|
||||||
self._register_knx_address(
|
self._register_knx_address(
|
||||||
port.angle_address,
|
port.angle_address,
|
||||||
"percent",
|
CONF_ANGLE_ADDRESS,
|
||||||
port.angle_invert_incoming,
|
port.angle_invert_incoming,
|
||||||
port.angle_invert_outgoing,
|
port.angle_invert_outgoing,
|
||||||
port,
|
port,
|
||||||
@@ -338,7 +339,7 @@ class BridgeManager:
|
|||||||
def _register_knx_address(
|
def _register_knx_address(
|
||||||
self,
|
self,
|
||||||
address: str | None,
|
address: str | None,
|
||||||
value_type: str | None,
|
address_key: str,
|
||||||
invert_incoming: bool,
|
invert_incoming: bool,
|
||||||
invert_outgoing: bool,
|
invert_outgoing: bool,
|
||||||
port: CoverPort,
|
port: CoverPort,
|
||||||
@@ -350,6 +351,7 @@ class BridgeManager:
|
|||||||
self._address_handlers[address] = lambda event: self._handle_cover_action(
|
self._address_handlers[address] = lambda event: self._handle_cover_action(
|
||||||
port, action, event
|
port, action, event
|
||||||
)
|
)
|
||||||
|
value_type = _get_value_type(address_key)
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
address, value_type, invert_incoming, invert_outgoing
|
address, value_type, invert_incoming, invert_outgoing
|
||||||
)
|
)
|
||||||
@@ -368,7 +370,10 @@ class BridgeManager:
|
|||||||
port, event
|
port, event
|
||||||
)
|
)
|
||||||
self._remember_address_options(
|
self._remember_address_options(
|
||||||
address, None, invert_incoming, invert_outgoing
|
address,
|
||||||
|
_get_value_type(CONF_COMMAND_ADDRESS),
|
||||||
|
invert_incoming,
|
||||||
|
invert_outgoing,
|
||||||
)
|
)
|
||||||
self._registered_addresses.append((address, None))
|
self._registered_addresses.append((address, None))
|
||||||
|
|
||||||
@@ -623,3 +628,7 @@ def _invert_in_key(address_key: str) -> str:
|
|||||||
|
|
||||||
def _invert_out_key(address_key: str) -> str:
|
def _invert_out_key(address_key: str) -> str:
|
||||||
return f"{address_key}_{CONF_INVERT_OUTGOING}"
|
return f"{address_key}_{CONF_INVERT_OUTGOING}"
|
||||||
|
|
||||||
|
|
||||||
|
def _get_value_type(address_key: str) -> str | None:
|
||||||
|
return ADDRESS_VALUE_TYPE.get(address_key)
|
||||||
|
|||||||
@@ -65,14 +65,20 @@ class HAKnxBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_supported_subentry_types(config_entry):
|
def async_get_supported_subentry_types(config_entry):
|
||||||
|
subentry_type = _get_subentry_type()
|
||||||
|
if subentry_type is None:
|
||||||
|
_LOGGER.warning(
|
||||||
|
"Config subentries are not supported in this Home Assistant version"
|
||||||
|
)
|
||||||
|
return {}
|
||||||
return {
|
return {
|
||||||
"binary_sensor": config_entries.SubentryType(
|
"binary_sensor": subentry_type(
|
||||||
name="Binary Sensor Port", flow_class=BinarySensorPortSubentryFlow
|
name="Binary Sensor Port", flow_class=BinarySensorPortSubentryFlow
|
||||||
),
|
),
|
||||||
"switch": config_entries.SubentryType(
|
"switch": subentry_type(
|
||||||
name="Switch Port", flow_class=SwitchPortSubentryFlow
|
name="Switch Port", flow_class=SwitchPortSubentryFlow
|
||||||
),
|
),
|
||||||
"cover": config_entries.SubentryType(
|
"cover": subentry_type(
|
||||||
name="Cover Port", flow_class=CoverPortSubentryFlow
|
name="Cover Port", flow_class=CoverPortSubentryFlow
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@@ -346,3 +352,22 @@ def _invert_in_key(address_key: str) -> str:
|
|||||||
|
|
||||||
def _invert_out_key(address_key: str) -> str:
|
def _invert_out_key(address_key: str) -> str:
|
||||||
return f"{address_key}_{CONF_INVERT_OUTGOING}"
|
return f"{address_key}_{CONF_INVERT_OUTGOING}"
|
||||||
|
|
||||||
|
|
||||||
|
def _get_subentry_type():
|
||||||
|
candidates = [
|
||||||
|
"SubentryType",
|
||||||
|
"ConfigEntrySubentryType",
|
||||||
|
"ConfigSubentryType",
|
||||||
|
"SubEntryType",
|
||||||
|
]
|
||||||
|
for name in candidates:
|
||||||
|
subentry_type = getattr(config_entries, name, None)
|
||||||
|
if subentry_type is not None:
|
||||||
|
return subentry_type
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Subentry type class not found on homeassistant.config_entries. "
|
||||||
|
"Available attrs: %s",
|
||||||
|
", ".join(sorted(dir(config_entries))),
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|||||||
@@ -14,3 +14,22 @@ CONF_POSITION_ADDRESS = "position_address"
|
|||||||
CONF_POSITION_STATE_ADDRESS = "position_state_address"
|
CONF_POSITION_STATE_ADDRESS = "position_state_address"
|
||||||
CONF_ANGLE_ADDRESS = "angle_address"
|
CONF_ANGLE_ADDRESS = "angle_address"
|
||||||
CONF_ANGLE_STATE_ADDRESS = "angle_state_address"
|
CONF_ANGLE_STATE_ADDRESS = "angle_state_address"
|
||||||
|
|
||||||
|
ADDRESS_DPT_MAP: dict[str, str] = {
|
||||||
|
CONF_STATE_ADDRESS: "1",
|
||||||
|
CONF_COMMAND_ADDRESS: "1",
|
||||||
|
CONF_MOVE_LONG_ADDRESS: "1.008",
|
||||||
|
CONF_MOVE_SHORT_ADDRESS: "1.007",
|
||||||
|
CONF_STOP_ADDRESS: "1",
|
||||||
|
CONF_POSITION_ADDRESS: "5.001",
|
||||||
|
CONF_POSITION_STATE_ADDRESS: "5.001",
|
||||||
|
CONF_ANGLE_ADDRESS: "5.001",
|
||||||
|
CONF_ANGLE_STATE_ADDRESS: "5.001",
|
||||||
|
}
|
||||||
|
|
||||||
|
ADDRESS_VALUE_TYPE: dict[str, str] = {
|
||||||
|
CONF_POSITION_ADDRESS: "percent",
|
||||||
|
CONF_POSITION_STATE_ADDRESS: "percent",
|
||||||
|
CONF_ANGLE_ADDRESS: "percent",
|
||||||
|
CONF_ANGLE_STATE_ADDRESS: "percent",
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"domain": "ha_knx_bridge",
|
"domain": "ha_knx_bridge",
|
||||||
"name": "HA KNX Bridge",
|
"name": "HA KNX Bridge",
|
||||||
"version": "0.0.4",
|
"version": "0.0.8",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://github.com/bahmcloud/HA-KNX-Bridge",
|
"documentation": "https://github.com/bahmcloud/HA-KNX-Bridge",
|
||||||
"issue_tracker": "https://github.com/bahmcloud/HA-KNX-Bridge/issues",
|
"issue_tracker": "https://github.com/bahmcloud/HA-KNX-Bridge/issues",
|
||||||
|
|||||||
Reference in New Issue
Block a user