Fix generic knx_receive trigger tokens for DPT 3.007#91
Open
jobosol wants to merge 1 commit into
Open
Conversation
The knx library parses DPT 3.007 telegrams into an object with a direction bit (decr_incr) and a 3-bit stepcode (data). The object case in the token mapping only handled Date and DPT 18 scene objects, so the Flow tokens were always 0 / false / empty regardless of the received command. Map DPT 3.007 to Homey Flow tokens: the number token carries the signed step on Homey's -1 to 1 dim scale, the boolean token indicates an active dim command, and the string token reads up <percentage>%, down <percentage>% or stop. Restrict the mapping to subtype 3.007 because DPT 3.008 uses different direction semantics. Fixes athombv#71
Contributor
|
Thanks for the PR. I've had a small look at it and it seems good. I'll have a better look next week so it can go along with release 1.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for KNX DPT 3.007 relative dimming values in the generic
knx_receiveFlow trigger.DPT 3.007 is decoded as an object containing the dimming direction and step size. Previously, this object was not converted into a useful numeric Flow token.
This change converts it into a signed, normalized value:
0.125or-0.125for a 1/8 stepThe resulting value can be connected directly to Homey's relative dimming actions.
The special handling is limited to DPT 3.007, since DPT 3.008 uses different semantics.
Use case
This makes it possible to use physical KNX wall switches to control non-KNX lights through Homey.
For example, a KNX push button can publish cyclic relative dimming telegrams while it is held. A Homey Flow can receive each telegram and pass the signed value directly to the relative dimming action of a Philips Hue light.
Testing
Tested on a physical KNX installation using:
The wall switch was configured in ETS to cyclically send
1/8brighter and darker DPT 3.007 commands. Homey received+0.125and-0.125, and the Hue light dimmed continuously in the corresponding direction while the button was held.Dimming stopped when the wall switch stopped publishing cyclic commands.
npm run lintpasses locally.Closes #71