Skip to content

Commit

Permalink
do not try connecting if there are incomplete credentials, fixed #42
Browse files Browse the repository at this point in the history
  • Loading branch information
codmpm committed Feb 7, 2020
1 parent 2ad9c22 commit 4a0d29c
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 114 deletions.
9 changes: 8 additions & 1 deletion loxone/loxone.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ module.exports = function (RED) {
node.encMethod = encMethods[config.enctype];
}

if (!node.credentials.username || !node.credentials.password) {
node.error("missing credentials for " + config.host + ':' + config.port);
return;

}

let client = new node_lox_ws_api(
config.host + ':' + config.port,
node.credentials.username,
Expand All @@ -153,6 +159,7 @@ module.exports = function (RED) {

client.connect();


client.on('connect', function () {
node.log('Miniserver connected (' + config.host + ':' + config.port + ') using ' + node.encMethod);
});
Expand Down Expand Up @@ -245,7 +252,7 @@ module.exports = function (RED) {
}

//add miniserver info
if(node.structureData) {
if (node.structureData) {
msg.msInfo = node.structureData.msInfo;
msg.lastModified = node.structureData.lastModified;
} else {
Expand Down
225 changes: 112 additions & 113 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a0d29c

Please sign in to comment.