New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-smart-home

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-smart-home - npm Package Compare versions

Comparing version 0.0.41 to 0.0.42

packages/constants/src/select2.ts

1

default.eslintrc.js

@@ -26,4 +26,5 @@ module.exports = {

'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/no-misused-promises': 0,
},
ignorePatterns: ['.eslintrc.js', 'babel.config.js', 'jest.config.js', 'setupTests.ts'],
};

7

package.json
{
"name": "node-red-contrib-smart-home",
"version": "0.0.41",
"version": "0.0.42",
"license": "Apache-2.0",

@@ -82,5 +82,6 @@ "workspaces": [

"common-ui": "packages/common-ui/build/common-ui.js",
"node-zwave-device-in": "packages/node-zwave-device-in/build/node-zwave-device-in.js",
"node-zwave-device-mqtt": "packages/node-zwave-device-mqtt/build/node-zwave-device-mqtt.js",
"config-node-zwave-pick-device": "packages/config-node-zwave-pick-device/build/config-node-zwave-pick-device.js",
"node-zwave-device-out": "packages/node-zwave-device-out/build/node-zwave-device-out.js"
"node-zwave-device-out": "packages/node-zwave-device-out/build/node-zwave-device-out.js",
"node-zwave-device-in": "packages/node-zwave-device-in/build/node-zwave-device-in.js"
}

@@ -87,0 +88,0 @@ },

