node-red-contrib-qsys
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -98,28 +98,32 @@ var net = require('net'); | ||
if (data[i] == 0x0 && data.length != 0) { | ||
let obj = JSON.parse((Buffer.from(rx)).toString()); | ||
if ('method' in obj) { | ||
switch (obj.method) { | ||
case 'EngineStatus': | ||
if (obj.params.State === 'Active') { | ||
this.emit('ready'); | ||
} | ||
else if (isRedundant && obj.params.State === 'Standby') { | ||
this.socket.destroy() | ||
this.socket = net.connect(port, host); | ||
} | ||
break; | ||
case 'ChangeGroup.Poll': | ||
let changes = obj.params.Changes; | ||
if (changes.length !== 0) { | ||
for (let i = 0; i < changes.length; i++) { | ||
this.emit('rx', changes[i]); | ||
try { | ||
let obj = JSON.parse((Buffer.from(rx)).toString()); | ||
if ('method' in obj) { | ||
switch (obj.method) { | ||
case 'EngineStatus': | ||
if (obj.params.State === 'Active') { | ||
this.emit('ready'); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
else if (isRedundant && obj.params.State === 'Standby') { | ||
this.socket.destroy() | ||
this.socket = net.connect(port, host); | ||
} | ||
break; | ||
case 'ChangeGroup.Poll': | ||
let changes = obj.params.Changes; | ||
if (changes.length !== 0) { | ||
for (let i = 0; i < changes.length; i++) { | ||
this.emit('rx', changes[i]); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
rx = []; | ||
} catch (err) { | ||
this.error(err.toString()); | ||
} | ||
rx = []; | ||
} | ||
@@ -126,0 +130,0 @@ else { |
{ | ||
"name": "node-red-contrib-qsys", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A collection of nodes for third party control of Q-Sys systems", | ||
"main": "qsys-core.js", | ||
"directories": { | ||
"example": "examples", | ||
"lib": "lib" | ||
@@ -39,3 +40,4 @@ }, | ||
"node": ">=12.13.0" | ||
} | ||
}, | ||
"devDependencies": {} | ||
} |
@@ -19,2 +19,3 @@ [![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org) | ||
|---------|-------------------------------------------------| | ||
| 1.0.4 | Added error catch before parsing JSON PR#9 | | ||
| 1.0.3 | Added `controlType` to **qsys-controlSet** node | | ||
@@ -21,0 +22,0 @@ | 1.0.2 | Updated dependencies | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
563781
695
80