Skip to content

Add support for 2-level KNX group addresses (fixes #92) - #93

Open
Tim0kot wants to merge 1 commit into
athombv:masterfrom
Tim0kot:fix/two-level-group-addressing
Open

Add support for 2-level KNX group addresses (fixes #92)#93
Tim0kot wants to merge 1 commit into
athombv:masterfrom
Tim0kot:fix/two-level-group-addressing

Conversation

@Tim0kot

@Tim0kot Tim0kot commented Jul 30, 2026

Copy link
Copy Markdown

Fixes #92.

As described in the issue, the bundled knx library only ever parses group addresses in 3-level mode: KnxProtocol.js calls Address.parse/Address.toString without their twoLevelAddressing argument, so a 2-level address like 6/7 throws at serialization time, after the write has already resolved. The app looks connected but nothing is transmitted.

Changes:

  • patches/knx+2.5.4.patch (applied by patch-package on postinstall): pass the library's existing KnxProtocol.twoLevelAddressing flag when encoding and decoding the cEMI destination address. It's a two line change, the flag is already declared in the library (defaulting to false), it was just never wired up.
  • New app settings page with one toggle, "Use 2-level group addresses (for example 1/7)", default off. Stored as the two_level_group_addressing app setting; app.js applies it on init and on change, no restart needed. Localized for all 13 languages.
  • test/TestTwoLevelAddressing.js (wired as npm test): verifies that a 2-level telegram is byte-identical to its 3-level twin (6/7 and 6/0/7 are the same 16-bit address on the bus), covers the address range limits, and reproduces the original failure.

With the toggle off (the default) the encode/decode paths produce byte-identical output to the current release, so existing 3-level installations are unaffected. Decode uses the same flag, so incoming telegrams match the configured group addresses and status updates work as well, not just writes.

Tested with this branch installed on a Homey Pro tunnelling to knxd, with telegrams captured by tcpdump on the gateway host: toggle off reproduces the silent failure from the issue, toggle on puts the expected destination on the wire (including sub groups above 255), and the status address round-trips correctly. The same two library edits have also been running for a week on a live 130-device installation that uses 2-level addressing throughout.

ETS projects can use 2-level group addresses (for example 6/7). The bundled
knx library declares a twoLevelAddressing flag but never passes it when
marshalling the cEMI destination address, so any 2-level address throws
'Invalid address - missing 3rd token' at serialization, after the write has
already resolved: devices pair normally but no telegram is ever transmitted.

- patches/knx+2.5.4.patch (applied via patch-package on postinstall) passes
  the flag on encode and decode of the destination address. patch-package is
  a production dependency so the patch also applies on production installs.
- New app settings page with a "Use 2-level group addresses (for example
  1/7)" toggle, default off, stored as two_level_group_addressing and
  applied by app.js on startup and on change. Localized for all 13
  languages. An error is logged if 2-level mode is enabled while configured
  addresses still use 3-level style.
- test/TestTwoLevelAddressing.js (wired as npm test) proves a 2-level
  telegram is byte-identical to its 3-level twin, covers the address range
  limits, and reproduces the original failure.

Fixes athombv#92
@Tim0kot
Tim0kot force-pushed the fix/two-level-group-addressing branch from 152d8bb to ab65d8a Compare July 30, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2-level KNX group addresses are silently unsupported - devices connect but never transmit

1 participant