Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update customServiceAPI.js #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

giase82
Copy link
Contributor

@giase82 giase82 commented Sep 20, 2024

Fixing issue with WindowCoveringTilt and other addins not working properly in many configurations.

Fixing issue with WindowCoveringTilt and other addins not working properly in many configurations.
This was referenced Sep 20, 2024
@@ -362,7 +362,7 @@ class customServiceAPI {
*/
knxbusEventCatcher(characteristicName, val, src, dest) {
var temp = this.characteristicsList[characteristicName];
if ((!this.serviceKNX.globs.knxconnection || this.serviceKNX.globs.knxconnection !== 'knxjs') && temp.getDPT() === 'DPT5.001') {
if (temp.getDPT() === 'DPT5.001') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks knx support.

Can you figure out why the condition does not work for knxconnection=='knxd'? Maybe a missing pair of parentheses?

Copy link
Contributor Author

@giase82 giase82 Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one of the issues here is that I don’t understand what this piece of code is supposed to do, and why there is an exception for knxjs. I am missing information on why this !== ‘knxjs’ and !knxconnection is there at all. A short comment etc would be good.

I would expect this.serviceKNX.globs.knxconnection !== 'knxjs' should be “true”, since I am using knxd. However, apperently it isn’t. Another potential fix could be to add this.serviceKNX.globs.knxconnection == 'knxd' as “or”-condition. Like the following:

if ((!this.serviceKNX.globs.knxconnection || this.serviceKNX.globs.knxconnection !== 'knxjs' || this.serviceKNX.globs.knxconnection == 'knxd') && temp.getDPT() === 'DPT5.001') {

Would that work?

In general (also related to your comments on other threads), I wonder if we should keep this as is and I switch over to knxjs. However, also in this case, it would be great to understand what’s different in knxjs compared to knxd regarding DPT5.001, and if I could still run knxd in parallel (for smarthomeng, for example).

Thanks for looking into this!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, knxjs automatically translates 5.001 values to percentages, while using the eibd package we have to do it ourselves. So this if-block was supposed to run only if

  • there is no knxconnection entry at all (!self.serviceKNX.globs.knxconnection) because using the eibd package is still the default
  • or the value is 'knxd' if it is set explicitly (this.serviceKNX.globs.knxconnection == 'knxd'). Bad naming to use knxd while the actual package name for the connector is eibd though, my bad.

This home bridge plug-in never installed a knxd server, that part needed to be done separately, so whatever you have been using outside of home bridge-knx is completely untouched by any change inside. I used the eibd package to connect to a knxd server, using the proprietary protocol of this quite ancient tool.

Since knxd has been completely revamped several years ago, it can work as a multicast router for knx-ip telegrams, which makes the whole stack for the proprietary protocol obsolete and it can be replaced by the much more lightweight knx package (was named knxjs before) which can speak to any knx-ip router, not only knxd-servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants