node-red-contrib-bacnet
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -1,2 +0,2 @@ | ||
"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=parseInt(e.priority)||15,this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){var e=a.payload.options||{};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTags,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})}; | ||
"use strict";function _createForOfIteratorHelper(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(l)throw o}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}module.exports=function(r){var o=require("./core/bacnet-core"),l=require("node-bacnet"),s=require("underscore");r.nodes.registerType("BACnet-Write",function(e){r.nodes.createNode(this,e),this.name=e.name,this.objectType=parseInt(e.objectType),this.valueTag=parseInt(e.valueTag),this.valueValue=e.valueValue,this.propertyId=parseInt(e.propertyId),this.priority=parseInt(e.priority)||15,this.multipleWrite=e.multipleWrite,this.instance=r.nodes.getNode(e.instance),this.objectInstance=this.instance.instanceAddress||0,this.device=r.nodes.getNode(e.device),this.deviceIPAddress=this.device.deviceAddress||"127.0.0.1",this.connector=r.nodes.getNode(e.server);var n=this;n.status({fill:"green",shape:"dot",text:"active"}),n.on("input",function(a){if(n.connector){var e=a.payload.options||{};if(n.multipleWrite){if(o.internalDebugLog("Multiple Write"),!a.payload.values||!a.payload.values[0].values)return void n.error(new Error("msg.payload.values missing or invalid array for multiple write"),a);a.payload.values.forEach(function(e){e.objectId||(e.objectId={type:n.objectType,instance:parseInt(n.objectInstance)})});try{o.internalDebugLog("writePropertyMultiple msg.payload.values: "+JSON.stringify(a.payload.values))}catch(e){o.internalDebugLog("writePropertyMultiple error: "+e)}n.connector.client.writePropertyMultiple(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.values,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}else{if(o.internalDebugLog("Write"),a.payload.values&&!a.payload.values[0])return void n.error(new Error("invalid msg.payload.values array for write"),a);var r={type:n.objectType,instance:parseInt(n.objectInstance)},t=[{type:n.valueTag,value:n.valueValue}];try{o.internalDebugLog("readProperty default objectId: "+JSON.stringify(r)),o.internalDebugLog("writeProperty default values: "+JSON.stringify(t)),o.internalDebugLog("writeProperty msg.payload.values: "+JSON.stringify(a.payload.values)),o.internalDebugLog("writeProperty node.propertyId: "+n.propertyId)}catch(e){o.internalDebugLog("writeProperty error: "+e)}n.connector.client.writeProperty(a.payload.deviceIPAddress||n.deviceIPAddress,a.payload.objectId||r,a.payload.propertyId||n.propertyId,a.payload.values||t,e,function(e,r){var t;e?(t=o.translateErrorMessage(e),o.internalDebugLog(t),n.error(t,a)):(a.input=a.payload,a.payload=r,n.send(a))})}}else n.error(new Error("Client Not Ready To Write"),a)})}),r.httpAdmin.get("/bacnet/ApplicationTags",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ApplicationTag,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/PropertyIds",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.PropertyIdentifier,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)}),r.httpAdmin.get("/bacnet/ObjectTypes",r.auth.needsPermission("bacnet.CMD.write"),function(e,r){var t,a,n=l.enum.ObjectType,o=[],i=_createForOfIteratorHelper(s.toArray(s.invert(n)));try{for(i.s();!(a=i.n()).done;)t=a.value,o.push({typeValue:n[t],label:t})}catch(e){i.e(e)}finally{i.f()}r.json(o)})}; | ||
//# sourceMappingURL=maps/bacnet-write.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function _createForOfIteratorHelper(e,r){var o;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){o&&(e=o);var a=0,t=function(){};return{s:t,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,c=!0,i=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return c=e.done,e},e:function(e){i=!0,n=e},f:function(){try{c||null==o.return||o.return()}finally{if(i)throw n}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var o=0,a=new Array(r);o<r;o++)a[o]=e[o];return a}var de=de||{biancoroyal:{bacnet:{core:{}}}};de.biancoroyal.bacnet.core.internalDebugLog=de.biancoroyal.bacnet.core.internalDebugLog||require("debug")("bacnet:core"),de.biancoroyal.bacnet.core.detailDebugLog=de.biancoroyal.bacnet.core.detailDebugLog||require("debug")("bacnet:core:details"),de.biancoroyal.bacnet.core.specialDebugLog=de.biancoroyal.bacnet.core.specialDebugLog||require("debug")("bacnet:core:special"),de.biancoroyal.bacnet.core.errorCodeList=de.biancoroyal.bacnet.core.errorCodeList||[],de.biancoroyal.bacnet.core.errorClassList=de.biancoroyal.bacnet.core.errorClassList||[],de.biancoroyal.bacnet.core.initCodeLists=function(){var e,r=require("node-bacnet"),o=require("underscore"),a=r.enum.ErrorCode,t=o.toArray(o.invert(a));de.biancoroyal.bacnet.core.errorCodeList=[];var n,c=_createForOfIteratorHelper(t);try{for(c.s();!(n=c.n()).done;)e=n.value,de.biancoroyal.bacnet.core.errorCodeList.push({typeValue:a[e],label:e})}catch(e){c.e(e)}finally{c.f()}o.sortBy(de.biancoroyal.bacnet.core.errorCodeList,"typeValue");var i,l=r.enum.ErrorClass,b=o.toArray(o.invert(l));de.biancoroyal.bacnet.core.errorClassList=[];var s,d=_createForOfIteratorHelper(b);try{for(d.s();!(s=d.n()).done;)i=s.value,de.biancoroyal.bacnet.core.errorClassList.push({typeValue:l[i],label:i})}catch(e){d.e(e)}finally{d.f()}o.sortBy(de.biancoroyal.bacnet.core.errorClassList,"typeValue"),de.biancoroyal.bacnet.core.internalDebugLog("List init done with "+de.biancoroyal.bacnet.core.errorClassList.length+" class errors and "+de.biancoroyal.bacnet.core.errorCodeList.length+" code errors")},de.biancoroyal.bacnet.core.translateErrorMessage=function(e){var r,o,a=e.message,t=a.split("-");return 3===t.length&&(r=t[1].split(":"),o=t[2].split(":"),de.biancoroyal.bacnet.core.internalDebugLog(r),de.biancoroyal.bacnet.core.internalDebugLog(o),r[1]=de.biancoroyal.bacnet.core.errorClassToString(r[1]),o[1]=de.biancoroyal.bacnet.core.errorCodeToString(o[1]),e.message=a+" "+r.join(":")+" "+o.join(":")),e},de.biancoroyal.bacnet.core.errorCodeToString=function(e){var r,o;de.biancoroyal.bacnet.core.errorCodeList.length<1&&de.biancoroyal.bacnet.core.initCodeLists();var a,t=_createForOfIteratorHelper(de.biancoroyal.bacnet.core.errorCodeList);try{for(t.s();!(a=t.n()).done;)r=a.value,parseInt(r.typeValue)===parseInt(e)&&(de.biancoroyal.bacnet.core.detailDebugLog(r.typeValue+" --\x3e "+r.label),o=r)}catch(e){t.e(e)}finally{t.f()}return o?o.label:e},de.biancoroyal.bacnet.core.errorClassToString=function(e){var r,o;de.biancoroyal.bacnet.core.errorClassList.length<1&&de.biancoroyal.bacnet.core.initCodeLists();var a,t=_createForOfIteratorHelper(de.biancoroyal.bacnet.core.errorClassList);try{for(t.s();!(a=t.n()).done;)r=a.value,parseInt(r.typeValue)===parseInt(e)&&(de.biancoroyal.bacnet.core.detailDebugLog(r.typeValue+" --\x3e "+r.label),o=r)}catch(e){t.e(e)}finally{t.f()}return o?o.label:e},module.exports=de.biancoroyal.bacnet.core; | ||
"use strict";function _createForOfIteratorHelper(e,r){var o;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||r&&e&&"number"==typeof e.length){o&&(e=o);var a=0,t=function(){};return{s:t,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,c=!0,i=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return c=e.done,e},e:function(e){i=!0,n=e},f:function(){try{c||null==o.return||o.return()}finally{if(i)throw n}}}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var o=0,a=new Array(r);o<r;o++)a[o]=e[o];return a}var de=de||{biancoroyal:{bacnet:{core:{}}}};de.biancoroyal.bacnet.core.internalDebugLog=de.biancoroyal.bacnet.core.internalDebugLog||require("debug")("bacnet:nodered:core"),de.biancoroyal.bacnet.core.detailDebugLog=de.biancoroyal.bacnet.core.detailDebugLog||require("debug")("bacnet:nodered:core:details"),de.biancoroyal.bacnet.core.specialDebugLog=de.biancoroyal.bacnet.core.specialDebugLog||require("debug")("bacnet:nodered:core:special"),de.biancoroyal.bacnet.core.errorCodeList=de.biancoroyal.bacnet.core.errorCodeList||[],de.biancoroyal.bacnet.core.errorClassList=de.biancoroyal.bacnet.core.errorClassList||[],de.biancoroyal.bacnet.core.initCodeLists=function(){var e,r=require("node-bacnet"),o=require("underscore"),a=r.enum.ErrorCode,t=o.toArray(o.invert(a));de.biancoroyal.bacnet.core.errorCodeList=[];var n,c=_createForOfIteratorHelper(t);try{for(c.s();!(n=c.n()).done;)e=n.value,de.biancoroyal.bacnet.core.errorCodeList.push({typeValue:a[e],label:e})}catch(e){c.e(e)}finally{c.f()}o.sortBy(de.biancoroyal.bacnet.core.errorCodeList,"typeValue");var i,l=r.enum.ErrorClass,b=o.toArray(o.invert(l));de.biancoroyal.bacnet.core.errorClassList=[];var s,d=_createForOfIteratorHelper(b);try{for(d.s();!(s=d.n()).done;)i=s.value,de.biancoroyal.bacnet.core.errorClassList.push({typeValue:l[i],label:i})}catch(e){d.e(e)}finally{d.f()}o.sortBy(de.biancoroyal.bacnet.core.errorClassList,"typeValue"),de.biancoroyal.bacnet.core.internalDebugLog("List init done with "+de.biancoroyal.bacnet.core.errorClassList.length+" class errors and "+de.biancoroyal.bacnet.core.errorCodeList.length+" code errors")},de.biancoroyal.bacnet.core.translateErrorMessage=function(e){var r,o,a=e.message,t=a.split("-");return 3===t.length&&(r=t[1].split(":"),o=t[2].split(":"),de.biancoroyal.bacnet.core.internalDebugLog(r),de.biancoroyal.bacnet.core.internalDebugLog(o),r[1]=de.biancoroyal.bacnet.core.errorClassToString(r[1]),o[1]=de.biancoroyal.bacnet.core.errorCodeToString(o[1]),e.message=a+" "+r.join(":")+" "+o.join(":")),e},de.biancoroyal.bacnet.core.errorCodeToString=function(e){var r,o;de.biancoroyal.bacnet.core.errorCodeList.length<1&&de.biancoroyal.bacnet.core.initCodeLists();var a,t=_createForOfIteratorHelper(de.biancoroyal.bacnet.core.errorCodeList);try{for(t.s();!(a=t.n()).done;)r=a.value,parseInt(r.typeValue)===parseInt(e)&&(de.biancoroyal.bacnet.core.detailDebugLog(r.typeValue+" --\x3e "+r.label),o=r)}catch(e){t.e(e)}finally{t.f()}return o?o.label:e},de.biancoroyal.bacnet.core.errorClassToString=function(e){var r,o;de.biancoroyal.bacnet.core.errorClassList.length<1&&de.biancoroyal.bacnet.core.initCodeLists();var a,t=_createForOfIteratorHelper(de.biancoroyal.bacnet.core.errorClassList);try{for(t.s();!(a=t.n()).done;)r=a.value,parseInt(r.typeValue)===parseInt(e)&&(de.biancoroyal.bacnet.core.detailDebugLog(r.typeValue+" --\x3e "+r.label),o=r)}catch(e){t.e(e)}finally{t.f()}return o?o.label:e},module.exports=de.biancoroyal.bacnet.core; | ||
//# sourceMappingURL=../maps/core/bacnet-core.js.map |
@@ -1,2 +0,2 @@ | ||
## [0.2.1](https://github.com/BiancoRoyal/node-red-contrib-bacnet/compare/v0.2.0-beta.1...v0.2.1) (2020-06-03) | ||
## [0.2.2](https://github.com/BiancoRoyal/node-red-contrib-bacnet/compare/v0.2.0-beta.1...v0.2.2) (2020-06-03) | ||
@@ -8,2 +8,3 @@ | ||
* **lib:** update to node-bacnet ([d1e07e1](https://github.com/BiancoRoyal/node-red-contrib-bacnet/commit/d1e07e16decf3069d8a9823324a68ed3651e69b1)) | ||
* **write:** enum typo ([79d9979](https://github.com/BiancoRoyal/node-red-contrib-bacnet/commit/79d99793271ba0e36cc02f9e96dab0f6116762b0)) | ||
@@ -10,0 +11,0 @@ |
{ | ||
"name": "node-red-contrib-bacnet", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The BACnet toolbox package for Node-RED.", |
@@ -34,6 +34,5 @@ ![Platform Node-RED](http://b.repl.ca/v1/Platform-Node--RED-red.png) | ||
The MIT License with [Subscription bundle][3] or GitHub Sponsoring | ||
The MIT License with support via [Subscription bundle][3] or GitHub Sponsoring | ||
[Klaus Landsdorf][1] and Community driven work | ||
[Klaus Landsdorf][1] | ||
### Important | ||
@@ -45,9 +44,10 @@ | ||
### Contribution BACnet | ||
### Contribution NodeJS BACnet® Library | ||
I'd like to give special thanks to [Fabio Huser][2]. | ||
I'd like to give special thanks to [Fabio Huser][2] and [Apollon77][4]. | ||
[1]:https://bianco-royal.com/ | ||
[1]:https://github.com/sponsors/biancode | ||
[2]:https://github.com/fh1ch | ||
[3]:https://osi.bianco-royal.com/ | ||
[4]:https://github.com/Apollon77 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
4047835
51