diff --git a/package.json b/package.json
index 431ebf3..8088f26 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,9 @@
},
{
"name": "Fabio Huser (node-bacstack)"
+ },
+ {
+ "name": "Colin Kuebler (kueblc)"
}
],
"license": "MIT",
diff --git a/src/bacnet-client.html b/src/bacnet-client.html
index 963f69b..9ef1dc6 100644
--- a/src/bacnet-client.html
+++ b/src/bacnet-client.html
@@ -29,11 +29,11 @@
-
+
-
+
diff --git a/src/bacnet-client.js b/src/bacnet-client.js
index ee9d756..4fbb688 100644
--- a/src/bacnet-client.js
+++ b/src/bacnet-client.js
@@ -16,21 +16,15 @@ module.exports = function (RED) {
this.name = config.name
this.adpuTimeout = parseInt(config.adpuTimeout) || 6000
this.port = parseInt(config.port) || 47808
- this.IPAddress = config.IPAddress || '0.0.0.0'
+ this.interface = config.interface || '0.0.0.0'
this.broadcastAddress = config.broadcastAddress || '0.0.0.255'
const node = this
node.devices = []
- if (node.IPAddress) {
- bacnetCore.internalDebugLog('client with IP settings')
- node.client = new BACnet({ adpuTimeout: node.adpuTimeout, port: node.port, interface: node.IPAddress, broadcastAddress: node.broadcastAddress })
- } else {
- bacnetCore.internalDebugLog('client without IP settings')
- node.client = new BACnet({ adpuTimeout: node.adpuTimeout, port: node.port })
- }
+ function setupClient () {
+ node.client = new BACnet({ adpuTimeout: node.adpuTimeout, port: node.port, interface: node.interface, broadcastAddress: node.broadcastAddress })
- if (node.client) {
node.client.on('iAm', (device) => {
node.devices.push(device)
bacnetCore.internalDebugLog('iAm Event')
@@ -52,10 +46,12 @@ module.exports = function (RED) {
node.client.close()
node.client = null
node.devices = []
- node.client = new BACnet({ adpuTimeout: node.adpuTimeout, port: node.port, interface: node.IPAddress, broadcastAddress: node.broadcastAddress })
+ setupClient()
})
}
+ setupClient()
+
node.on('input', function (msg) {
msg.devices = node.devices
node.send(msg)
diff --git a/src/bacnet-read.html b/src/bacnet-read.html
index 13614e1..b343e56 100644
--- a/src/bacnet-read.html
+++ b/src/bacnet-read.html
@@ -13,9 +13,9 @@
defaults: {
name: {value: ''},
objectType: {value: ''},
- instance: {type: "BACnet-Instance", required:true},
+ instance: {type: "BACnet-Instance"},
propertyId: {value: ''},
- device: {type: "BACnet-Device", required:true},
+ device: {type: "BACnet-Device"},
server: {type: "BACnet-Client", required:true},
multipleRead: {value: false}
},
diff --git a/src/bacnet-read.js b/src/bacnet-read.js
index aa0511a..5087078 100644
--- a/src/bacnet-read.js
+++ b/src/bacnet-read.js
@@ -18,11 +18,19 @@ module.exports = function (RED) {
this.propertyId = parseInt(config.propertyId)
this.multipleRead = config.multipleRead
- this.instance = RED.nodes.getNode(config.instance)
- this.objectInstance = parseInt(this.instance.instanceAddress) || 0
-
- this.device = RED.nodes.getNode(config.device)
- this.deviceIPAddress = this.device.deviceAddress || '127.0.0.1'
+ if (config.instance) {
+ this.instance = RED.nodes.getNode(config.instance)
+ this.objectInstance = this.instance.instanceAddress
+ } else {
+ this.objectInstance = 0
+ }
+
+ if (config.device) {
+ this.device = RED.nodes.getNode(config.device)
+ this.deviceIPAddress = this.device.deviceAddress
+ } else {
+ this.deviceIPAddress = '127.0.0.1'
+ }
this.connector = RED.nodes.getNode(config.server)
diff --git a/src/bacnet-write.html b/src/bacnet-write.html
index 125b173..3dadc3a 100644
--- a/src/bacnet-write.html
+++ b/src/bacnet-write.html
@@ -13,12 +13,12 @@
defaults: {
name: {value: ''},
objectType: {value: '', required:true, validate: RED.validators.number()},
- instance: {type: "BACnet-Instance", required:true},
- valueTag: {value: '', required:true, validate: RED.validators.number()},
+ instance: {type: "BACnet-Instance"},
+ valueTag: {value: '', validate: RED.validators.number()},
valueValue: {value: ''},
- propertyId: {value: '', required:true, validate: RED.validators.number()},
+ propertyId: {value: '', validate: RED.validators.number()},
priority: {value: ''},
- device: {type: "BACnet-Device", required:true},
+ device: {type: "BACnet-Device"},
server: {type: "BACnet-Client", required:true},
multipleWrite: {value: false}
},
diff --git a/src/bacnet-write.js b/src/bacnet-write.js
index b682fcc..648b9b7 100644
--- a/src/bacnet-write.js
+++ b/src/bacnet-write.js
@@ -24,11 +24,19 @@ module.exports = function (RED) {
this.multipleWrite = config.multipleWrite
- this.instance = RED.nodes.getNode(config.instance)
- this.objectInstance = parseInt(this.instance.instanceAddress) || 0
+ if (config.instance) {
+ this.instance = RED.nodes.getNode(config.instance)
+ this.objectInstance = this.instance.instanceAddress
+ } else {
+ this.objectInstance = 0
+ }
- this.device = RED.nodes.getNode(config.device)
- this.deviceIPAddress = this.device.deviceAddress || '127.0.0.1' // IPv6 it is :: - but configure Node-RED too
+ if (config.device) {
+ this.device = RED.nodes.getNode(config.device)
+ this.deviceIPAddress = this.device.deviceAddress
+ } else {
+ this.deviceIPAddress = '127.0.0.1'
+ }
this.connector = RED.nodes.getNode(config.server)