node-red-contrib-sia-ultimate
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -11,2 +11,6 @@ # node-red-contrib-sia-ultimate | ||
<p> | ||
<b>Version 0.0.4 BETA</b> - September 2021<br/> | ||
- You can now add a list of your device names, based on device ID.<br/> | ||
</p> | ||
<p> | ||
<b>Version 0.0.3 BETA</b><br/> | ||
@@ -13,0 +17,0 @@ - Added device ID that fired the message, into the payload object.<br/> |
@@ -25,2 +25,3 @@ | ||
node.timerHeartBeat = null; | ||
node.deviceList = config.deviceList || ""; // Contains the coupe ID,DeviceName (for example 4,PIR Badroom). One Device per row. | ||
@@ -758,3 +759,3 @@ RED.log.info("siaendpointConfig: siaendpointConfig: Account: " + node.credentials.accountnumber + ", AES:" + node.aes + ", HEX:" + node.hex); | ||
}) | ||
node.setAllClientsStatus({ fill: "red", shape: "dot", text: "Timeout waiting for a message withing " + node.heartbeatTimeout + " seconds."}); | ||
node.setAllClientsStatus({ fill: "red", shape: "dot", text: "Timeout waiting for a message withing " + node.heartbeatTimeout + " seconds." }); | ||
}, node.heartbeatTimeout * 1000); | ||
@@ -761,0 +762,0 @@ } |
@@ -11,3 +11,17 @@ const siaendpointConfig = require("./siaendpoint-config"); | ||
node.discardAutomaticTest = config.discardAutomaticTest === "yes" ? true : false; | ||
node.deviceList = []; // { id: "5", devicename: "PIR Soggiorno" } | ||
// Contains the coupe ID,DeviceName (for example 4,PIR Badroom). One Device per row. | ||
try { | ||
if (node.server.deviceList.trim() !== "") { | ||
let sRows = node.server.deviceList.split("\n"); | ||
for (let index = 0; index < sRows.length; index++) { | ||
const element = sRows[index]; | ||
node.deviceList.push({ id: element.split(",")[0].toString(), devicename: element.split(",")[1].toString() }); | ||
} | ||
} | ||
} catch (error) { | ||
} | ||
node.setNodeStatus = ({ fill, shape, text }) => { | ||
@@ -37,9 +51,17 @@ var dDate = new Date(); | ||
let sDeviceID = ""; | ||
let sDeviceName = ""; | ||
try { | ||
if (_msg.decoded.data_message.toString().includes("|")) { | ||
sCode = _msg.decoded.data_message.toString().split("|")[1]; | ||
sCode = sCode.split("\/")[1]; | ||
sDeviceID = sCode.substring(2); | ||
sCode = sCode.substring(0, 2); | ||
sDescription = node.server.SIACodes.find(a => a.code === sCode).description || "Unknown"; | ||
if (sCode.includes("\/")) { | ||
sCode = sCode.split("\/")[1]; | ||
sDeviceID = sCode.substring(2); | ||
sCode = sCode.substring(0, 2); | ||
sDescription = node.server.SIACodes.find(a => a.code === sCode).description || "Unknown"; | ||
try { | ||
sDeviceName = node.deviceList.find(a => a.id.toString() === sDeviceID).devicename; | ||
} catch (error) { | ||
} | ||
} | ||
} | ||
@@ -54,3 +76,3 @@ } catch (error) { | ||
_msg.payload = { deviceID: sDeviceID, code: sCode, description: sDescription }; | ||
_msg.payload = { deviceName: sDeviceName, deviceID: sDeviceID, code: sCode, description: sDescription }; | ||
node.setNodeStatus({ fill: "green", shape: "dot", text: "Received " + _msg.decoded.data_message }); | ||
@@ -57,0 +79,0 @@ node.send([_msg, null]); |
{ | ||
"name": "node-red-contrib-sia-ultimate", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Connect your SIA-DCS compatible alarm system to node-red. It works with Ajax System too.", | ||
@@ -5,0 +5,0 @@ "author": "Supergiovane (https://github.com/Supergiovane)", |
# node-red-contrib-sia-ultimate | ||
<img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-sia-ultimate/master/img/main.png" width="80%"><br/> | ||
Connect your SIA-DCS compatible alarm system to node-red. | ||
@@ -56,2 +54,20 @@ | ||
<img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-sia-ultimate/master/img/main.png" width="80%"><br/> | ||
In this example, the node retrieves all messages from the SIA client. You'll see that the device list (in the server configuration window), is also filled with some devicenames/id samples. | ||
**Copy this code and paste it into your flow** | ||
<details><summary>View code</summary> | ||
> Adjust the nodes according to your setup | ||
<code> | ||
[{"id":"90f04fe351adfd9b","type":"debug","z":"4e8eb9b80650f523","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":120,"wires":[]},{"id":"2fc45b7cddeb3150","type":"SIAUltimate","z":"4e8eb9b80650f523","name":"","topic":"Banano","server":"bea9e0c70f4e12c6","discardAutomaticTest":"no","x":200,"y":140,"wires":[["90f04fe351adfd9b"],["30898bf6227f9439"]]},{"id":"30898bf6227f9439","type":"debug","z":"4e8eb9b80650f523","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":160,"wires":[]},{"id":"169dd9a9fdde7c6c","type":"comment","z":"4e8eb9b80650f523","name":"SIA-DCS Messages receiver","info":"","x":240,"y":100,"wires":[]},{"id":"bea9e0c70f4e12c6","type":"siaendpoint-config","port":"4628","name":"Server","acktimeout":"12","hex":"no","aes":"no","heartbeatTimeout":"120","deviceList":"0000,Alarm Panel\n1,PIR Bedrom\n2,Microwave Front Door\n4,PIR Soggiorno","credentials":{}}] | ||
</code> | ||
</details> | ||
<br/> | ||
<br/> | ||
## CONFIGURATION | ||
@@ -69,2 +85,7 @@ | ||
* **Emit error if no messages arrive within seconds**: if a message is not received during this interval (in seconds), the node will emit an error on PIN 2. This is useful for monitoring the connection to your alarm panel (Default 120 seconds) | ||
* **Device List**: You can import your own list of device names and device ids. The node will emit the device name based on device ID in the SIA message. For example: | ||
- 0000,Alarm Panel | ||
- 1,PIR Bedrom | ||
- 2,Microwave Front Door | ||
- 4,PIR Soggiorno | ||
@@ -112,2 +133,3 @@ <br/> | ||
"payload":{ // This contains the message decoded | ||
"deviceName": "PIR Badroom", // The device name is taken from the list you filled in the server configuration node | ||
"deviceID": "4", // Device ID that fired the event | ||
@@ -114,0 +136,0 @@ "code":"RP", |
Sorry, the diff of this file is not supported yet
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
116687
925
166