Closed mtoko closed 6 years ago
I didn't try this version yet, but there are my suggestions:
please test v0.0.14
Thank you for the response. I have updated to v0.0.14 restarted Node Red and re tested, there is now an error "unknown type". I have also tested with other software to ensure that the fault is not with the SB2WEB24 bacnet device and this software can operate this point. I have tried msg.payload in value and also 0/1 and true/false directly in config,also 8 and 15 in priority. Any advice is appreciated
Tried 0.0.14 yesterday my self and getting same error. Tried for all 6 types.
ANALOG OUTPUT, ANALOG INPUT, ANALOG VALUE.
BINARY OUTPUT, BINARY INPUT, BINARY VALUE
Same error "unknown type"
I have raised the issue on Github bacstack and it appears this issue is fixed in the latest release. I have tested basic examples from Node Bacstack and writemultiple works. Could you update the node red modules and retest. https://github.com/fh1ch/node-bacstack/issues/99
Hi, any update to this?
Hi I have found a "workaround" that works for the hardware I am using. I have added the bacstack dependencies to the settings.js (see `bottom) and then used function nodes. It is untidy but it works This is the example flow [{"id":"15d5e7ae.0b9148","type":"function","z":"d0970a11.9662b8","name":"Boiler 1","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 0}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":280,"y":60,"wires":[[]]},{"id":"27f92a04.56b936","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":40,"wires":[["15d5e7ae.0b9148"]]},{"id":"7f877b3.3445c84","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["15d5e7ae.0b9148"]]},{"id":"f40377fd.dd75f8","type":"function","z":"d0970a11.9662b8","name":"Boiler 2","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 1}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":280,"y":180,"wires":[[]]},{"id":"7aa2b124.d3db","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":160,"wires":[["f40377fd.dd75f8"]]},{"id":"be93d9b0.4de308","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["f40377fd.dd75f8"]]},{"id":"2b65c434.8ee3ec","type":"function","z":"d0970a11.9662b8","name":"Analogue 1","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 0}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":467,"y":61,"wires":[[]]},{"id":"75607c38.ac6404","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":292,"y":24,"wires":[["2b65c434.8ee3ec"]]},{"id":"dc7a52e9.efd78","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":287,"y":100,"wires":[["2b65c434.8ee3ec"]]},{"id":"11fb3606.4d6c7a","type":"function","z":"d0970a11.9662b8","name":"Boiler 3","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 2}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":284,"y":291,"wires":[[]]},{"id":"b1d62ce7.c4434","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":260,"wires":[["11fb3606.4d6c7a"]]},{"id":"212d8c97.fa9ee4","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":300,"wires":[["11fb3606.4d6c7a"]]},{"id":"cd813c35.41c17","type":"function","z":"d0970a11.9662b8","name":"Boiler 4","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 3}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":280,"y":360,"wires":[[]]},{"id":"c9f1d2bf.e935d","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["cd813c35.41c17"]]},{"id":"8f64972e.6ae098","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":380,"wires":[["cd813c35.41c17"]]},{"id":"4ef5aaf0.92a8e4","type":"function","z":"d0970a11.9662b8","name":"Boiler 5","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 4}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":280,"y":440,"wires":[[]]},{"id":"c3863c40.8f205","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":420,"wires":[["4ef5aaf0.92a8e4"]]},{"id":"ddee3441.835ef8","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":460,"wires":[["4ef5aaf0.92a8e4"]]},{"id":"bc8cf13e.f5194","type":"function","z":"d0970a11.9662b8","name":"Boiler 6","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 5}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":280,"y":520,"wires":[[]]},{"id":"9489f179.b2f2a","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":500,"wires":[["bc8cf13e.f5194"]]},{"id":"80b506a.08ddcf8","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":540,"wires":[["bc8cf13e.f5194"]]},{"id":"11758318.19362d","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"8.2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":286,"y":140,"wires":[["202850e7.21513"]]},{"id":"c79384bd.06bdd8","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":289,"y":219,"wires":[["202850e7.21513"]]},{"id":"202850e7.21513","type":"function","z":"d0970a11.9662b8","name":"Analogue 2","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 1}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":476,"y":177,"wires":[[]]},{"id":"3a9d3099.c845b","type":"function","z":"d0970a11.9662b8","name":"Analogue 3","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 2}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":484,"y":284,"wires":[[]]},{"id":"971ea5c7.8c0af8","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"8.2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":286,"y":254,"wires":[["3a9d3099.c845b"]]},{"id":"8a99a4ee.efb818","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":325,"wires":[["3a9d3099.c845b"]]},{"id":"80cc3e75.4dc4c","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"8.2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":289,"y":399,"wires":[["a576534f.8e20e"]]},{"id":"ef0eac12.cbebd","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":286,"y":477,"wires":[["a576534f.8e20e"]]},{"id":"a576534f.8e20e","type":"function","z":"d0970a11.9662b8","name":"Analogue 4","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 3}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":475,"y":368,"wires":[[]]},{"id":"ef566857.021028","type":"function","z":"d0970a11.9662b8","name":"Analogue 5","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 4}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":480,"y":447,"wires":[[]]},{"id":"fb3d2b91.ff6d88","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"8.2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":288,"y":559,"wires":[["ef566857.021028"]]},{"id":"93594f0d.1e291","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":288,"y":600,"wires":[["ef566857.021028"]]},{"id":"a1291bf2.db1af8","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"8.2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":291,"y":645,"wires":[["f681da4d.132e08"]]},{"id":"3fa05726.ff0778","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":687,"wires":[["f681da4d.132e08"]]},{"id":"f681da4d.132e08","type":"function","z":"d0970a11.9662b8","name":"Analogue 6","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 1, instance: 5}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_REAL, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 1, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":475,"y":539,"wires":[[]]},{"id":"2ed8233c.85b35c","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler1 Temp","objectType":"0","objectInstance":"9","propertyId":"85","arrayIndex":"4294967295","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":668,"y":114,"wires":[["e04f9eca.e7aef"]]},{"id":"5b501d8e.4b2514","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":477,"y":114,"wires":[["2ed8233c.85b35c"]]},{"id":"e04f9eca.e7aef","type":"change","z":"d0970a11.9662b8","name":"Boiler 1 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":849,"y":112,"wires":[["3cc735e3.c42faa"]]},{"id":"3cc735e3.c42faa","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":120,"wires":[]},{"id":"d9391972.996318","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":465,"y":225,"wires":[["dfec504f.be75d"]]},{"id":"dfec504f.be75d","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler2 Temp","objectType":"0","objectInstance":"10","propertyId":"85","arrayIndex":"","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":656,"y":225,"wires":[["7a329f9.6d5066"]]},{"id":"7a329f9.6d5066","type":"change","z":"d0970a11.9662b8","name":"Boiler 2 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":837,"y":223,"wires":[["9a31370a.241c98"]]},{"id":"9a31370a.241c98","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":220,"wires":[]},{"id":"9719a00b.25475","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":472,"y":327,"wires":[["70d47e63.4aa15"]]},{"id":"70d47e63.4aa15","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler3 Temp","objectType":"0","objectInstance":"12","propertyId":"85","arrayIndex":"","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":658,"y":327,"wires":[["ffa78c3d.2f0fb"]]},{"id":"ffa78c3d.2f0fb","type":"change","z":"d0970a11.9662b8","name":"Boiler 3 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":853,"y":327,"wires":[["9ea1afd9.072a8"]]},{"id":"9ea1afd9.072a8","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":320,"wires":[]},{"id":"a69662e8.ea82f","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":475,"y":409,"wires":[["30cd18d0.7303d8"]]},{"id":"30cd18d0.7303d8","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler4 Temp","objectType":"0","objectInstance":"13","propertyId":"85","arrayIndex":"","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":655,"y":410,"wires":[["7566d974.551538"]]},{"id":"7566d974.551538","type":"change","z":"d0970a11.9662b8","name":"Boiler 4 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":411,"wires":[["40635e2b.32f04"]]},{"id":"40635e2b.32f04","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":420,"wires":[]},{"id":"a2d0c1b.807d94","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":479,"y":480,"wires":[["23f22f90.cb2d7"]]},{"id":"23f22f90.cb2d7","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler5 Temp","objectType":"0","objectInstance":"18","propertyId":"85","arrayIndex":"","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":661,"y":479,"wires":[["178ee65e.cda61a"]]},{"id":"178ee65e.cda61a","type":"change","z":"d0970a11.9662b8","name":"Boiler 5 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":856,"y":476,"wires":[["aef6d27e.dbc62"]]},{"id":"aef6d27e.dbc62","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":480,"wires":[]},{"id":"37129ba6.016984","type":"inject","z":"d0970a11.9662b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":486,"y":588,"wires":[["3a4af08b.4740a"]]},{"id":"3a4af08b.4740a","type":"BACnet-Read","z":"d0970a11.9662b8","name":"Boiler6 Temp","objectType":"0","objectInstance":"19","propertyId":"85","arrayIndex":"","deviceIPAddress":"192.168.1.135","server":"89bad991.cc9dd8","multipleRead":false,"x":662,"y":586,"wires":[["f6e56922.5ec2b8"]]},{"id":"f6e56922.5ec2b8","type":"change","z":"d0970a11.9662b8","name":"Boiler 6 Temp","rules":[{"t":"move","p":"payload.values.0.value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":580,"wires":[["c507ee20.bf069"]]},{"id":"c507ee20.bf069","type":"debug","z":"d0970a11.9662b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1030,"y":580,"wires":[]},{"id":"89bad991.cc9dd8","type":"BACnet-Client","z":"","name":"","adpuTimeout":"3000","port":"47808","interface":"192.168.1.132","broadcastAddress":"192.168.1.255"}]
Thanks, sure does work. Instead of using the bacnet node, you are using the function requesting the bacstack and doing what the bacnet node would be doing except bacnet node isn't working. Function node works fine. I will do additional testing, but looks good.
Sounds like all that needs to happen is @biancode would need to update the bacstack library and all would work.
@triDcontrols 0.0.1-beta.13 is the lastest - did I miss some? @mtoko what about contributing to the package with your experinces from your functions source code?
@biancode Apologies, I don't think I have the skills or experience yet to make a contribution, I still have much to learn but this has been good experience. Thank you for all your work, I have used your modbus node on many occasions and the bacnet node would be very useful. I am also monitoring the development of OPC UA
@mtoko I could help you to get more skills to help in development of that package if you want ;)
That is what you have defined in your code of the boiler 1 read
and the write - use msg.payload.values to send the values like [{type:9, value:xyz}]
maybe you have to set the client interface and broadcast etc.
you have access to all via msg.payload like
let options = msg.payload.options || {}
write property:
msg.payload.deviceIPAddress || node.deviceIPAddress,
msg.payload.objectId || objectId,
msg.payload.propertyId || node.propertyId,
msg.payload.values || defaultValues,
write multiple properties:
msg.payload.deviceIPAddress || node.deviceIPAddress,
msg.payload.values || defaultValues,
readProperty:
msg.payload.deviceIPAddress || node.deviceIPAddress,
msg.payload.objectId || objectId,
msg.payload.propertyId || node.propertyId,
readPropertyMultiple:
msg.payload.deviceIPAddress || node.deviceIPAddress,
msg.payload.requestArray || defaultRequestArray,
please test it with v0.0.17
functions like these gets also TIMEOUT ERROR - just send the msg from the response and do not return msg at the end of function
const bacnet1 = global.get('bacnet');
var client = bacnet1({adpuTimeout: 6000});
client.readProperty('192.168.1.22', {type: 4, instance: 3342490}, 85, {}, (err, value) => {
if(err) {
node.error(err, msg)
}
msg.payload = {value: value} ;
node.send(msg);
})
Thank you for all the assistance
I have tested with v0.0.17 on two different Node Red hardware but error is "unknown type" (see screenshot). I am working to understand where the problem is.
The read node still works and the "hard coded" function node to write also works
remove msg.payload from Value and set it to 1 or 0 msg.payload is wrong here and next try to set msg.payload.values with a function node before and remove all from Value in node
if you set Value and App-Tag it is set to this:
let defaultValues = [{
tag: node.valueTag,
value: node.valueValue
}]
please read API Docs - maybe you use a old version of bacstack from npm global
ah I see - tag from API Dosc is type :
value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}]
I did see that tag/type on line 93 of write.js. I changed this on my local write.js to type but it did not fix the problem
and when you try some like taht - does it work for you with backstack 13-beta?
[
{
"id": "d60cced6.cc4198",
"type": "function",
"z": "3345fb9d.6eee74",
"name": "Boiler",
"func": "const BACnet = global.get('bacnet');\nconst client = new BACnet();\nclient.readProperty('192.168.1.22', {type: 8, instance: 12345}, 77, (err, value) => {\n if(err) {\n node.error(err, msg)\n }\n \n msg.payload = {value: value, error: err} ;\n node.send(msg);\n})\n\n\nconst requestArray = [\n {objectId: {type: 8, instance: 12345}, properties: [{id: 8}, {id: 77}]},\n {objectId: {type: 8, instance: 3342490}, properties: [{id: 85}, {id: 8}]}\n];\nclient.readPropertyMultiple('192.168.1.22', requestArray, (err, value) => {\n if(err) {\n node.error(err, msg)\n }\n \n msg.payload = {value: value, error: err} ;\n node.send(msg);\n});",
"outputs": 1,
"noerr": 0,
"x": 350,
"y": 60,
"wires": [
[
"a398b63a.9ebde"
]
]
},
{
"id": "b29fecfb.5934a",
"type": "inject",
"z": "3345fb9d.6eee74",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 220,
"y": 60,
"wires": [
[
"d60cced6.cc4198"
]
]
},
{
"id": "a398b63a.9ebde",
"type": "debug",
"z": "3345fb9d.6eee74",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 470,
"y": 60,
"wires": []
}
]
Weaher2 and Room Simulator of Yabe BACnet - does not work on 13.beta
[{"id":"d60cced6.cc4198","type":"function","z":"3345fb9d.6eee74","name":"Yabe Room Simulator and Weather2","func":"const BACnet = global.get('bacnet');\nconst client = new BACnet();\n\n// discover devices\nclient.on('iAm', function(device) {\n const msg = { payload: {\n \"address\": device.address,\n \"deviceId\": device.deviceId,\n \"maxAdpu\": device.maxAdpu,\n \"segmentation\": device.segmentation,\n \"vendorId\": device.vendorId\n }\n }\n node.send(msg);\n});\n\nclient.whoIs();\n \n// Read Device Object\nvar requestArray = [{\n objectId: {type: 8, instance: 12345},\n properties: [{id: 8}]\n}];\nclient.readPropertyMultiple('192.168.1.22', requestArray, function(err, value) {\n if(err) {\n node.error(err, msg)\n }\n \n msg.payload = {value: value, error: err} ;\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.22', {type: 8, instance: 12345}, 77, (err, value) => {\n if(err) {\n node.error(err, msg)\n }\n \n msg.payload = {value: value, error: err} ;\n node.send(msg);\n})\n\n\nrequestArray = [\n {objectId: {type: 8, instance: 12345}, properties: [{id: 8}, {id: 77}]},\n {objectId: {type: 8, instance: 3342490}, properties: [{id: 85}, {id: 8}]}\n];\nclient.readPropertyMultiple('192.168.1.22', requestArray, (err, value) => {\n if(err) {\n node.error(err, msg)\n }\n \n msg.payload = {value: value, error: err} ;\n node.send(msg);\n});","outputs":1,"noerr":0,"x":470,"y":60,"wires":[["a398b63a.9ebde"]]},{"id":"b29fecfb.5934a","type":"inject","z":"3345fb9d.6eee74","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":60,"wires":[["d60cced6.cc4198"]]},{"id":"a398b63a.9ebde","type":"debug","z":"3345fb9d.6eee74","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":730,"y":60,"wires":[]}]
The flow above with the function node works, but it should do because it is a read and there are no problems with read. The Yabe flow has problems in the function node, I think the problem is BOOLEAN and value of 100? I have only got ENUMERATED to work. See this working write flow
[{"id":"23988557.fae66a","type":"inject","z":"143b8cb5.c27573","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":100,"wires":[["58d0ace5.2d73f4"]]},{"id":"ed31364a.5ad958","type":"inject","z":"143b8cb5.c27573","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":160,"wires":[["58d0ace5.2d73f4"]]},{"id":"58d0ace5.2d73f4","type":"function","z":"143b8cb5.c27573","name":"Boiler 1","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\nvar state = msg.payload;\n\nconst values = [\n {objectId: {type: 4, instance: 0}, values: [\n {property: {id: 85, index: 4294967295}, value: [{type: bacnet1.enum.ApplicationTags.BACNET_APPLICATION_TAG_ENUMERATED, value: state}], priority: 15}\n ]}\n];\nclient.writePropertyMultiple('192.168.1.135', values, (err, value) => {\n msg.payload = {value: value} ;\n \n if(err) { msg.payload = {error: err} ; }\n node.send(msg);\n});\n\nclient.readProperty('192.168.1.135', {type: 4, instance: 0}, 85, (err, value) => {\n msg.payload = {value: value} ;\n node.send(msg);\n})\n\n","outputs":1,"noerr":0,"x":440,"y":120,"wires":[[]]}]
v0.0.18 is now type and not tag for write
Upgrade to v0.0.18 error is still unknown type
Sorry Could you share an example of function node in earlier mesage set msg.payload.values with a function node
I have tried the flow below and get this bacnet error. I have used values from previous working function node. The client is correct because the reads are still working
Flow
[{"id":"e74b4da5.ee62f","type":"inject","z":"70e6f53f.47c17c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":100,"wires":[["a94a766d.a10d18"]]},{"id":"ee1854cb.e0b6e8","type":"inject","z":"70e6f53f.47c17c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":160,"wires":[["7d33a68e.a4bc58"]]},{"id":"8d99ef57.02049","type":"BACnet-Write","z":"70e6f53f.47c17c","name":"","deviceIPAddress":"192.168.1.135","objectType":"","objectInstance":"","valueTag":"","valueValue":"","propertyId":"85","arrayIndex":"4294967295","server":"28e8a4b2.188ccc","multipleWrite":false,"x":680,"y":140,"wires":[[]]},{"id":"a94a766d.a10d18","type":"function","z":"70e6f53f.47c17c","name":"","func":"msg.payload.values = [\n {\n \"objectId\": { type: 4, instance:0 },\n \"values\": [\n {\n \"property\": {id: 85, index: 4294967295},\n \"value\": [{type: 9, value: 0}],\n \"priority\": 15\n \n }\n ]\n \n }\n\n ];\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":100,"wires":[["8d99ef57.02049"]]},{"id":"7d33a68e.a4bc58","type":"function","z":"70e6f53f.47c17c","name":"","func":"msg.payload.values = [\n {\n \"objectId\": { type: 4, instance:0 },\n \"values\": [\n {\n \"property\": {id: 85, index: 4294967295},\n \"value\": [{type: 9, value: 1}],\n \"priority\": 15\n \n }\n ]\n \n }\n\n ];\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":160,"wires":[["8d99ef57.02049"]]},{"id":"28e8a4b2.188ccc","type":"BACnet-Client","z":"","name":"","adpuTimeout":"3000","port":"47808","interface":"192.168.1.132","broadcastAddress":"192.168.1.255"}]
property - invalidDataType
hi, has there been any progress made? or still in the same boat?
The library developer is working on his lib but no updates for now :(
@fh1ch could you tell us more, please?
Hi Thanks for the great work. The read is working fine but cannot get write to work correctly. Please see screenshots and error. Any advice is appreciated
![yabe](https://user-images.githubusercontent.com/4711179/36383837-5085d552-1585-11e8-970e-0b75ba981c6b.jpg)