Closed bytefactory73 closed 8 years ago
Hi, I like the idea - espc as I had the same in mind (define which addresses to read at startup) for the next release (of which I am talking for a year now, I know.)
The hashmap is very good also - I did just ignore the white noise in my installation as my homebridge is running 24/7 (battery back up) for ages now. Central addresses like "all lights off" are unreadable in my installation by default, so no one will answer that read request.
But I have some questions regarding your implementation of the ListenNoRead: You create a "noread" version of the listening addresses (https://github.com/bytefactory73/homebridge-knx/blob/master/index.js#L815)
var listenaddressesNoRead = listenaddresses;
Then you add the ListenNoRead addresses from the config.json for that service to the original list:
if ('ListenNoRead' in config) {
listenaddresses = listenaddresses.concat(config.ListenNoRead || []);
}
All of the combined list are registered for listening, eg.
this.knxregister_bool(listenaddresses, myCharacteristic);
But only the list listenaddressesNoRead is sent for reading. (https://github.com/bytefactory73/homebridge-knx/blob/master/index.js#L844)
this.knxreadarray(listenaddressesNoRead);
Might it be the list is misnamed and should be named ListenWithRead instead of NoRead?
As you seem to have fun digging in JavaScript - any interest in helping with the next version?
regarding the variable name you are absolutely right. it should better be named "addressesToRead" or something like this. shall i rename that or will you do that?.
javascript is foreign to me. usually i programm in c++ but javascript is not that far from that.
my time is also a bit limited but if you have some ideas to implement i can try to help here and there.
btw. i noticed that one datatype is not supported in your code. i have a few somfy ilt devices which send a 2 byte percent value (EIS7 if i recall correctly from memory). maybe i will add this as well.
i renamed the variable.
if you like you can pull my changes into your branch. i added 2 things:
"services":[ { "type":"Lightbulb", "name":"Stehlampe", "description":"", "On":{ "Set":"1/1/50", "Listen":["1/1/50"], "ListenNoRead":["1/0/1"] } }]
have fun.
cheers