@@ -8,7 +8,2 @@ {

},
"node-red": {
"nodes": {
"node": "build/common-utils.js"
}
},
"scripts": {

@@ -15,0 +10,0 @@ "lint": "eslint src --ext .ts,.tsx,.js --color",

@@ -1,1 +0,1 @@

module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){t.exports=r(6)},function(t,e){function r(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))}}},function(t,e,r){var n=r(7),o=r(8),i=r(9),a=r(10);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(t,e,r){var n=r(11);t.exports=function(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o<a.length;o++)r=a[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof s?e:s,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function s(){}function l(){}function d(){}var p={};p[o]=function(){return this};var h=Object.getPrototypeOf,v=h&&h(h(j([])));v&&v!==e&&r.call(v,o)&&(p=v);var y=d.prototype=s.prototype=Object.create(p);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var f=u(t[o],t,i);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(f.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return l.prototype=y.constructor=d,d.constructor=l,d[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new g(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(y),y[a]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){var n=r(4);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e,r){var n=r(4);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=r(1),a=r.n(i),c=r(2),u=r.n(c),f=r(5),s=r.n(f),l=r(3),d=r.n(l);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v=function(t,e){return"".concat("values","-").concat(t,"-").concat(e.instanceId,"-").concat(e.id)},y=function(t){return new Promise((function(e){t.context().get("context","file",(function(t,r){e(t||void 0===r?{commandClasses:[]}:r)}))}))},m=function(t,e){return new Promise((function(r,n){t.context().set("context",e,"file",(function(t){t?n(t):r()}))}))},g=function(t,e,r){var n=t.commandClasses,o=d()(t,["commandClasses"]);return h({commandClasses:(n.find((function(t){return t.id===e}))?n:[{id:e,values:[]}].concat(u()(n))).map((function(t){var n=t.id,o=t.values,i=d()(t,["id","values"]);return n!==e?t:h({id:n,values:(o.find((function(t){var e=t.instanceId,n=t.id;return e===r.instanceId&&n===r.id}))?o:[r].concat(u()(o))).map((function(t){return t.instanceId!==r.instanceId||t.id!==r.id?t:r}))},i)}))},o)},b=function(t,e,r,n){var o,i,a=t.commandClasses;return null===(i=null===(o=null==a?void 0:a.find((function(t){return t.id===e})))||void 0===o?void 0:o.values)||void 0===i?void 0:i.find((function(t){var e=t.instanceId,o=t.id;return e===r&&o===n}))};e.default=function(t){t.nodes.registerType("config-node-zwave-pick-device",(function(e){var r=this;t.nodes.createNode(this,e);var n=e.name,i=e.node_id,c=e.device;this.name=n,this.node_id=parseInt(i,10),this.device=c,this.setValue=function(){var t=a()(o.a.mark((function t(e,n){var i,a,c,u;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y(r);case 2:i=t.sent,a=b(i,e,n.instanceId,n.id),(c=(null==a?void 0:a.value)!==n.value)&&m(r,g(i,e,n)),u=v(e,n),r.emit(u,{topic:u,payload:n,hasChanged:c});case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),this.getNodeId=function(){return r.node_id}})),function(t){t.httpAdmin.get("/".concat("config-node-zwave-pick-device-backend-read-context"),t.auth.needsPermission("config-node-zwave-pick-device-backend.read-command-classes"),function(){var e=a()(o.a.mark((function e(r,n){var i,a,c;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=r.query.node_id,a=t.nodes.getNode(i)){e.next=5;break}return n.sendStatus(404),e.abrupt("return");case 5:return e.next=7,y(a);case 7:c=e.sent,n.json(c);case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}())}(t)}}]).default;
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=16)}([function(t,e,r){t.exports=r(8)},function(t,e){function r(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))}}},function(t,e,r){var n=r(9),o=r(10),i=r(5),a=r(11);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(t,e,r){var n=r(12);t.exports=function(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o<a.length;o++)r=a[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e,r){var n=r(4);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e,r){var n=r(13),o=r(14),i=r(5),a=r(15);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||a()}},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===s)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var f=u(t,e,r);if("normal"===f.type){if(n=r.done?"completed":"suspendedYield",f.arg===s)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(n="completed",r.method="throw",r.arg=f.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function l(){}function d(){}var p={};p[o]=function(){return this};var h=Object.getPrototypeOf,v=h&&h(h(j([])));v&&v!==e&&r.call(v,o)&&(p=v);var y=d.prototype=f.prototype=Object.create(p);function m(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var s=u(t[o],t,i);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return l.prototype=y.constructor=d,d.constructor=l,d[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},m(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new g(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(y),y[a]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){var n=r(4);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(n=(a=c.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return r}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=r(1),a=r.n(i),c=r(2),u=r.n(c),s=r(6),f=r.n(s),l=r(3),d=r.n(l);r(7);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){f()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v=function(t,e){return"".concat("values","-").concat(t,"-").concat(e.instanceId,"-").concat(e.id)},y=(new RegExp("'^".concat("values","-(\\d+)-(\\d+)-(\\d+)$'")),function(t,e,r,n){return"".concat("openzwave2mqtt","/").concat(t,"/").concat(e,"/").concat(r,"/").concat(n,"/set")}),m=function(t){return new Promise((function(e){t.context().get("context","file",(function(t,r){e(t||void 0===r?{commandClasses:[]}:r)}))}))},g=function(t,e){return new Promise((function(r,n){t.context().set("context",e,"file",(function(t){t?n(t):r()}))}))},b=function(t,e,r){var n=t.commandClasses,o=d()(t,["commandClasses"]);return h({commandClasses:(n.find((function(t){return t.id===e}))?n:[{id:e,values:[]}].concat(u()(n))).map((function(t){var n=t.id,o=t.values,i=d()(t,["id","values"]);return n!==e?t:h({id:n,values:(o.find((function(t){var e=t.instanceId,n=t.id;return e===r.instanceId&&n===r.id}))?o:[r].concat(u()(o))).map((function(t){return t.instanceId!==r.instanceId||t.id!==r.id?t:r}))},i)}))},o)},w=function(t,e,r,n){var o,i,a=t.commandClasses;return null===(i=null===(o=null==a?void 0:a.find((function(t){return t.id===e})))||void 0===o?void 0:o.values)||void 0===i?void 0:i.find((function(t){var e=t.instanceId,o=t.id;return e===r&&o===n}))};e.default=function(t){t.nodes.registerType("config-node-zwave-pick-device",(function(e){var r=this;t.nodes.createNode(this,e);var n=e.name,i=e.node_id,c=e.device;this.name=n,this.node_id=parseInt(i,10),this.device=c,this.setValue=function(){var t=a()(o.a.mark((function t(e,n){var i,a,c,u;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m(r);case 2:i=t.sent,a=w(i,e,n.instanceId,n.id),(c=(null==a?void 0:a.value)!==n.value)&&g(r,b(i,e,n)),u=v(e,n),r.emit(u,{topic:u,payload:n,hasChanged:c});case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),this.sendValue=function(){var t=a()(o.a.mark((function t(e,n,i,a){var c,u;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m(r);case 2:c=t.sent,u=w(c,e,n,i),(null==u?void 0:u.value)!==a&&r.send({topic:y(r.getNodeId(),e,n,i),payload:a});case 6:case"end":return t.stop()}}),t)})));return function(e,r,n,o){return t.apply(this,arguments)}}(),this.getNodeId=function(){return r.node_id}})),function(t){t.httpAdmin.get("/".concat("config-node-zwave-pick-device-backend-read-context"),t.auth.needsPermission("config-node-zwave-pick-device-backend.read-command-classes"),function(){var e=a()(o.a.mark((function e(r,n){var i,a,c;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=r.query.node_id,a=t.nodes.getNode(i)){e.next=5;break}return n.sendStatus(404),e.abrupt("return");case 5:return e.next=7,m(a);case 7:c=e.sent,n.json(c);case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}())}(t)}}]).default;
import * as NodeRed from 'node-red';
import type { ConfigNodeZwavePickDeviceBackend, ConfigNodeZwavePickDeviceBackendProps } from './types';
import { readNodeContext, writeNodeContext, setValue, getValueKey, getCurrentValue } from './utils';
import { readNodeContext, writeNodeContext, setValue, getValueKey, getCurrentValue, getSetValueTopic } from './utils';
import api from './api';

@@ -39,2 +39,16 @@

this.sendValue = async (commandClassId, instanceId, valueId, value) => {
const context = await readNodeContext(this);
const currentValue = getCurrentValue(context, commandClassId, instanceId, valueId);
const hasChanged = currentValue?.value !== value;
if (hasChanged) {
this.send({
topic: getSetValueTopic(this.getNodeId(), commandClassId, instanceId, valueId),
payload: value,
});
}
};
this.getNodeId = () => this.node_id;

@@ -41,0 +55,0 @@ }

export const VALUES = 'values';
export const CONTEXT = 'context';
export const READ_CONTEXT_ENDPOINT = 'config-node-zwave-pick-device-backend-read-context';
export const MQTT_PREFIX = 'openzwave2mqtt';
export * from './types';
export * from './constants';
export { getValueKey } from './utils';
export { getValueKey, parseValueKey } from './utils';

@@ -20,2 +20,9 @@ import type * as NodeRed from 'node-red';

sendValue: (
commandClassId: number,
instanceId: number,
valueId: number,
value: NodeValue | undefined
) => Promise<void>;
getNodeId: () => number;

@@ -22,0 +29,0 @@ }

import { NODE_RED_FILE_STORAGE } from '@sh/constants';
import { CONTEXT, VALUES } from './constants';
import { CONTEXT, VALUES, MQTT_PREFIX } from './constants';
import { ConfigNodeZwavePickDeviceBackend, NodeContext, NodeContextCommandClass, NodeContextValue } from './types';

@@ -9,2 +9,21 @@

const parseValueKeyRegexp = new RegExp(`'^${VALUES}-(\\d+)-(\\d+)-(\\d+)$'`);
export const parseValueKey = (key: string) => {
const result = parseValueKeyRegexp.exec(key);
if (!result) {
throw new Error(`Wrong value key ${key}`);
}
const [, commandClassId, instanceId, valueId] = result;
return {
commandClassId: parseInt(commandClassId, 10),
instanceId: parseInt(instanceId, 10),
valueId: parseInt(valueId, 10),
};
};
export const getSetValueTopic = (nodeId: number, commandClassId: number, instanceId: number, valueId: number) =>
`${MQTT_PREFIX}/${nodeId}/${commandClassId}/${instanceId}/${valueId}/set`;
export const readNodeContext = (node: ConfigNodeZwavePickDeviceBackend): Promise<NodeContext> =>

@@ -11,0 +30,0 @@ new Promise(resolve => {

@@ -8,7 +8,2 @@ {

},
"node-red": {
"nodes": {
"node": "build/constants.js"
}
},
"scripts": {

@@ -15,0 +10,0 @@ "lint": "eslint src --ext .ts,.tsx,.js --color",

export * from './node-red-constants';
export * from './select2';

@@ -26,8 +26,3 @@ {

},
"dependencies": {
"@sh/open-zwave-config": "0.0.1",
"@sh/text-constants": "0.0.1",
"@sh/config-node-zwave-pick-device": "0.0.1",
"@sh/common-utils": "0.0.1"
}
"main": "./src/index.ts"
}
import * as NodeRed from 'node-red';
import { parsePayloadAsJSON, detectOpenZWaveEvent, OpenZWaveEventType } from '@sh/common-utils';
import { parseValueKey } from '@sh/config-node-zwave-pick-device';
import type { NodeZwaveDeviceInBackend, NodeZwaveDeviceInBackendProps, OpenZWaveValueChangedPayload } from './types';
import { convertValueForContext } from './utils';
import type { NodeZwaveDeviceInBackend, NodeZwaveDeviceInBackendProps } from './types';

@@ -11,22 +10,13 @@ export default (RED: NodeRed.Red) => {

RED.nodes.createNode(this, props);
const { device } = props;
const { value, device } = props;
const { commandClassId, instanceId, valueId } = parseValueKey(value);
this.device = RED.nodes.getNode(device) as any;
this.on('input', (msg, _, done) => {
const zWaveEventType = detectOpenZWaveEvent(msg.topic);
if (zWaveEventType === OpenZWaveEventType.VALUE_CHANGED || zWaveEventType === OpenZWaveEventType.VALUE_ADDED) {
const {
data: [, , value],
} = parsePayloadAsJSON<OpenZWaveValueChangedPayload>(msg.payload);
if (this.device && this.device.getNodeId() === value.node_id) {
this.device
.setValue(value.class_id, convertValueForContext(this.device.device, value))
.then(done)
.catch((e: Error) => {
this.error(e.toString());
});
}
this.on('input', async ({ payload }, send, done) => {
if (this.device) {
await this.device.sendValue(commandClassId, instanceId, valueId, payload);
}
done();
});

@@ -33,0 +23,0 @@ }

@@ -0,9 +1,20 @@

import { SELECT2_EMPTY_DATA, SELECT2_DEFAULT_CONFIG } from '@sh/constants';
import type { ConfigNodeZwavePickDeviceFrontendProps } from '@sh/config-node-zwave-pick-device';
import { READ_CONTEXT_ENDPOINT } from '@sh/config-node-zwave-pick-device';
import { getDeviceOptions } from '@sh/open-zwave-config';
interface NodeZwaveDeviceInConfig {
name: string;
device: string;
}
import { NodeZwaveDeviceInFrontendProps } from './types';
RED.nodes.registerType<NodeZwaveDeviceInConfig>('node-zwave-device-in', {
// Dirty hack
const restartSelect = (select: any, data: any) => {
select
.select2('destroy')
.html('')
.select2({
data,
...SELECT2_DEFAULT_CONFIG,
});
};
RED.nodes.registerType<NodeZwaveDeviceInFrontendProps>('node-zwave-device-in', {
category: 'category',

@@ -18,2 +29,5 @@ color: '#E9967A',

},
value: {
value: '',
},
},

@@ -26,7 +40,25 @@ inputs: 1,

return this.name || (device ? device.label() : 'node-zwave-device-in');
return this.name || (device ? device.label() : 'node-zwave-device-out');
},
oneditprepare: function () {
$('#node-input-device').select2({ theme: 'dark-adminlte' }).val(this.device);
const valueInput = $('#node-input-value').select2({
data: SELECT2_EMPTY_DATA,
...SELECT2_DEFAULT_CONFIG,
});
const deviceInput = $('#node-input-device')
.select2({ theme: 'dark-adminlte' })
.val(this.device)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.on('change', async () => {
const device = deviceInput.val();
restartSelect(valueInput, SELECT2_EMPTY_DATA);
if (typeof device === 'string' && new RegExp('^[a-z0-9]+\\.[a-z0-9]+$').exec(device)) {
const data = await $.getJSON(READ_CONTEXT_ENDPOINT, { node_id: this.device || device });
restartSelect(valueInput, getDeviceOptions(data, { skipReadOnly: true }));
valueInput.val(this.value).trigger('change');
}
});
},
});
import type * as NodeRed from 'node-red';
import type { ConfigNodeZwavePickDeviceBackend } from '@sh/config-node-zwave-pick-device';
import type { DeviceConfigurationType } from '@sh/open-zwave-config';
import { ConfigNodeZwavePickDeviceBackend } from '@sh/config-node-zwave-pick-device';

@@ -9,2 +8,3 @@ interface NodeZwaveDeviceInBaseProps {

device: string;
value: string;
}

@@ -19,27 +19,1 @@

export interface NodeZwaveDeviceInFrontendProps extends NodeZwaveDeviceInBaseProps {}
export interface OpenZWaveValueChangedPayload {
data: [
number,
number,
{
value_id: string;
node_id: number;
class_id: number;
instance: number;
index: number;
value: string | number | boolean;
type: DeviceConfigurationType['Value']['type'];
genre: DeviceConfigurationType['Value']['genre'];
label?: string;
units?: string;
help?: string;
read_only: boolean;
write_only: boolean;
min: number;
max: number;
is_polled: boolean;
values?: string[];
}
];
}

@@ -1,1 +0,1 @@

module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),t.default=function(e){e.nodes.registerType("node-zwave-device-out",(function(t){var n=this;e.nodes.createNode(this,t);var r=t.device,o=t.values;this.device=e.nodes.getNode(r);var u=function(e){n.send(e)};o.forEach((function(e){var t;null===(t=n.device)||void 0===t||t.on(e,u)})),this.on("close",(function(){o.forEach((function(e){var t;null===(t=n.device)||void 0===t||t.off(e,u)}))}))}))}}]).default;
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),t.default=function(e){e.nodes.registerType("node-zwave-device-out",(function(t){var n=this;e.nodes.createNode(this,t);var r=t.device,o=t.values;this.device=e.nodes.getNode(r);var u=function(e){e.hasChanged&&n.send(e)};o.forEach((function(e){var t;null===(t=n.device)||void 0===t||t.on(e,u)})),this.on("close",(function(){o.forEach((function(e){var t;null===(t=n.device)||void 0===t||t.off(e,u)}))}))}))}}]).default;

@@ -14,3 +14,5 @@ import * as NodeRed from 'node-red';

const valueChangeListener = msg => {
this.send(msg);
if (msg.hasChanged) {
this.send(msg);
}
};

@@ -17,0 +19,0 @@

import type { ConfigNodeZwavePickDeviceFrontendProps } from '@sh/config-node-zwave-pick-device';
import { READ_CONTEXT_ENDPOINT } from '@sh/config-node-zwave-pick-device';
import { SELECT_VALUE } from '@sh/text-constants';
import { getDeviceOptions } from '@sh/open-zwave-config';
import { SELECT2_EMPTY_DATA, SELECT2_DEFAULT_CONFIG } from '@sh/constants';
import type { NodeZwaveDeviceOutFrontendProps } from './types';
const emptyData = [];
const valueSelectConfig = {
theme: 'dark-adminlte',
...SELECT2_DEFAULT_CONFIG,
multiple: true,
placeholder: SELECT_VALUE,
width: '100%',

@@ -55,3 +52,3 @@ closeOnSelect: false,

const valueInput = $('#node-input-values').select2({
data: emptyData,
data: SELECT2_EMPTY_DATA,
...valueSelectConfig,

@@ -67,3 +64,3 @@ });

restartSelect(valueInput, emptyData);
restartSelect(valueInput, SELECT2_EMPTY_DATA);
if (typeof device === 'string' && new RegExp('^[a-z0-9]+\\.[a-z0-9]+$').exec(device)) {

@@ -70,0 +67,0 @@ const data = await $.getJSON(READ_CONTEXT_ENDPOINT, { node_id: this.device || device });

@@ -30,4 +30,5 @@ {

"dependencies": {
"@sh/text-constants": "0.0.1"
"@sh/text-constants": "0.0.1",
"@sh/types": "0.0.1"
}
}
import { memoize, mapValues } from 'lodash';
import { SELECT_DEVICE } from '@sh/text-constants';
import type { OptGroup, DropdownOptions } from '@sh/types';

@@ -11,3 +12,2 @@ import deviceConfig from '../generated/config/devices';

import { getDeviceName } from './utils';
import { OptGroup, DropdownOptions } from '../types';

@@ -14,0 +14,0 @@ const deviceInfo = manufacturerSpecific();

export { default as fibaroFGMSZW5 } from './fgmszw5';
export { default as fibaroFGWDS221 } from './fgwds221';

@@ -6,6 +6,6 @@ import { memoize } from 'lodash';

import { SELECT_VALUE } from '@sh/text-constants';
import type { Option, DropdownOptions } from '@sh/types';
import { LocalizationConfig } from './generated';
import { getLabel } from './utils';
import type { Option, DropdownOptions } from './types';

@@ -12,0 +12,0 @@ export const localization = memoize(() => {

export * from './deviceConfig';
export interface Option {
id: string;
text: string;
}
export interface OptGroup {
text: string;
children: Option[];
}
export type DropdownOptions = (OptGroup | Option)[];

@@ -7,3 +7,4 @@ {

"node": ">=12.17.0"
}
},
"main": "./src/index.ts"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc