Skip to content

Commit

Permalink
fix for #164
Browse files Browse the repository at this point in the history
knxread function did not use proper new knxconnenction setting. should fix #164
  • Loading branch information
snowdd1 committed May 23, 2020
1 parent f461ecd commit 0b34cd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog for Version 0.3.x

## 0.3.26
- giase updated the ThermostatMode handler in #169 to be able to update the Bus value also from HomeKit
- @giase82 updated the ThermostatMode handler in #169 to be able to update the Bus value also from HomeKit
- Found another glitch in the knxaccess.js library where KNXJS was used even if it was not specified (regression from 0.3.24)

## 0.3.25
- martijndierkx contributed an MDTJalousieActuator handler in PR #167 - Big thanks to him!
Expand Down
15 changes: 10 additions & 5 deletions lib/knxaccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ allFunctions.knxwrite = function(callback, groupAddress, dpt, value) {
/** @type {eibd~Connection} */

if(!(!globs.knxconnection) || globs.knxconnection==='knxjs') {
// use KNX JS for KNX IP
var connection = knx.Connection({
handlers: {
connected: function() {
Expand All @@ -34,14 +35,15 @@ allFunctions.knxwrite = function(callback, groupAddress, dpt, value) {
try {
callback();
} catch (e) {
globs.log('Caught error '+ e + ' when calling homebridg callback.');
globs.log('Caught error '+ e + ' when calling homebridge callback.');
}
}
});
}
}
});
} else {
// use EIBD package for KNXD
var knxdConnection = new knxd.Connection();
//globs.info("DEBUG in knxwrite: created empty connection, trying to connect socket to " + globs.knxd_ip + ":" + globs.knxd_port);
knxdConnection.socketRemote({
Expand All @@ -62,7 +64,7 @@ allFunctions.knxwrite = function(callback, groupAddress, dpt, value) {
try {
callback(err);
} catch (e) {
globs.log('Caught error '+ e + ' when calling homebridg callback.');
globs.log('Caught error '+ e + ' when calling homebridge callback.');
}
}
} else {
Expand All @@ -75,7 +77,7 @@ allFunctions.knxwrite = function(callback, groupAddress, dpt, value) {
try {
callback(err);
} catch (e) {
globs.log('Caught error '+ e + ' when calling homebridg callback.');
globs.log('Caught error '+ e + ' when calling homebridge callback.');
}
}
} else {
Expand All @@ -84,7 +86,7 @@ allFunctions.knxwrite = function(callback, groupAddress, dpt, value) {
try {
callback();
} catch (e) {
globs.log('Caught error '+ e + ' when calling homebridg callback.');
globs.log('Caught error '+ e + ' when calling homebridge callback.');
}
}
}
Expand Down Expand Up @@ -149,7 +151,9 @@ allFunctions.knxread = function(groupAddress) {
}
globs.debug("[knxdevice:knxread] preparing knx request for " + groupAddress);

if(!globs.knxd) {
// new knxconnection syntax, might fix #164
if(!(!globs.knxconnection) || globs.knxconnection==='knxjs') {
// use KNX JS for KNX IP
var connection = knx.Connection({
handlers: {
connected: function() {
Expand All @@ -158,6 +162,7 @@ allFunctions.knxread = function(groupAddress) {
}
});
} else {
// use eibd package for KNXD bus access
var knxdConnection = new knxd.Connection();
//globs.info("DEBUG in knxread: created empty connection, trying to connect socket to " + globs.knxd_ip + ":" + globs.knxd_port);
knxdConnection.socketRemote({
Expand Down

0 comments on commit 0b34cd5

Please sign in to comment.