author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
748,234 | 09.01.2019 19:55:28 | 28,800 | eaaadc3d0666350d6106008687febe81a76a0168 | README update to include the need for Node-RED v0.19+ | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "[](https://buymeacoff.ee/zachowj)\n-Various nodes to assist in setting up automation using [node-red](https://nodered.org/) communicating with [Home Assistant](https://home-assistant.io/).\n+Various nodes to assist in setting up automation using [Node-RED](https://nodered.org/) communicating with [Home Assistant](https://home-assistant.io/).\n## Project status\n@@ -12,9 +12,9 @@ Project is going through active development and as such will probably have a few\n## Getting Started\n-This assumes you have [node-red](https://nodered.org/) already installed and working, if you need to install node-red see [here](https://nodered.org/docs/getting-started/installation)\n+This assumes you have [Node-RED](https://nodered.org) already installed and working, if you need to install Node-RED see [here](https://nodered.org/docs/getting-started/installation)\n-**NOTE:** This requires [Node.js](https://nodejs.org/) >= 8.12.0. If you're running Node-Red in Docker you'll need to pull the -v8 image for this to work.\n+**NOTE:** This requires [Node.js](https://nodejs.org) v8.12+ and [Node-RED](https://nodered.org/) v0.19+. If you're running Node-Red in Docker you'll need to pull the -v8 image for this to work.\nInstall via Node-RED Manage Palette\n@@ -50,7 +50,7 @@ If you have been using the [@Spartan-II-117](https://github.com/Spartan-II-117/n\n## Included Nodes\n-The installed nodes have more detailed information in the node-red info pane shown when the node is selected. Below is a quick summary\n+The installed nodes have more detailed information in the Node-RED info pane shown when the node is selected. Below is a quick summary\n### All Events - `websocket`\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | README update to include the need for Node-RED v0.19+ |
748,234 | 17.01.2019 00:28:03 | 28,800 | 3154f79a5758c74967742e282660dac1decfbe74 | Added the ability to use relative time with the get-history node | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.html",
"new_path": "nodes/get-history/get-history.html",
"diff": "startdate: { value: \"\" },\nenddate: { value: \"\" },\nentityid: { value: \"\" },\n- entityidtype: { value: \"\" }\n+ entityidtype: { value: \"\" },\n+ useRelativeTime: { value: false },\n+ relativeTime: { value: \"\" },\n+ output_type: { value: \"array\" },\n+ output_location_type: { value: \"msg\" },\n+ output_location: { value: \"payload\" }\n},\ninputs: 1,\noutputs: 1,\nif (this.name) {\nreturn this.name;\n}\n- if (this.startdate) {\n+ if (this.useRelativeTime && this.relativeTime) {\n+ return this.relativeTime;\n+ } else if (this.startdate) {\nconst startdate = new Date(this.startdate);\nreturn `${startdate.toLocaleDateString()} ${startdate.toLocaleTimeString()}`;\n}\n});\nconst validSelection =\n- this.availableEntities.indexOf(this.entity_id) > -1;\n+ this.availableEntities.indexOf(NODE.entityid) > -1;\nif (validSelection) {\n$entityIdField.removeClass(\"input-error\");\n} else {\n}\n});\n}\n+\n+ $(\"#node-input-useRelativeTime\").on(\"change\", function() {\n+ if (this.checked) {\n+ $(\".relative_row\").show();\n+ $(\".date_row\").hide();\n+ } else {\n+ $(\".relative_row\").hide();\n+ $(\".date_row\").show();\n+ }\n+ });\n+\n+ if (this.output_location === undefined) {\n+ $(\"#node-input-output_location\").val(\"payload\");\n+ }\n+ if (this.output_type === undefined) {\n+ $(\"#node-input-output_type\").val(\"array\");\n+ }\n+\n+ $(\"#node-input-output_location\").typedInput({\n+ types: [\"msg\", \"flow\", \"global\"],\n+ typeField: \"#node-input-output_location_type\"\n+ });\n+\n+ $(\"#node-input-output_type\")\n+ .on(\"change\", e =>\n+ $(\".output-option\").toggle(e.target.value === \"array\")\n+ )\n+ .trigger(\"change\");\n},\noneditsave: function() {\nthis.entityid = $(\"#entity_id\").val();\n<input type=\"text\" id=\"node-input-server\" />\n</div>\n-\n- <div class=\"form-row\">\n- <label for=\"node-input-startdate\"><i class=\"fa fa-date\"></i> Start Date</label>\n- <input type=\"text\" id=\"node-input-startdate\" autofocus=\"autofocus\" />\n- </div>\n-\n- <div class=\"form-row\">\n- <label for=\"node-input-enddate\"><i class=\"fa fa-date\"></i> End Date</label>\n- <input type=\"text\" id=\"node-input-enddate\" />\n- </div>\n-\n<!-- Comparator Selection -->\n<div class=\"form-row\">\n<label for=\"entity_id\"><i class=\"fa fa-date\"></i> Entity ID</label>\n<input type=\"text\" id=\"entity_id\" style=\"width: 52%;\"/>\n</div>\n- <div class=\"form-tips\">\n+ <div class=\"form-row\">\n+ <input type=\"checkbox\" id=\"node-input-useRelativeTime\" checked style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\"> \n+ <label for=\"node-input-useRelativeTime\" style=\"width: auto;\">Use Relative Time</label>\n+ </div>\n+\n+ <div class=\"form-row relative_row\">\n+ <label for=\"node-input-relativeTime\"><i class=\"fa fa-date\"></i> In the Last</label>\n+ <input type=\"text\" id=\"node-input-relativeTime\" autofocus=\"autofocus\" placeholder=\"20 minutes\" />\n+ </div>\n+\n+ <div class=\"form-row date_row\">\n+ <label for=\"node-input-startdate\"><i class=\"fa fa-date\"></i> Start Date</label>\n+ <input type=\"text\" id=\"node-input-startdate\" autofocus=\"autofocus\" />\n+ </div>\n+\n+ <div class=\"form-row date_row\">\n+ <label for=\"node-input-enddate\"><i class=\"fa fa-date\"></i> End Date</label>\n+ <input type=\"text\" id=\"node-input-enddate\" />\n+ </div>\n+\n+ <div class=\"form-row form-tips date_row\">\n<ul>\n- <li>dates must be in ISO format, example: \"2018-01-27T13:00:00+00:00\"</li>\n+ <li>dates must be in ISO format</li>\n+ <li>example: \"2018-01-27T13:00:00+00:00\"</li>\n</ul>\n</div>\n+\n+ <div class=\"form-row form-tips relative_row\">\n+ <p><code>timestring</code> will parse the following keywords into time values:</p>\n+ <ol>\n+ <li><code>ms, milli, millisecond, milliseconds</code> - will parse to milliseconds</li>\n+ <li><code>s, sec, secs, second, seconds</code> - will parse to seconds</li>\n+ <li><code>m, min, mins, minute, minutes</code> - will parse to minutes</li>\n+ <li><code>h, hr, hrs, hour, hours</code> - will parse to hours</li>\n+ <li><code>d, day, days</code> - will parse to days</li>\n+ <li><code>w, week, weeks</code> - will parse to weeks</li>\n+ <li><code>mon, mth, mths, month, months</code> - will parse to months</li>\n+ <li><code>y, yr, yrs, year, years</code> - will parse to years</li>\n+ </ol>\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-output_type\">Output Type</label>\n+ <select id=\"node-input-output_type\">\n+ <option value=\"array\">Array</option>\n+ <option value=\"split\">Split</option>\n+ </select>\n+ </div>\n+\n+ <div class=\"form-row output-option\" id=\"output_location\">\n+ <label for=\"node-input-output_location\">Output Location</label>\n+ <input type=\"hidden\" id=\"node-input-output_location_type\" />\n+ <input type=\"text\" id=\"node-input-output_location\" />\n+ </div>\n</script>\n<script type=\"text/html\" data-help-name=\"api-get-history\">\n<dt class=\"optional\">enddate <span class=\"property-type\">string | date</span></dt>\n<dd>Date to fetch history to. Will override the nodes configuration if passed in</dd>\n+ <dt class=\"optional\">relativetime <span class=\"property-type\">string</span></dt>\n+ <dd>A timestring to be parsed into datetime string</dd>\n+\n<dt class=\"optional\">entityid <span class=\"property-type\">string</span></dt>\n<dd>Exact entity_id to fetch history for, must be an exact match as is passed directly to the home-assistant api</dd>\n</dl>\n<dt>enddate <span class=\"property-type\">string</span></dt>\n<dd>ISO date string used to fetch history</dd>\n+ <dt>relativetime <span class=\"property-type\">string</span></dt>\n+ <dd>The timestring parsed into the startdate</dd>\n+\n<dt> entityid <span class=\"property-type\">string</span></dt>\n<dd>entityid string used during fetch history call</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "const Joi = require('joi');\n+const timestring = require('timestring');\nconst BaseNode = require('../../lib/base-node');\nmodule.exports = function(RED) {\n@@ -10,7 +11,12 @@ module.exports = function(RED) {\nstartdate: {},\nenddate: {},\nentityid: {},\n- entityidtype: {}\n+ entityidtype: {},\n+ useRelativeTime: {},\n+ relativeTime: {},\n+ output_type: {},\n+ output_location_type: {},\n+ output_location: {}\n},\ninput: {\nstartdate: {\n@@ -45,6 +51,14 @@ module.exports = function(RED) {\nentityidtype: {\nmessageProp: 'entityidtype',\nconfigProp: 'entityidtype'\n+ },\n+ useRelativeTime: {\n+ messageProp: 'userelativetime',\n+ configProp: 'useRelativeTime'\n+ },\n+ relativeTime: {\n+ messageProp: 'relativetime',\n+ configProp: 'relativeTime'\n}\n}\n};\n@@ -54,11 +68,29 @@ module.exports = function(RED) {\nsuper(nodeDefinition, RED, nodeOptions);\n}\n- onInput({ parsedMessage, message }) {\n- let { startdate, enddate, entityid, entityidtype } = parsedMessage;\n+ async onInput({ parsedMessage, message }) {\n+ let {\n+ startdate,\n+ enddate,\n+ entityid,\n+ entityidtype,\n+ useRelativeTime,\n+ relativeTime\n+ } = parsedMessage;\nstartdate = startdate.value;\nenddate = enddate.value;\nentityid = entityid.value;\n+ relativeTime = relativeTime.value;\n+ useRelativeTime = useRelativeTime.value;\n+\n+ if (\n+ useRelativeTime ||\n+ parsedMessage.relativeTime.source === 'message'\n+ ) {\n+ startdate = new Date(\n+ Date.now() - timestring(relativeTime, 'ms')\n+ ).toISOString();\n+ }\nlet apiRequest =\nentityidtype.value === 'includes' && entityid\n@@ -82,33 +114,85 @@ module.exports = function(RED) {\ntext: `Requesting at: ${this.getPrettyDate()}`\n});\n- return apiRequest\n- .then(res => {\n+ try {\n+ var results = await apiRequest;\nmessage.startdate = startdate;\nmessage.enddate = enddate || null;\nmessage.entityid = entityid || null;\n- message.payload = res;\n- this.send(message);\n+ } catch (err) {\n+ let errorMessage =\n+ 'Error get-history, home assistant api error.';\n+ if (this.utils.selectn('response.data.message', err))\n+ errorMessage = `${errorMessage} Error Message: ${\n+ err.response.data.message\n+ }`;\n+ this.error(errorMessage);\n+\nthis.status({\n- fill: 'green',\n+ fill: 'red',\n+ shape: 'ring',\n+ text: `Error at: ${this.getPrettyDate()}`\n+ });\n+\n+ return null;\n+ }\n+\n+ switch (this.nodeConfig.output_type) {\n+ case 'split':\n+ if (results.length === 0) {\n+ this.status({\n+ fill: 'red',\nshape: 'dot',\n- text: `Success at: ${this.getPrettyDate()}`\n+ text: `No Results at: ${this.getPrettyDate()}`\n});\n- })\n- .catch(err => {\n- this.warn(\n- 'Error calling service, home assistant api error',\n- err\n+ return;\n+ }\n+ if (entityidtype.value === 'is') {\n+ results = results[0];\n+ }\n+\n+ message.parts = {};\n+ message.parts.id = RED.util.generateId();\n+ delete message._msgid;\n+ message.parts.type = 'array';\n+ message.parts.count = results.length;\n+\n+ let pos = 0;\n+ message.parts.len = 1;\n+ for (let i = 0; i < results.length; i++) {\n+ message.payload = results.slice(pos, pos + 1)[0];\n+ message.parts.index = i;\n+ pos += 1;\n+ this.node.send(this.RED.util.cloneMessage(message));\n+ }\n+ break;\n+\n+ case 'array':\n+ default:\n+ const contextKey = RED.util.parseContextStore(\n+ this.nodeConfig.output_location\n);\n- this.error(\n- 'Error calling service, home assistant api error',\n- message\n+ const locationType = this.nodeConfig.output_location_type;\n+ if (locationType === 'flow' || locationType === 'global') {\n+ this.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ results,\n+ contextKey.store\n);\n+ } else {\n+ message[contextKey.key] = results;\n+ }\n+\n+ this.node.send(message);\n+ break;\n+ }\n+\nthis.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `Error at: ${this.getPrettyDate()}`\n- });\n+ fill: 'green',\n+ shape: 'dot',\n+ text: `Success at: ${this.getPrettyDate()}`\n});\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "\"integrity\": \"sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=\",\n\"dev\": true\n},\n+ \"timestring\": {\n+ \"version\": \"5.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/timestring/-/timestring-5.0.1.tgz\",\n+ \"integrity\": \"sha512-0VfOVpaTYqBMTEpjwcY5mB+72YYjFI44Z5F2q80ZiIyDn5pRJm+rEV1OEM8xfnf5/FdtckcrTERTp9TbrlMMHw==\"\n+ },\n\"tmp\": {\n\"version\": \"0.0.33\",\n\"resolved\": \"https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz\",\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"p-iteration\": \"1.1.7\",\n\"selectn\": \"1.1.2\",\n\"time-ago\": \"0.2.1\",\n+ \"timestring\": \"5.0.1\",\n\"ws\": \"6.1.2\"\n},\n\"devDependencies\": {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Added the ability to use relative time with the get-history node |
748,234 | 17.01.2019 00:33:08 | 28,800 | 2004ef74fc91cd62d3e8c6877babe3e655a248d1 | Fix http api so it returns empty string and not the response object when res.data is empty.
Fixes
Closes | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-api.js",
"new_path": "lib/ha-api.js",
"diff": "@@ -119,7 +119,7 @@ class HaApi {\nreturn this.client\n.post(path, data)\n- .then(res => res.data || res)\n+ .then(res => res.data || '')\n.catch(err => {\ndebug(`POST: request errror: ${err.toString()}`);\nthrow err;\n@@ -131,7 +131,7 @@ class HaApi {\nreturn this.client\n.request({ url: path, params: params })\n- .then(res => res.data || res)\n+ .then(res => res.data || '')\n.catch(err => {\ndebug(`GET: request errror: ${err.toString()}`);\nthrow err;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -41,7 +41,7 @@ module.exports = function(RED) {\n.then(res => {\nmessage.template = template;\nmessage.payload = res;\n- this.send(message);\n+ this.node.send(message);\nthis.status({\nfill: 'green',\nshape: 'dot',\n@@ -49,12 +49,14 @@ module.exports = function(RED) {\n});\n})\n.catch(err => {\n- this.error(\n- `Error calling service, home assistant api error: ${\n- err.message\n- }`,\n- message\n- );\n+ let errorMessage =\n+ 'Error get-template, home assistant api error.';\n+ if (this.utils.selectn('response.data.message', err))\n+ errorMessage = `${errorMessage} Error Message: ${\n+ err.response.data.message\n+ }`;\n+\n+ this.error(errorMessage);\nthis.status({\nfill: 'red',\nshape: 'ring',\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Fix http api so it returns empty string and not the response object when res.data is empty.
Fixes #78
Closes #79 |
748,234 | 17.01.2019 00:36:26 | 28,800 | 1ef38fd0e5ef6eabaaf53b9d4d665fb8e96e455e | Slighty better error message for call-service node | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -133,14 +133,14 @@ module.exports = function(RED) {\nthis.send(message);\n})\n.catch(err => {\n- this.warn(\n- 'Error calling service, home assistant api error',\n- err\n- );\n- this.error(\n- 'Error calling service, home assistant api error',\n- message\n- );\n+ let errorMessage =\n+ 'Error call service, home assistant api error.';\n+ if (err.message)\n+ errorMessage = `${errorMessage} Error Message: ${\n+ err.message\n+ }`;\n+ this.error(errorMessage);\n+\nthis.status({\nfill: 'red',\nshape: 'ring',\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Slighty better error message for call-service node |
748,234 | 17.01.2019 00:38:02 | 28,800 | 91c878159c24e91538625cae4177537382bb5298 | Change the connect timeout for hass.io users so it doesn't bombard the proxy.
Closes | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -313,13 +313,26 @@ class HaWebsocket extends EventEmitter {\nsocket.addEventListener('error', onClose);\n}\n- return new Promise((resolve, reject) =>\n+ return new Promise((resolve, reject) => {\n+ // if hass.io, do a 5 second delay so it doesn't spam the hass.io proxy\n+ // https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/76\n+ if (process.env.HASSIO_TOKEN) {\n+ setTimeout(\n+ () =>\n+ connect(\n+ resolve,\n+ reject\n+ ),\n+ 5000\n+ );\n+ } else {\nconnect(\nresolve,\nreject\n- )\n);\n}\n+ });\n+ }\n}\nconnectionStates.forEach((readyState, i) => {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Change the connect timeout for hass.io users so it doesn't bombard the proxy.
Closes #76 |
748,234 | 18.01.2019 12:50:22 | 28,800 | 83d945dccef151a551b15e5d18eda412cded0b58 | Fixed poll-state node not waiting for getComparatorResult | [
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -110,12 +110,12 @@ module.exports = function(RED) {\nconst shouldHaltIfState =\nthis.nodeConfig.halt_if &&\n- this.getComparatorResult(\n+ (await this.getComparatorResult(\nthis.nodeConfig.halt_if_compare,\nthis.nodeConfig.halt_if,\npollState.state,\nthis.nodeConfig.halt_if_type\n- );\n+ ));\nconst msg = {\ntopic: this.nodeConfig.entity_id,\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Fixed poll-state node not waiting for getComparatorResult |
748,234 | 18.01.2019 13:03:25 | 28,800 | 9343ffb56171cddeb60b85c84bf5e6bf33082dfd | fix for get-history relative time validation | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -28,7 +28,6 @@ module.exports = function(RED) {\nreturn yesterday.toISOString();\n},\nvalidation: {\n- haltOnFail: true,\nschema: Joi.date()\n.optional()\n.allow('')\n@@ -38,7 +37,6 @@ module.exports = function(RED) {\nmessageProp: 'enddate',\nconfigProp: 'enddate',\nvalidation: {\n- haltOnFail: true,\nschema: Joi.date()\n.optional()\n.allow('')\n@@ -52,10 +50,6 @@ module.exports = function(RED) {\nmessageProp: 'entityidtype',\nconfigProp: 'entityidtype'\n},\n- useRelativeTime: {\n- messageProp: 'userelativetime',\n- configProp: 'useRelativeTime'\n- },\nrelativeTime: {\nmessageProp: 'relativetime',\nconfigProp: 'relativeTime'\n@@ -74,14 +68,13 @@ module.exports = function(RED) {\nenddate,\nentityid,\nentityidtype,\n- useRelativeTime,\nrelativeTime\n} = parsedMessage;\nstartdate = startdate.value;\nenddate = enddate.value;\nentityid = entityid.value;\nrelativeTime = relativeTime.value;\n- useRelativeTime = useRelativeTime.value;\n+ let useRelativeTime = this.nodeConfig.useRelativeTime;\nif (\nuseRelativeTime ||\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix for get-history relative time validation |
748,234 | 18.01.2019 13:06:22 | 28,800 | b7291d94c27c423570e6b92e5d4d188e59abfa3d | Version Bump to 0.6.1 | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "{\n\"name\": \"node-red-contrib-home-assistant-websocket\",\n- \"version\": \"0.6.0\",\n+ \"version\": \"0.6.1\",\n\"lockfileVersion\": 1,\n\"requires\": true,\n\"dependencies\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "{\n\"name\": \"node-red-contrib-home-assistant-websocket\",\n\"description\": \"Node-RED integration with Home Assistant through websocket and REST API\",\n- \"version\": \"0.6.0\",\n+ \"version\": \"0.6.1\",\n\"homepage\": \"https://github.com/zachowj/node-red-contrib-home-assistant-websocket\",\n\"bugs\": {\n\"url\": \"https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues\"\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | Version Bump to 0.6.1 |
748,234 | 18.01.2019 22:52:18 | 28,800 | e29745be75746e4491e3143faa8b245ff722b640 | build: Added standard-version to package.json
Added standard-version config and script to package.json | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"docker-map\": \"docker-compose -f docker/docker-compose.mapped.yml\",\n\"clean\": \"npm run docker:down\",\n\"lint\": \"eslint .\",\n- \"lint:fix\": \"eslint . --fix\"\n+ \"lint:fix\": \"eslint . --fix\",\n+ \"release\": \"standard-version\"\n},\n\"repository\": {\n\"type\": \"git\",\n\"prettier --write\",\n\"git add\"\n]\n+ },\n+ \"standard-version\": {\n+ \"scripts\": {\n+ \"postchangelog\": \"prettier --write CHANGELOG.md\"\n+ }\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | build: Added standard-version to package.json
Added standard-version config and script to package.json |
748,234 | 23.01.2019 07:53:42 | 28,800 | f1a9ba70680a2308e4147a2075d1298db01d2dd3 | style(get-history): Changed the icon | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.html",
"new_path": "nodes/get-history/get-history.html",
"diff": "},\ninputs: 1,\noutputs: 1,\n- icon: \"timer.png\",\n+ icon: \"history.png\",\npaletteLabel: \"get history\",\nlabel: function() {\nif (this.name) {\n"
},
{
"change_type": "ADD",
"old_path": "nodes/get-history/icons/history.png",
"new_path": "nodes/get-history/icons/history.png",
"diff": "Binary files /dev/null and b/nodes/get-history/icons/history.png differ\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | style(get-history): Changed the icon |
748,234 | 24.01.2019 08:16:07 | 28,800 | 0707d7235d69de9dfc8192d4d95fd01ece47575d | feat(event-state): Added Only output on state change | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "haltifstate: { value: \"\" },\nhalt_if_type: {},\nhalt_if_compare: {},\n- outputs: { value: 1 }\n+ outputs: { value: 1 },\n+ output_only_on_state_change: { value: true }\n},\ninputs: 0,\noutputs: 1,\n</select>\n</div>\n+ <div class=\"form-row\">\n+ <input type=\"checkbox\" id=\"node-input-output_only_on_state_change\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\">\n+ <label for=\"node-input-output_only_on_state_change\" style=\"width: auto;\">Output only on state change</label>\n+ </div>\n+\n<div class=\"form-row\">\n<input type=\"checkbox\" id=\"node-input-outputinitially\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\">\n<label for=\"node-input-outputinitially\" style=\"width: auto;\">Output Initially / On Deploy</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.js",
"new_path": "nodes/events-state-changed/events-state-changed.js",
"diff": "@@ -19,7 +19,8 @@ module.exports = function(RED) {\nhalt_if_type: {},\nhalt_if_compare: {},\noutputinitially: {},\n- state_type: {}\n+ state_type: {},\n+ output_only_on_state_change: {}\n}\n};\n@@ -79,9 +80,17 @@ module.exports = function(RED) {\n);\n}\n- const shouldIncludeEvent = this.shouldIncludeEvent(entity_id);\n+ if (!this.shouldIncludeEvent(entity_id)) {\n+ return null;\n+ }\n+\n+ if (\n+ this.nodeConfig.output_only_on_state_change === true &&\n+ event.old_state.state === event.new_state.state\n+ ) {\n+ return null;\n+ }\n- if (shouldIncludeEvent) {\nthis.nodeConfig.halt_if_compare =\nthis.nodeConfig.halt_if_compare || 'is';\nthis.nodeConfig.halt_if_type =\n@@ -103,9 +112,7 @@ module.exports = function(RED) {\n};\nif (shouldHaltIfState) {\n- this.debug(\n- 'flow halted due to \"halt if state\" setting'\n- );\n+ this.debug('flow halted due to \"halt if state\" setting');\nthis.status({\nfill: 'red',\nshape: 'ring',\n@@ -120,18 +127,16 @@ module.exports = function(RED) {\nthis.status({\nfill: 'green',\nshape: 'dot',\n- text: `${\n- event.new_state.state\n- } at: ${this.getPrettyDate()}`\n+ text: `${event.new_state.state} at: ${this.getPrettyDate()}`\n});\nevent.old_state\n? this.debug(\n`Incoming state event: entity_id: ${\nevent.entity_id\n- }, new_state: ${\n- event.new_state.state\n- }, old_state: ${event.old_state.state}`\n+ }, new_state: ${event.new_state.state}, old_state: ${\n+ event.old_state.state\n+ }`\n)\n: this.debug(\n`Incoming state event: entity_id: ${\n@@ -140,8 +145,6 @@ module.exports = function(RED) {\n);\nreturn this.send([msg, null]);\n- }\n- return null;\n} catch (e) {\nthis.error(e);\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(event-state): Added Only output on state change |
748,234 | 24.01.2019 08:17:50 | 28,800 | 64ba7e57322b08d64bb9a40473ed24a44c6e8496 | refactor(event-state): Changed default filter type to exact | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "name: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\nentityidfilter: { value: \"\", required: true },\n- entityidfiltertype: { value: \"substring\" },\n+ entityidfiltertype: { value: \"exact\" },\noutputinitially: { value: false },\nstate_type: { value: \"str\" },\nhaltifstate: { value: \"\" },\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(event-state): Changed default filter type to exact |
748,234 | 25.01.2019 05:07:10 | 28,800 | 66d8daf1616a1d7947344b784c57819d89eee662 | fix: Added a check for valid server
Check to make sure there's a valid server selected for current-state,
get-entities, get-history, and render-template | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -43,6 +43,11 @@ module.exports = function(RED) {\nreturn { payload: {} };\n};\n+ if (this.nodeConfig.server === null) {\n+ this.node.error('No valid server selected.');\n+ return null;\n+ }\n+\nif (!entity_id)\nreturn logAndContinueEmpty(\n'entity ID not set, cannot get current state, sending empty payload'\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -26,6 +26,11 @@ module.exports = function(RED) {\nasync onInput({ parsedMessage, message }) {\nlet noPayload = false;\n+ if (this.nodeConfig.server === null) {\n+ this.node.error('No valid server selected.');\n+ return null;\n+ }\n+\nconst states = await this.nodeConfig.server.homeAssistant.getStates();\nif (!states) {\nthis.node.warn(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -76,6 +76,11 @@ module.exports = function(RED) {\nrelativeTime = relativeTime.value;\nlet useRelativeTime = this.nodeConfig.useRelativeTime;\n+ if (this.nodeConfig.server === null) {\n+ this.node.error('No valid server selected.');\n+ return null;\n+ }\n+\nif (\nuseRelativeTime ||\nparsedMessage.relativeTime.source === 'message'\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -30,6 +30,11 @@ module.exports = function(RED) {\nlet { template } = parsedMessage;\ntemplate = template.value;\n+ if (this.nodeConfig.server === null) {\n+ this.node.error('No valid server selected.');\n+ return null;\n+ }\n+\nthis.status({\nfill: 'yellow',\nshape: 'dot',\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: Added a check for valid server
Check to make sure there's a valid server selected for current-state,
get-entities, get-history, and render-template |
748,234 | 25.01.2019 05:13:07 | 28,800 | 5c6e3c6ea91c4de851003582df238b7150e70ce0 | chore: Preparation for using standard-version CHANGELOG | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "-# Changelog\n-\n-All notable changes to this project will be documented in this file.\n-\n## [0.6.1] 2019.1.18\n### Fixes\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"clean\": \"npm run docker:down\",\n\"lint\": \"eslint .\",\n\"lint:fix\": \"eslint . --fix\",\n- \"release\": \"standard-version\"\n+ \"release\": \"standard-version\",\n+ \"prerelease\": \"standard-version -p\"\n},\n\"repository\": {\n\"type\": \"git\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore: Preparation for using standard-version CHANGELOG |
748,234 | 27.01.2019 15:04:31 | 28,800 | 0a51c5d27fd2160c94e55905cd626af99f2f82de | feat(current-state): Added customizable outputs for state and entity | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "defaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n+ outputs: { value: 1 },\nhalt_if: { value: \"\" },\nhalt_if_type: { value: \"str\" },\nhalt_if_compare: { value: \"is\" },\noverride_topic: { value: true },\n- override_payload: { value: true },\n- override_data: { value: true },\nentity_id: { value: \"\" },\nstate_type: { value: \"str\" },\n- outputs: { value: 1 }\n+ state_location: { value: \"payload\" },\n+ override_payload: { value: \"msg\" }, // state location type\n+ entity_location: { value: \"data\" },\n+ override_data: { value: \"msg\" } // entity location type\n},\noneditprepare: function() {\nconst $entityIdField = $(\"#entity_id\");\n- $entityIdField.val(this.entity_id);\n+ const $stateLocation = $(\"#node-input-state_location\");\n+ const $entityLocation = $(\"#node-input-entity_location\");\n- const NODE = this;\n+ const node = this;\nconst $server = $(\"#node-input-server\");\nconst utils = {\nsetDefaultServerSelection: function() {\n}\n};\n- if (!NODE.server) {\n+ if (!node.server) {\nutils.setDefaultServerSelection();\n}\nconst selectedServer = $server.val();\n- if (NODE.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = NODE.server || selectedServer;\n+ if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n+ const serverId = node.server || selectedServer;\n$.getJSON(`homeassistant/${serverId}/entities`)\n.done(entities => {\nthis.availableEntities = entities;\n});\n}\n- if (this.state_type === undefined) {\n+ $entityIdField.val(node.entity_id);\n+\n+ // Handle backwards compatibility\n+ if (node.state_location === undefined) {\n+ $stateLocation.val(\"payload\");\n+ $(\"#node-input-override_payload\").val(\n+ node.override_payload === false ? \"none\" : \"msg\"\n+ );\n+ }\n+ if (node.entity_location === undefined) {\n+ $entityLocation.val(\"data\");\n+ $(\"#node-input-override_data\").val(\n+ node.override_data === false ? \"none\" : \"msg\"\n+ );\n+ }\n+\n+ const NoneType = { value: \"none\", label: \"None\", hasValue: false };\n+ $stateLocation\n+ .typedInput({\n+ types: [\"msg\", \"flow\", \"global\", NoneType],\n+ typeField: \"#node-input-override_payload\"\n+ })\n+ .typedInput(\"width\", \"68%\");\n+ $entityLocation\n+ .typedInput({\n+ types: [\"msg\", \"flow\", \"global\", NoneType],\n+ typeField: \"#node-input-override_data\"\n+ })\n+ .typedInput(\"width\", \"68%\");\n+\n+ if (node.state_type === undefined) {\n$(\"#node-input-state_type\").val(\"str\");\n}\n- if (this.halt_if_compare === undefined) {\n+ if (node.halt_if_compare === undefined) {\n$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n</select>\n</div>\n- <div class=\"form-row\">\n- <span style=\"width: 100px;display: inline-block;\">Override</span>\n-\n- <input type=\"checkbox\" id=\"node-input-override_topic\" checked style=\"display:inline-block; width:15px; vertical-align:baseline;\"> \n- <label for=\"node-input-override_topic\" style=\"width: auto;margin-right: 20px;\">Topic</label>\n+ <div class=\"form-row\" id=\"state_location\">\n+ <label for=\"node-input-state_location\">State Location</label>\n+ <input type=\"hidden\" id=\"node-input-override_payload\" />\n+ <input type=\"text\" id=\"node-input-state_location\" />\n+ </div>\n- <input type=\"checkbox\" id=\"node-input-override_payload\" checked style=\"display:inline-block; width:15px; vertical-align:baseline;\"> \n- <label for=\"node-input-override_payload\" style=\"width: auto;margin-right: 20px;\">Payload</label>\n+ <div class=\"form-row\" id=\"entity_location\">\n+ <label for=\"node-input-entity_location\">Entity Location</label>\n+ <input type=\"hidden\" id=\"node-input-override_data\" />\n+ <input type=\"text\" id=\"node-input-entity_location\" />\n+ </div>\n- <input type=\"checkbox\" id=\"node-input-override_data\" checked style=\"display:inline-block; width:15px; vertical-align:baseline;\"> \n- <label for=\"node-input-override_data\" style=\"width: auto;\">Data</label>\n+ <div class=\"form-row\">\n+ <input type=\"checkbox\" id=\"node-input-override_topic\" checked style=\"margin-left:105px;display:inline-block; width:auto; vertical-align:baseline;\"> \n+ <label for=\"node-input-override_topic\" style=\"width: auto;margin-right: 20px;\">Override Topic</label>\n</div>\n</script>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n<dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n- <dt>Overrides<span class=\"property-type\">boolean</span></dt>\n- <dd></dd>\n+ <dt>State Location<span class=\"property-type\">string</span></dt>\n+ <dd>Customizable location for the entity's state. Defaults to <code>msg.payload</code></dd>\n+\n+ <dt>Entity Location<span class=\"property-type\">string</span></dt>\n+ <dd>Customizable location for the <a href=\"https://www.home-assistant.io/docs/configuration/state_object/\" target=\"_blank\">entity object</a>. Defaults to <code>msg.data</code></dd>\n+\n+ <dt>Override Topic<span class=\"property-type\">boolean</span></dt>\n+ <dd>Write entity id to <code>msg.topic</code></dd>\n</dl>\n<h3>Outputs</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -6,15 +6,17 @@ module.exports = function(RED) {\ndebug: true,\nconfig: {\nname: {},\n+ server: { isNode: true },\nhalt_if: {},\nhalt_if_type: {},\nhalt_if_compare: {},\noverride_topic: {},\n- override_payload: {},\n- override_data: {},\nentity_id: {},\nstate_type: {},\n- server: { isNode: true }\n+ state_location: {},\n+ override_payload: {}, // state location type\n+ entity_location: {},\n+ override_data: {} // entity location type\n},\ninput: {\nentity_id: {\n@@ -91,13 +93,65 @@ module.exports = function(RED) {\nconst shouldHaltIfState = this.nodeConfig.halt_if && isHaltValid;\n// default switch to true if undefined (backward compatibility\n- const override_payload = this.nodeConfig.override_payload !== false;\nconst override_topic = this.nodeConfig.override_topic !== false;\n- const override_data = this.nodeConfig.override_data !== false;\n-\nif (override_topic) message.topic = entity_id;\n- if (override_payload) message.payload = currentState.state;\n- if (override_data) message.data = currentState;\n+\n+ if (this.nodeConfig.state_location === undefined) {\n+ this.nodeConfig.state_location = 'payload';\n+ this.nodeConfig.override_payload =\n+ this.nodeConfig.override_payload !== false ? 'msg' : 'none';\n+ }\n+ if (this.nodeConfig.entity_location === undefined) {\n+ this.nodeConfig.entity_location = 'data';\n+ this.nodeConfig.override_data =\n+ this.nodeConfig.override_data !== false ? 'msg' : 'none';\n+ }\n+\n+ if (\n+ this.nodeConfig.override_payload !== 'none' &&\n+ this.nodeConfig.state_location\n+ ) {\n+ const contextKey = RED.util.parseContextStore(\n+ this.nodeConfig.state_location\n+ );\n+ contextKey.key = contextKey.key || 'payload';\n+ const locationType = this.nodeConfig.override_payload || 'msg';\n+\n+ if (locationType === 'flow' || locationType === 'global') {\n+ this.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ currentState.state,\n+ contextKey.store\n+ );\n+ } else if (locationType === 'msg') {\n+ message[contextKey.key] = currentState.state;\n+ }\n+ }\n+\n+ if (\n+ this.nodeConfig.override_data !== 'none' &&\n+ this.nodeConfig.entity_location\n+ ) {\n+ const contextKey = RED.util.parseContextStore(\n+ this.nodeConfig.entity_location\n+ );\n+ contextKey.key = contextKey.key || 'data';\n+ const locationType = this.nodeConfig.override_data || 'msg';\n+\n+ if (locationType === 'flow' || locationType === 'global') {\n+ this.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ currentState,\n+ contextKey.store\n+ );\n+ } else if (locationType === 'msg') {\n+ message[contextKey.key] = currentState;\n+ }\n+ }\nif (shouldHaltIfState) {\nconst debugMsg = `Get current state: halting processing due to current state of ${entity_id} matches \"halt if state\" option`;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(current-state): Added customizable outputs for state and entity |
748,234 | 29.01.2019 22:07:21 | 28,800 | 99eafb79dfc6aace1bbb7434c576353ffc772a5d | refactor: Update node icons
Update the node icons for the fire-event, current-state, and
get-entities nodes | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- icon: \"arrow-top-right.png\",\n+ icon: \"code.png\",\npaletteLabel: \"current state\",\nlabel: function() {\nreturn this.name || `current_state: ${this.entity_id}`;\n"
},
{
"change_type": "ADD",
"old_path": "nodes/current-state/icons/code.png",
"new_path": "nodes/current-state/icons/code.png",
"diff": "Binary files /dev/null and b/nodes/current-state/icons/code.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.html",
"new_path": "nodes/fire-event/fire-event.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- icon: \"feed.png\",\n+ icon: \"radiotower.png\",\nalign: \"right\",\npaletteLabel: \"fire event\",\nlabel: function() {\n"
},
{
"change_type": "ADD",
"old_path": "nodes/fire-event/icons/radiotower.png",
"new_path": "nodes/fire-event/icons/radiotower.png",
"diff": "Binary files /dev/null and b/nodes/fire-event/icons/radiotower.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- icon: \"split.png\",\n+ icon: \"pagesearch.png\",\npaletteLabel: \"get entities\",\nlabel: function() {\nreturn this.name || \"get entities\";\n"
},
{
"change_type": "ADD",
"old_path": "nodes/get-entities/icons/pagesearch.png",
"new_path": "nodes/get-entities/icons/pagesearch.png",
"diff": "Binary files /dev/null and b/nodes/get-entities/icons/pagesearch.png differ\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Update node icons
Update the node icons for the fire-event, current-state, and
get-entities nodes |
748,234 | 01.02.2019 16:18:52 | 28,800 | 6717972cff450ac29eae36835301895e3d740b58 | feat(wait-until): New 'Wait Until' Node
Closes Closes | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -92,6 +92,10 @@ Fetches HomeAssistant history on input\nAllows rendering of templates on input\n+### Wait Until - `websocket`\n+\n+When an input is received the node will wait until the condition is met or the timeout occurs then will pass on the last received message\n+\n## Development\nCheck out the wiki page for setting up an environment with Home Assistant/Node Red.\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -36,17 +36,37 @@ module.exports = function(RED) {\n.then(services => res.json(services))\n.catch(e => this.error(e.message));\n},\n- getProperties: function(req, res, next) {\n+ getProperties: async function(req, res, next) {\nif (!this.homeAssistant) {\nreturn res.json([]);\n}\n- return this.homeAssistant\n- .getStates()\n- .then(states => {\n- const flat = Object.values(states).map(entity =>\n+ let flat = [];\n+ let singleEntity = !!req.query.entityId;\n+\n+ try {\n+ var states = await this.homeAssistant.getStates(\n+ req.query.entityId\n+ );\n+\n+ if (!states) {\n+ states = await this.homeAssistant.getStates();\n+ singleEntity = false;\n+ }\n+ } catch (e) {\n+ this.error(e.message);\n+ }\n+\n+ if (singleEntity) {\n+ flat = Object.keys(flatten(states)).filter(\n+ e => e.indexOf(req.query.term) !== -1\n+ );\n+ } else {\n+ flat = Object.values(states).map(entity =>\nObject.keys(flatten(entity))\n);\n+ }\n+\nconst uniqArray = uniq(\n[].concat(...flat).sort((a, b) => {\nif (!a.includes('.') && b.includes('.')) return -1;\n@@ -59,8 +79,6 @@ module.exports = function(RED) {\n);\nres.json(uniqArray);\n- })\n- .catch(e => this.error(e.message));\n}\n};\n"
},
{
"change_type": "ADD",
"old_path": "nodes/wait-until/icons/wait-until.png",
"new_path": "nodes/wait-until/icons/wait-until.png",
"diff": "Binary files /dev/null and b/nodes/wait-until/icons/wait-until.png differ\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "nodes/wait-until/wait-until.html",
"diff": "+<script type=\"text/javascript\">\n+ RED.nodes.registerType(\"ha-wait-until\", {\n+ category: \"home_assistant\",\n+ color: \"#52C0F2\",\n+ inputs: 1,\n+ outputs: 1,\n+ icon: \"wait-until.png\",\n+ paletteLabel: \"wait until\",\n+ label: function() {\n+ return this.name || `wait until`;\n+ },\n+ outputLabels: [\"\", \"timed out\"],\n+ defaults: {\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ outputs: { value: 1 },\n+ entityId: { value: \"\" },\n+ property: { value: \"\" },\n+ comparator: { value: \"is\" },\n+ value: { value: \"\" },\n+ valueType: { value: \"str\" },\n+ timeout: { value: 0 },\n+ timeoutUnits: { value: \"seconds\" },\n+ entityLocation: { value: \"data\" },\n+ entityLocationType: { value: \"none\" }\n+ },\n+ oneditprepare: function() {\n+ const $entityIdField = $(\"#node-input-entityId\");\n+\n+ const node = this;\n+ const $server = $(\"#node-input-server\");\n+ const utils = {\n+ setDefaultServerSelection: function() {\n+ let defaultServer;\n+ RED.nodes.eachConfig(n => {\n+ if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n+ });\n+ if (defaultServer) $server.val(defaultServer);\n+ }\n+ };\n+\n+ if (!node.server) {\n+ utils.setDefaultServerSelection();\n+ }\n+\n+ const selectedServer = $server.val();\n+ if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n+ const serverId = node.server || selectedServer;\n+ $.getJSON(`homeassistant/${serverId}/entities`)\n+ .done(entities => {\n+ this.availableEntities = entities;\n+\n+ $entityIdField.autocomplete({\n+ source: this.availableEntities,\n+ minLength: 0,\n+ change: (evt, ui) => {\n+ const validSelection =\n+ this.availableEntities.indexOf($(evt.target).val()) > -1;\n+ }\n+ });\n+\n+ const validSelection =\n+ this.availableEntities.indexOf(this.entityId) > -1;\n+ })\n+ .fail(err => {\n+ const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n+\n+ if (serverConfig && serverConfig.dirty === true) {\n+ RED.notify(\n+ `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n+ err.responseText\n+ }`,\n+ \"error\"\n+ );\n+ }\n+ });\n+ $(\"#node-input-property\").autocomplete({\n+ source: function(request, response) {\n+ $.ajax({\n+ url: `homeassistant/${serverId}/properties`,\n+ dataType: \"json\",\n+ data: {\n+ term: request.term,\n+ entityId: $(\"#node-input-entityId\").val()\n+ },\n+ success: function(data) {\n+ response(data);\n+ }\n+ });\n+ },\n+ minLength: 0\n+ });\n+ }\n+ const defaultTypes = [\"str\", \"num\", \"bool\", \"re\"];\n+ $(\"#node-input-value\")\n+ .typedInput({\n+ default: \"str\",\n+ types: defaultTypes,\n+ typeField: \"#node-input-valueType\"\n+ })\n+ .typedInput(\"width\", \"50%\");\n+\n+ $(\"#node-input-comparator\").change(function(e) {\n+ let types = defaultTypes;\n+\n+ switch (e.target.value) {\n+ case \"is\":\n+ case \"is_not\":\n+ break;\n+ case \"lt\":\n+ case \"lte\":\n+ case \"gt\":\n+ case \"gte\":\n+ types = [\"num\"];\n+ break;\n+ case \"includes\":\n+ case \"does_not_include\":\n+ types = [\"str\"];\n+ break;\n+ }\n+ $(\"#node-input-value\").typedInput(\"types\", types);\n+ });\n+\n+ $(\"#node-input-timeout\").spinner({ min: 0 });\n+\n+ const NoneType = { value: \"none\", label: \"None\", hasValue: false };\n+ $(\"#node-input-entityLocation\")\n+ .typedInput({\n+ types: [\"msg\", \"flow\", \"global\", NoneType],\n+ typeField: \"#node-input-entityLocationType\"\n+ })\n+ .typedInput(\"width\", \"68%\");\n+ },\n+ oneditsave: function() {\n+ const outputs = $(\"#node-input-timeout\").val() > 0 ? 2 : 1;\n+ $(\"#node-input-outputs\").val(outputs);\n+ }\n+ });\n+</script>\n+\n+<script type=\"text/x-red\" data-template-name=\"ha-wait-until\">\n+ <div class=\"form-row\">\n+ <label for=\"node-input-name\"><i class=\"fa fa-tag\"></i> Name</label>\n+ <input type=\"text\" id=\"node-input-name\" placeholder=\"Name\">\n+ <input type=\"hidden\" id=\"node-input-outputs\"/>\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-server\"><i class=\"fa fa-server\"></i> Server</label>\n+ <input type=\"text\" id=\"node-input-server\" />\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"entityId\"><i class=\"fa fa-cube\"></i> Entity ID</label>\n+ <input type=\"text\" id=\"node-input-entityId\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-property\"><i class=\"fa fa-hand-paper-o\"></i> Wait Until</label>\n+ <input type=\"text\" id=\"node-input-property\" placeholder=\"property\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <select id=\"node-input-comparator\" style=\"margin-right: 5px;margin-left: 105px;width: auto;\">\n+ <option value=\"is\">is</option>\n+ <option value=\"is_not\">is not</option>\n+ <option value=\"lt\"><</option>\n+ <option value=\"lte\"><=</option>\n+ <option value=\"gt\">></option>\n+ <option value=\"gte\">>=</option>\n+ <option value=\"includes\">in</option>\n+ <option value=\"does_not_include\">not in</option>\n+ </select>\n+ <input id=\"node-input-valueType\" type=\"hidden\">\n+ <input id=\"node-input-value\" type=\"text\" placeholder=\"value\" style=\"width: 46%;\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-timeout\"><i class=\"fa fa-clock-o\"></i> Timeout</label>\n+ <input type=\"text\" id=\"node-input-timeout\" style=\"text-align:end; width:50px !important\">\n+ <select id=\"node-input-timeoutUnits\" style=\"width:auto !important\">\n+ <option value=\"milliseconds\">milliseconds</option>\n+ <option value=\"seconds\">seconds</option>\n+ <option value=\"minutes\">minutes</option>\n+ <option value=\"hours\">hours</option>\n+ <option value=\"days\">days</option>\n+ </select>\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-entityLocation\">Entity Location</label>\n+ <input type=\"hidden\" id=\"node-input-entityLocationType\" />\n+ <input type=\"text\" id=\"node-input-entityLocation\" />\n+ </div>\n+</script>\n+\n+<script type=\"text/x-red\" data-help-name=\"ha-wait-until\">\n+ <p>When an input is received the node will wait until the condition is met or the timeout occurs then will pass on the last received message.</p>\n+\n+ <h3>Inputs</h3>\n+ <dl class=\"message-properties\">\n+ <dt class=\"optional\">reset <span class=\"property-type\"></span> </dt>\n+ <dd>If the received message has this property set to any value the node will be set to inactive and the timeout cleared.</dd>\n+ </dl>\n+\n+ <h3>Configuration</h3>\n+ <dl class=\"message-properties\">\n+ <dt>Entity ID<span class=\"property-type\">string</span></dt>\n+ <dd>The id of a of an entity to use for the comparison.</dd>\n+\n+ <dt>Wait Until <span class=\"property-type\">string</span></dt>\n+ <dd>The <code>property</code> field will be checked against the <code>value</code> field using the comparator.</dd>\n+\n+ <dt>Timeout<span class=\"property-type\">number</span></dt>\n+ <dd>The amount of time to wait for the condition to become true before deactivating the node and passing the message object to the second output. If the timeout is equal to zero the node will wait indefinitely for the condition to be met..</dd>\n+\n+ <dt>Entity Location <span class=\"property-type optional\">object</span></dt>\n+ <dd>The entity object can also be pass with the message object.</dd>\n+ </dl>\n+\n+ <h3>Outputs</h3>\n+ Will output the last received message when the condition is true or the timeout occurs. If the condition becomes true the message will be pass to the first output. If the timeout passes the message will be sent to the second output.\n+</script>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "nodes/wait-until/wait-until.js",
"diff": "+module.exports = function(RED) {\n+ const EventsNode = require('../../lib/events-node');\n+\n+ const nodeOptions = {\n+ config: {\n+ name: {},\n+ server: { isNode: true },\n+ outputs: 1,\n+ entityId: {},\n+ property: {},\n+ comparator: {},\n+ value: {},\n+ valueType: {},\n+ timeout: {},\n+ timeoutUnits: {},\n+ entityLocation: {},\n+ entityLocationType: {}\n+ }\n+ };\n+\n+ class WaitUntilNode extends EventsNode {\n+ constructor(nodeDefinition) {\n+ super(nodeDefinition, RED, nodeOptions);\n+ this.active = false;\n+ this.savedMessage = {};\n+ this.timeoutId = -1;\n+\n+ this.addEventClientListener({\n+ event: `ha_events:state_changed:${this.nodeConfig.entityId}`,\n+ handler: this.onEntityChange.bind(this)\n+ });\n+ }\n+\n+ async onEntityChange(evt) {\n+ try {\n+ const config = this.nodeConfig;\n+ const { event } = this.utils.merge({}, evt);\n+\n+ if (!this.active) {\n+ return null;\n+ }\n+\n+ const result = await this.getComparatorResult(\n+ config.comparator,\n+ config.value,\n+ this.utils.selectn(config.property, event.new_state),\n+ config.valueType\n+ );\n+\n+ if (!result) {\n+ return null;\n+ }\n+\n+ clearTimeout(this.timeoutId);\n+ this.active = false;\n+ this.status({\n+ fill: 'green',\n+ text: `true at: ${this.getPrettyDate()}`\n+ });\n+\n+ if (\n+ config.entityLocationType !== 'none' &&\n+ config.entityLocation\n+ ) {\n+ event.new_state.timeSinceChangedMs =\n+ Date.now() -\n+ new Date(event.new_state.last_changed).getTime();\n+ const contextKey = RED.util.parseContextStore(\n+ config.entityLocation\n+ );\n+ contextKey.key = contextKey.key || 'data';\n+ const locationType = config.entityLocationType || 'msg';\n+\n+ if (locationType === 'flow' || locationType === 'global') {\n+ this.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ event.new_state,\n+ contextKey.store\n+ );\n+ } else if (locationType === 'msg') {\n+ this.savedMessage[contextKey.key] = event.new_state;\n+ }\n+ }\n+\n+ this.send([this.savedMessage, null]);\n+ } catch (e) {\n+ this.error(e);\n+ }\n+ }\n+\n+ onInput({ parsedMessage, message }) {\n+ const node = this;\n+ const config = node.nodeConfig;\n+\n+ clearTimeout(node.timeoutId);\n+ if (message.hasOwnProperty('reset')) {\n+ node.status({ text: 'reset' });\n+ node.active = false;\n+ return null;\n+ }\n+\n+ node.savedMessage = message;\n+ node.active = true;\n+ let statusText = 'waiting';\n+\n+ if (config.timeout > 0) {\n+ if (config.timeoutUnits === 'milliseconds') {\n+ node.timeout = config.timeout;\n+ statusText = `waiting for ${config.timeout} milliseconds`;\n+ } else if (config.timeoutUnits === 'minutes') {\n+ node.timeout = config.timeout * (60 * 1000);\n+ statusText = `waiting for ${config.timeout} minutes`;\n+ } else if (config.timeoutUnits === 'hours') {\n+ node.timeout = config.timeout * (60 * 60 * 1000);\n+ statusText = node.timeoutStatus(node.timeout);\n+ } else if (config.timeoutUnits === 'days') {\n+ node.timeout = config.timeout * (24 * 60 * 60 * 1000);\n+ statusText = node.timeoutStatus(node.timeout);\n+ } else {\n+ node.timeout = config.timeout * 1000;\n+ statusText = `waiting for ${config.timeout} seconds`;\n+ }\n+\n+ node.timeoutId = setTimeout(async function() {\n+ const state = await config.server.homeAssistant.getStates(\n+ config.entityId\n+ );\n+\n+ if (\n+ config.entityLocationType !== 'none' &&\n+ config.entityLocation\n+ ) {\n+ state.timeSinceChangedMs =\n+ Date.now() - new Date(state.last_changed).getTime();\n+\n+ const contextKey = RED.util.parseContextStore(\n+ config.entityLocation\n+ );\n+ contextKey.key = contextKey.key || 'data';\n+ const locationType = config.entityLocationType || 'msg';\n+\n+ if (\n+ locationType === 'flow' ||\n+ locationType === 'global'\n+ ) {\n+ this.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ state,\n+ contextKey.store\n+ );\n+ } else if (locationType === 'msg') {\n+ message[contextKey.key] = state;\n+ }\n+ }\n+\n+ node.active = false;\n+ node.send([null, message]);\n+ node.status({\n+ fill: 'red',\n+ shape: 'dot',\n+ text: `timed out at: ${node.getPrettyDate()}`\n+ });\n+ }, node.timeout);\n+ }\n+ node.status({ fill: 'blue', text: statusText });\n+ }\n+\n+ timeoutStatus(milliseconds = 0) {\n+ const timeout = Date.now() + milliseconds;\n+ const timeoutStr = new Date(timeout).toLocaleDateString('en-US', {\n+ month: 'short',\n+ day: 'numeric',\n+ hour12: false,\n+ hour: 'numeric',\n+ minute: 'numeric'\n+ });\n+\n+ return `waiting until ${timeoutStr}`;\n+ }\n+ }\n+\n+ RED.nodes.registerType('ha-wait-until', WaitUntilNode);\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"api-current-state\": \"nodes/current-state/current-state.js\",\n\"ha-get-entities\": \"nodes/get-entities/get-entities.js\",\n\"api-get-history\": \"nodes/get-history/get-history.js\",\n- \"api-render-template\": \"nodes/render-template/render-template.js\"\n+ \"api-render-template\": \"nodes/render-template/render-template.js\",\n+ \"ha-wait-until\": \"nodes/wait-until/wait-until.js\"\n}\n},\n\"dependencies\": {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(wait-until): New 'Wait Until' Node
Closes Closes #82 |
748,234 | 01.02.2019 19:18:31 | 28,800 | 8205236c5a9b4fc7564ebc0a1a85f2e7dc145ef3 | fix: Fix for nodes to trigger on deploy
Fix for trigger-state and event-state node to trigger when a node is
deployed and just not when the server-config is deployed
Closes FIXES | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.js",
"new_path": "nodes/events-state-changed/events-state-changed.js",
"diff": "@@ -42,14 +42,19 @@ module.exports = function(RED) {\n});\nif (this.nodeConfig.outputinitially) {\n+ // Here for when the node is deploy without the server config being deployed\n+ if (this.isConnected) {\n+ this.onDeploy();\n+ } else {\nthis.addEventClientListener({\nevent: 'ha_events:states_loaded',\n- handler: this.onDeploy.bind(this)\n+ handler: this.onStatesLoaded.bind(this)\n});\n}\n}\n+ }\n- async onHaEventsStateChanged(evt) {\n+ async onHaEventsStateChanged(evt, runAll) {\ntry {\nconst { entity_id, event } = this.utils.merge({}, evt);\n@@ -85,6 +90,7 @@ module.exports = function(RED) {\n}\nif (\n+ runAll === undefined &&\nthis.nodeConfig.output_only_on_state_change === true &&\nevent.old_state.state === event.new_state.state\n) {\n@@ -152,7 +158,10 @@ module.exports = function(RED) {\nasync onDeploy() {\nconst entities = await this.nodeConfig.server.homeAssistant.getStates();\n+ this.onStatesLoaded(entities);\n+ }\n+ onStatesLoaded(entities) {\nfor (let entityId in entities) {\nlet eventMessage = {\nevent_type: 'state_changed',\n@@ -164,7 +173,7 @@ module.exports = function(RED) {\n}\n};\n- this.onHaEventsStateChanged(eventMessage);\n+ this.onHaEventsStateChanged(eventMessage, true);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.js",
"new_path": "nodes/trigger-state/trigger-state.js",
"diff": "@@ -48,12 +48,17 @@ module.exports = function(RED) {\nthis.loadPersistedData();\nif (this.nodeConfig.outputinitially) {\n+ // Here for when the node is deploy without the server config being deployed\n+ if (this.isConnected) {\n+ this.onDeploy();\n+ } else {\nthis.addEventClientListener({\nevent: 'ha_events:states_loaded',\n- handler: this.onDeploy.bind(this)\n+ handler: this.onStatesLoaded.bind(this)\n});\n}\n}\n+ }\nonInput({ message }) {\nif (message === 'enable' || message.payload === 'enable') {\n@@ -83,7 +88,10 @@ module.exports = function(RED) {\nasync onDeploy() {\nconst entities = await this.nodeConfig.server.homeAssistant.getStates();\n+ this.onStatesLoaded(entities);\n+ }\n+ onStatesLoaded(entities) {\nfor (let entityId in entities) {\nlet eventMessage = {\nevent_type: 'state_changed',\n@@ -95,7 +103,7 @@ module.exports = function(RED) {\n}\n};\n- this.onEntityStateChanged(eventMessage);\n+ this.onEntityStateChanged(eventMessage, true);\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: Fix for nodes to trigger on deploy
Fix for trigger-state and event-state node to trigger when a node is
deployed and just not when the server-config is deployed
Closes FIXES #80 |
748,234 | 01.02.2019 21:05:28 | 28,800 | 362761cd5b30697f14dba5c589ddbf1714b08012 | build(scripts): Changed prerelease keyword | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"lint\": \"eslint .\",\n\"lint:fix\": \"eslint . --fix\",\n\"release\": \"standard-version\",\n- \"prerelease\": \"standard-version -p\"\n+ \"release:pre\": \"standard-version -p\"\n},\n\"repository\": {\n\"type\": \"git\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | build(scripts): Changed prerelease keyword |
748,234 | 02.02.2019 10:02:27 | 28,800 | c543c678ee8a750f00a445c0f5eba50ba6558bc4 | refactor(current-state): Small fixes
Added tooltip for the second output of the node. Fixed hmtl entity, and
set override topic default to unchecked | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n+ outputLabels: [\"\", \"halt if\"],\nicon: \"code.png\",\npaletteLabel: \"current state\",\nlabel: function() {\nhalt_if: { value: \"\" },\nhalt_if_type: { value: \"str\" },\nhalt_if_compare: { value: \"is\" },\n- override_topic: { value: true },\n+ override_topic: { value: false },\nentity_id: { value: \"\" },\nstate_type: { value: \"str\" },\nstate_location: { value: \"payload\" },\n<dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n<dt>State Location<span class=\"property-type\">string</span></dt>\n- <dd>Customizable location for the entity's state. Defaults to <code>msg.payload</code></dd>\n+ <dd>Customizable location for the entity’s state. Defaults to <code>msg.payload</code></dd>\n<dt>Entity Location<span class=\"property-type\">string</span></dt>\n<dd>Customizable location for the <a href=\"https://www.home-assistant.io/docs/configuration/state_object/\" target=\"_blank\">entity object</a>. Defaults to <code>msg.data</code></dd>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(current-state): Small fixes
Added tooltip for the second output of the node. Fixed hmtl entity, and
set override topic default to unchecked |
748,234 | 02.02.2019 21:08:12 | 28,800 | 62e22fa4abc191b835e0a19c97e2d87192c3b4ed | fix(trigger-state): Fix to show the correct properties for constraints
Fix to show the correct properties based on if 'This entity' or 'Entity
ID' is selected | [
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "},\noneditprepare: function() {\n// Outputs List\n- let NODE = this;\n+ let node = this;\nconst NUM_DEFAULT_OUTPUTS = 2;\nconst $entityid = $(\"#node-input-entityid\");\nconst selectedServer = $server.val();\n// A home assistant server is selected in the node config\n- if (NODE.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = NODE.server || selectedServer;\n+ if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n+ const serverId = node.server || selectedServer;\n$.getJSON(`homeassistant/${serverId}/entities`)\n.done(entities => {\n- NODE.availableEntities = entities;\n+ node.availableEntities = entities;\n$entityid.autocomplete({\n- source: NODE.availableEntities,\n+ source: node.availableEntities,\nminLength: 0\n});\n$(\"#constraint-target-value\").autocomplete({\n- source: NODE.availableEntities,\n+ source: node.availableEntities,\nminLength: 0\n});\n})\n});\n$.getJSON(`homeassistant/${serverId}/properties`)\n.done(entities => {\n- NODE.availableProperties = entities;\n- $(\n- \"#constraint-property-value,#output-comparator-property-value\"\n- ).autocomplete({\n- source: NODE.availableProperties,\n+ node.availableProperties = entities;\n+ // prefix properties with new_state and old_state\n+ node.availablePropertiesPrefixes = []\n+ .concat(\n+ entities.map(e => `new_state.${e}`),\n+ entities.map(e => `old_state.${e}`)\n+ )\n+ .sort();\n+ $(\"#constraint-property-value\").autocomplete({\n+ source: node.availablePropertiesPrefixes,\n+ minLength: 0\n+ });\n+ $(\"#output-comparator-property-value\").autocomplete({\n+ source: node.availableProperties,\nminLength: 0\n});\n+ $(\"#constraint-target-type\").on(\"change\", function() {\n+ $(\"#constraint-property-value\").autocomplete(\"option\", {\n+ source:\n+ $(this).val() === \"this_entity\"\n+ ? node.availablePropertiesPrefixes\n+ : node.availableProperties\n+ });\n+ });\n})\n.fail(err => {});\n}\n// Removing an output and adding in same edit session means output\n// map needs to be adjusted, otherwise just increment count\n- if (isNaN(NODE.outputs)) {\n- const maxOutput = Math.max(Object.keys(NODE.outputs));\n- NODE.outputs[utils.getRandomId()] = maxOutput + 1;\n+ if (isNaN(node.outputs)) {\n+ const maxOutput = Math.max(Object.keys(node.outputs));\n+ node.outputs[utils.getRandomId()] = maxOutput + 1;\n} else {\n- NODE.outputs = parseInt(NODE.outputs) + 1;\n+ node.outputs = parseInt(node.outputs) + 1;\n}\n$outputs.val(\n- isNaN(NODE.outputs) ? JSON.stringify(NODE.outputs) : NODE.outputs\n+ isNaN(node.outputs) ? JSON.stringify(node.outputs) : node.outputs\n);\nif (output.comparatorPropertyType === \"current_state\")\nif (output.comparatorPropertyType === \"previous_state\")\noutput.comparatorPropertyValue = \"old_state.state\";\n- NODE.customoutputs.push(output);\n+ node.customoutputs.push(output);\n$customoutputs.list.editableList(\"addItem\", output);\n},\n// node-red uses a map of old output index to new output index to re-map\n// links between nodes. If new index is -1 then it was removed\n- let customOutputRemovedIndex = NODE.customoutputs.indexOf(data);\n- NODE.outputs = !isNaN(NODE.outputs) ? { 0: 0, 1: 1 } : NODE.outputs;\n- NODE.outputs[customOutputRemovedIndex + NUM_DEFAULT_OUTPUTS] = -1;\n+ let customOutputRemovedIndex = node.customoutputs.indexOf(data);\n+ node.outputs = !isNaN(node.outputs) ? { 0: 0, 1: 1 } : node.outputs;\n+ node.outputs[customOutputRemovedIndex + NUM_DEFAULT_OUTPUTS] = -1;\n- NODE.customoutputs.forEach((o, customOutputIndex) => {\n+ node.customoutputs.forEach((o, customOutputIndex) => {\nconst customAllIndex = customOutputIndex + NUM_DEFAULT_OUTPUTS;\nconst outputIsBeforeRemoval =\ncustomOutputIndex < customOutputRemovedIndex;\n- const customOutputAlreadyMapped = NODE.outputs.hasOwnProperty(\n+ const customOutputAlreadyMapped = node.outputs.hasOwnProperty(\ncustomAllIndex\n);\n// output already removed\nif (\ncustomOutputAlreadyMapped &&\n- NODE.outputs[customAllIndex] === -1\n+ node.outputs[customAllIndex] === -1\n)\nreturn;\n// output previously removed caused this output to be remapped\nif (customOutputAlreadyMapped) {\n- NODE.outputs[customAllIndex] = outputIsBeforeRemoval\n- ? NODE.outputs[customAllIndex]\n- : NODE.outputs[customAllIndex] - 1;\n+ node.outputs[customAllIndex] = outputIsBeforeRemoval\n+ ? node.outputs[customAllIndex]\n+ : node.outputs[customAllIndex] - 1;\nreturn;\n}\n// output exists after removal and hasn't been mapped, remap to current index - 1\n- NODE.outputs[customAllIndex] = outputIsBeforeRemoval\n+ node.outputs[customAllIndex] = outputIsBeforeRemoval\n? customAllIndex\n: customAllIndex - 1;\n});\n- $outputs.val(JSON.stringify(NODE.outputs));\n+ $outputs.val(JSON.stringify(node.outputs));\n},\nonMessageTypeChange: function(e) {\nconst val = e.target.value;\nheightStyle: \"content\"\n});\n- $entityid.val(NODE.entityid);\n+ $entityid.val(node.entityid);\n$server.change(() => utils.setupAutocomplete(this));\n// New nodes, select first available home-assistant config node found\n- if (!NODE.server) {\n+ if (!node.server) {\nutils.setDefaultServerSelection();\n} else {\nutils.setupAutocomplete();\n}\n// Add previous constraints/outputs to editable lists\n- NODE.constraints.forEach(c =>\n+ node.constraints.forEach(c =>\n$constraints.list.editableList(\"addItem\", c)\n);\n- NODE.customoutputs.forEach(o =>\n+ node.customoutputs.forEach(o =>\n$customoutputs.list.editableList(\"addItem\", o)\n);\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.js",
"new_path": "nodes/trigger-state/trigger-state.js",
"diff": "@@ -103,7 +103,7 @@ module.exports = function(RED) {\n}\n};\n- this.onEntityStateChanged(eventMessage, true);\n+ this.onEntityStateChanged(eventMessage);\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(trigger-state): Fix to show the correct properties for constraints
Fix to show the correct properties based on if 'This entity' or 'Entity
ID' is selected |
748,234 | 03.02.2019 23:05:01 | 28,800 | 83018e944779208ce283361e4a7a58ea53953aca | fix(config-server): Removed needsPermission from static files
This is not needed for static files because no sensitive information is
stored there. Also fixes the ability to read static files when auth is
enabled. | [
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -134,17 +134,15 @@ module.exports = function(RED) {\nhttpHandlers.getProperties.bind(this)\n);\n- const HTTP_STATIC_OPTS = {\n+ this.RED.httpAdmin.get('/homeassistant/static/*', function(\n+ req,\n+ res\n+ ) {\n+ res.sendFile(req.params[0], {\nroot: require('path').join(__dirname, '..', '/_static'),\ndotfiles: 'deny'\n- };\n- this.RED.httpAdmin.get(\n- '/homeassistant/static/*',\n- RED.auth.needsPermission('server.read'),\n- function(req, res) {\n- res.sendFile(req.params[0], HTTP_STATIC_OPTS);\n- }\n- );\n+ });\n+ });\nthis.setOnContext('states', []);\nthis.setOnContext('services', []);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(config-server): Removed needsPermission from static files
This is not needed for static files because no sensitive information is
stored there. Also fixes the ability to read static files when auth is
enabled. |
748,234 | 11.02.2019 16:59:13 | 28,800 | 8bd6e42a3a1783f0157d7e24ad24cff09a86aa20 | fix(get-history): fix backwards compatibility for output location
mit/3154f79a5758c74967742e282660dac1decfbe74#r32270616 | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -135,6 +135,11 @@ module.exports = function(RED) {\nreturn null;\n}\n+ if (this.nodeConfig.output_location === undefined) {\n+ this.nodeConfig.output_location = 'payload';\n+ this.nodeConfig.output_location_type = 'msg';\n+ }\n+\nswitch (this.nodeConfig.output_type) {\ncase 'split':\nif (results.length === 0) {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(get-history): fix backwards compatibility for output location
https://github.com/zachowj/node-red-contrib-home-assistant-websocket/com
mit/3154f79a5758c74967742e282660dac1decfbe74#r32270616 |
748,234 | 12.02.2019 11:15:29 | 28,800 | c6343a90fbfe25de075f82e6d32cfbfdb8484e10 | feat(wait-until): Added ability to check against current state
Ability to check against current state and not wait for the state to
change | [
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "timeout: { value: 0 },\ntimeoutUnits: { value: \"seconds\" },\nentityLocation: { value: \"data\" },\n- entityLocationType: { value: \"none\" }\n+ entityLocationType: { value: \"none\" },\n+ checkCurrentState: { value: true }\n},\noneditprepare: function() {\nconst $entityIdField = $(\"#node-input-entityId\");\nminLength: 0\n});\n}\n+\n+ if (node.checkCurrentState === undefined) {\n+ $(\"#node-input-checkCurrentState\").prop(\"checked\", false);\n+ }\n+\nconst defaultTypes = [\"str\", \"num\", \"bool\", \"re\"];\n$(\"#node-input-value\")\n.typedInput({\n<input type=\"hidden\" id=\"node-input-entityLocationType\" />\n<input type=\"text\" id=\"node-input-entityLocation\" />\n</div>\n+\n+ <div class=\"form-row\">\n+ <input type=\"checkbox\" id=\"node-input-checkCurrentState\" checked style=\"margin-left:105px;display:inline-block; width:auto; vertical-align:baseline;\"> \n+ <label for=\"node-input-checkCurrentState\" style=\"width: auto;margin-right: 20px;\">Check against current state</label>\n+ </div>\n</script>\n<script type=\"text/x-red\" data-help-name=\"ha-wait-until\">\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -14,7 +14,8 @@ module.exports = function(RED) {\ntimeout: {},\ntimeoutUnits: {},\nentityLocation: {},\n- entityLocationType: {}\n+ entityLocationType: {},\n+ checkCurrentState: {}\n}\n};\n@@ -90,7 +91,7 @@ module.exports = function(RED) {\n}\n}\n- onInput({ parsedMessage, message }) {\n+ async onInput({ parsedMessage, message }) {\nconst node = this;\nconst config = node.nodeConfig;\n@@ -167,6 +168,14 @@ module.exports = function(RED) {\n}, node.timeout);\n}\nnode.status({ fill: 'blue', text: statusText });\n+\n+ if (config.checkCurrentState === true) {\n+ const currentState = await this.nodeConfig.server.homeAssistant.getStates(\n+ config.entityId\n+ );\n+\n+ node.onEntityChange({ event: { new_state: currentState } });\n+ }\n}\ntimeoutStatus(milliseconds = 0) {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(wait-until): Added ability to check against current state
Ability to check against current state and not wait for the state to
change |
748,234 | 12.02.2019 21:03:11 | 28,800 | 38a16fbe37d2ae66aa42a7d3be1f2704403cd07f | fix(mustache-context): catch error thrown for invalid flow and global var | [
{
"change_type": "MODIFY",
"old_path": "lib/mustache-context.js",
"new_path": "lib/mustache-context.js",
"diff": "@@ -46,7 +46,9 @@ NodeContext.prototype.lookup = function(name) {\nconst field = context.field;\nconst target = this.nodeContext[type];\nif (target) {\n+ try {\nreturn target.get(field, store);\n+ } catch (err) {}\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(mustache-context): catch error thrown for invalid flow and global var |
748,234 | 18.02.2019 18:01:50 | 28,800 | 97906a9f28ff53ec59db8cc10684b06ded482bd1 | refactor(ha-http): Renamed ha-api to ha-http | [
{
"change_type": "RENAME",
"old_path": "lib/ha-api.js",
"new_path": "lib/ha-http.js",
"diff": "@@ -4,7 +4,7 @@ const https = require('https');\nconst utils = require('./utils');\nconst debug = require('debug')('home-assistant:api');\n-class HaApi {\n+class HaHttp {\nconstructor(config) {\nthis.config = config;\nconst apiOpts = { baseURL: config.baseUrl + '/api' };\n@@ -42,7 +42,7 @@ class HaApi {\nparams.end_time = endTimestamp;\n}\n- // History returns an array for each entity_id and that array containes objects for each history item\n+ // History returns an array for each entity_id and that array contains objects for each history item\nreturn this._get(path, params).then(result => {\nif (!include && !exclude && !flatten) {\nreturn result;\n@@ -121,7 +121,7 @@ class HaApi {\n.post(path, data)\n.then(res => res.data || '')\n.catch(err => {\n- debug(`POST: request errror: ${err.toString()}`);\n+ debug(`POST: request error: ${err.toString()}`);\nthrow err;\n});\n}\n@@ -133,10 +133,10 @@ class HaApi {\n.request({ url: path, params: params })\n.then(res => res.data || '')\n.catch(err => {\n- debug(`GET: request errror: ${err.toString()}`);\n+ debug(`GET: request error: ${err.toString()}`);\nthrow err;\n});\n}\n}\n-module.exports = HaApi;\n+module.exports = HaHttp;\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/node-home-assistant.js",
"new_path": "lib/node-home-assistant.js",
"diff": "'use strict';\nconst debug = require('debug')('home-assistant');\nconst HaWebsocket = require('./ha-websocket');\n-const HaApi = require('./ha-api');\n+const HaHttp = require('./ha-http');\nconst DEFAULTS = {\nbaseUrl: null,\n@@ -23,7 +23,7 @@ class HomeAssistant {\nconstructor(config) {\ndebug('Instantiating HomeAssistant');\nthis.config = Object.assign({}, DEFAULTS, config);\n- this.api = new HaApi(this.config);\n+ this.api = new HaHttp(this.config);\nthis.websocket = new HaWebsocket(this.config);\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(ha-http): Renamed ha-api to ha-http |
748,234 | 20.02.2019 03:56:02 | 28,800 | 7a10e3d04475f87ac2a5c5a0c8001959165bc829 | docs(trigger-state): Added information for constraints & custom outputs
Closes | [
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "<dt class=\"optional\">\n[payload|msg]<span class=\"property-type\">string|object</span>\n</dt>\n- <dd>If incoming payload or message is a string and equal to 'enable' or 'disable' then set the node accordingly.</dd>\n+ <dd>\n+ If incoming payload or message is a string and equal to 'enable' or 'disable' then set the node accordingly.\n+ Saves over restarts.\n+ </dd>\n- <dt>Output Initially<span class=\"property-type\">boolean</span></dt>\n- <dd>Output once on startup/deploy then on each interval</dd>\n+ <dt>Output Initially<sp class=\"property-type\">boolean</span></dt>\n+ <dd>Output once on startup/deploy.</dd>\n</dl>\n<h3>Outputs</h3>\n<dt>\ntopic <span class=\"property-type\">string</span>\n</dt>\n- <dd>the entity_id that triggered the node</dd>\n+ <dd>The entity_id that triggered the node</dd>\n<dt>\npayload <span class=\"property-type\">string</span>\n</dt>\n- <dd>the state as sent by home assistant</dd>\n+ <dd>The state as sent by home assistant</dd>\n<dt>\ndata <span class=\"property-type\">object</span>\n</dt>\n- <dd>the original home assistant event containing <code>entity_id</code> <code>new_state</code> and <code>old_state</code> properties </dd>\n+ <dd>The original home assistant event containing <code>entity_id</code> <code>new_state</code> and <code>old_state</code> properties</dd>\n</dl>\n<h3>Details</h3>\n- <p>Coming soon...</p>\n- <p> TODO Document: Enable / Disable and how it saves state across restarts</p>\n- <p> TODO Document: Constraints and how they work</p>\n- <p> TODO Document: Custom Outputs and how they work</p>\n- <p> TODO Document: Debug flag on node</p>\n- <p> NOTE: To test automation without having to manually change state in home assistant send an input <code>payload</code> as an object which contains <code>entity_id</code>, <code>new_state</code>, and <code>old_state</code> properties. This will trigger the node as if the event came from home assistant.</p>\n+ <dl class=\"message-properties\">\n+ <dt>Constraints</dt>\n+ <dd>This node has two default outputs \"allowed\" and \"blocked\". If all the constraints are true the default message will be sent to the \"allowed\" output otherwise it will be sent to the \"blocked\" output.</dd>\n+\n+ <dt>Custom Outputs</dt>\n+ <dd>All the above constraints need to be true for any custom outputs to be sent, having zero constraints is a valid option. Each custom output can send the default message or a custom message. Also, each one can have its own constraint whether or not to be sent.</dd>\n+ </dl>\n+\n+ <h3>Testing</h3>\n+ <p>To test automation without having to manually change state in home assistant send an input <code>payload</code> as an object which contains <code>entity_id</code>, <code>new_state</code>, and <code>old_state</code> properties. This will trigger the node as if the event came from home assistant.</p>\n+\n+ <code>\n+ <pre>\n+ {\n+ \"entity_id\": \"test_entity\",\n+ \"old_state\": {\n+ \"state\": \"on\"\n+ },\n+ \"new_state\": {\n+ \"state\": \"off\"\n+ }\n+ }</pre>\n+ </code>\n<h3>References</h3>\n<ul>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | docs(trigger-state): Added information for constraints & custom outputs
Closes #86 |
748,234 | 20.02.2019 04:02:38 | 28,800 | ef07e7ae907a5f565875d8aa4a2abf4a4653d13e | chore(packages): Updated mocha, eslint and ws | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "},\n\"chalk\": {\n\"version\": \"1.1.3\",\n- \"resolved\": \"https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n\"integrity\": \"sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=\",\n\"dev\": true,\n\"requires\": {\n},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n\"string-width\": \"^2.0.0\"\n}\n},\n+ \"ansi-colors\": {\n+ \"version\": \"3.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz\",\n+ \"integrity\": \"sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==\",\n+ \"dev\": true\n+ },\n\"ansi-escapes\": {\n\"version\": \"3.2.0\",\n\"resolved\": \"https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz\",\n\"dependencies\": {\n\"callsites\": {\n\"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz\",\n\"integrity\": \"sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=\",\n\"dev\": true\n}\n},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n\"integrity\": \"sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=\",\n\"dev\": true\n},\n+ \"cliui\": {\n+ \"version\": \"4.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz\",\n+ \"integrity\": \"sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"string-width\": \"^2.1.1\",\n+ \"strip-ansi\": \"^4.0.0\",\n+ \"wrap-ansi\": \"^2.0.0\"\n+ },\n+ \"dependencies\": {\n+ \"ansi-regex\": {\n+ \"version\": \"2.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz\",\n+ \"integrity\": \"sha1-w7M6te42DYbg5ijwRorn7yfWVN8=\",\n+ \"dev\": true\n+ },\n+ \"is-fullwidth-code-point\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz\",\n+ \"integrity\": \"sha1-754xOG8DGn8NZDr4L95QxFfvAMs=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"number-is-nan\": \"^1.0.0\"\n+ }\n+ },\n+ \"wrap-ansi\": {\n+ \"version\": \"2.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz\",\n+ \"integrity\": \"sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"string-width\": \"^1.0.1\",\n+ \"strip-ansi\": \"^3.0.1\"\n+ },\n+ \"dependencies\": {\n+ \"string-width\": {\n+ \"version\": \"1.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz\",\n+ \"integrity\": \"sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"code-point-at\": \"^1.0.0\",\n+ \"is-fullwidth-code-point\": \"^1.0.0\",\n+ \"strip-ansi\": \"^3.0.0\"\n+ }\n+ },\n+ \"strip-ansi\": {\n+ \"version\": \"3.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"ansi-regex\": \"^2.0.0\"\n+ }\n+ }\n+ }\n+ }\n+ }\n+ },\n\"clone\": {\n\"version\": \"2.1.2\",\n\"resolved\": \"https://registry.npmjs.org/clone/-/clone-2.1.2.tgz\",\n}\n}\n},\n+ \"decamelize\": {\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz\",\n+ \"integrity\": \"sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=\",\n+ \"dev\": true\n+ },\n\"decode-uri-component\": {\n\"version\": \"0.2.0\",\n\"resolved\": \"https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz\",\n}\n}\n},\n+ \"define-properties\": {\n+ \"version\": \"1.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz\",\n+ \"integrity\": \"sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"object-keys\": \"^1.0.12\"\n+ }\n+ },\n\"define-property\": {\n\"version\": \"2.0.2\",\n\"resolved\": \"https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz\",\n\"integrity\": \"sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=\",\n\"dev\": true\n},\n+ \"detect-file\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz\",\n+ \"integrity\": \"sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=\",\n+ \"dev\": true\n+ },\n\"detect-indent\": {\n\"version\": \"4.0.0\",\n\"resolved\": \"https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz\",\n\"is-arrayish\": \"^0.2.1\"\n}\n},\n+ \"es-abstract\": {\n+ \"version\": \"1.13.0\",\n+ \"resolved\": \"https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz\",\n+ \"integrity\": \"sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"es-to-primitive\": \"^1.2.0\",\n+ \"function-bind\": \"^1.1.1\",\n+ \"has\": \"^1.0.3\",\n+ \"is-callable\": \"^1.1.4\",\n+ \"is-regex\": \"^1.0.4\",\n+ \"object-keys\": \"^1.0.12\"\n+ }\n+ },\n+ \"es-to-primitive\": {\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz\",\n+ \"integrity\": \"sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"is-callable\": \"^1.1.4\",\n+ \"is-date-object\": \"^1.0.1\",\n+ \"is-symbol\": \"^1.0.2\"\n+ }\n+ },\n\"es5-ext\": {\n\"version\": \"0.10.46\",\n\"resolved\": \"https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz\",\n\"dev\": true\n},\n\"eslint\": {\n- \"version\": \"5.14.0\",\n- \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.14.0.tgz\",\n- \"integrity\": \"sha512-jrOhiYyENRrRnWlMYANlGZTqb89r2FuRT+615AabBoajhNjeh9ywDNlh2LU9vTqf0WYN+L3xdXuIi7xuj/tK9w==\",\n+ \"version\": \"5.14.1\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.14.1.tgz\",\n+ \"integrity\": \"sha512-CyUMbmsjxedx8B0mr79mNOqetvkbij/zrXnFeK2zc3pGRn3/tibjiNAv/3UxFEyfMDjh+ZqTrJrEGBFiGfD5Og==\",\n\"dev\": true,\n\"requires\": {\n\"@babel/code-frame\": \"^7.0.0\",\n}\n}\n},\n+ \"expand-tilde\": {\n+ \"version\": \"2.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz\",\n+ \"integrity\": \"sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"homedir-polyfill\": \"^1.0.1\"\n+ }\n+ },\n\"express\": {\n\"version\": \"4.16.4\",\n\"resolved\": \"https://registry.npmjs.org/express/-/express-4.16.4.tgz\",\n\"locate-path\": \"^2.0.0\"\n}\n},\n+ \"findup-sync\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz\",\n+ \"integrity\": \"sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"detect-file\": \"^1.0.0\",\n+ \"is-glob\": \"^3.1.0\",\n+ \"micromatch\": \"^3.0.4\",\n+ \"resolve-dir\": \"^1.0.1\"\n+ }\n+ },\n\"flat\": {\n\"version\": \"4.1.0\",\n\"resolved\": \"https://registry.npmjs.org/flat/-/flat-4.1.0.tgz\",\n\"simple-git\": \"^1.85.0\"\n}\n},\n+ \"get-caller-file\": {\n+ \"version\": \"1.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz\",\n+ \"integrity\": \"sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==\",\n+ \"dev\": true\n+ },\n\"get-func-name\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz\",\n\"ini\": \"^1.3.4\"\n}\n},\n+ \"global-modules\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz\",\n+ \"integrity\": \"sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"global-prefix\": \"^1.0.1\",\n+ \"is-windows\": \"^1.0.1\",\n+ \"resolve-dir\": \"^1.0.0\"\n+ }\n+ },\n+ \"global-prefix\": {\n+ \"version\": \"1.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz\",\n+ \"integrity\": \"sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"expand-tilde\": \"^2.0.2\",\n+ \"homedir-polyfill\": \"^1.0.1\",\n+ \"ini\": \"^1.3.4\",\n+ \"is-windows\": \"^1.0.1\",\n+ \"which\": \"^1.2.14\"\n+ }\n+ },\n\"globals\": {\n\"version\": \"11.11.0\",\n\"resolved\": \"https://registry.npmjs.org/globals/-/globals-11.11.0.tgz\",\n},\n\"globby\": {\n\"version\": \"6.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/globby/-/globby-6.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/globby/-/globby-6.1.0.tgz\",\n\"integrity\": \"sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=\",\n\"dev\": true,\n\"requires\": {\n\"integrity\": \"sha1-tdRU3CGZriJWmfNGfloH87lVuv0=\",\n\"dev\": true\n},\n+ \"has-symbols\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz\",\n+ \"integrity\": \"sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=\",\n+ \"dev\": true\n+ },\n\"has-value\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz\",\n\"dev\": true\n},\n\"he\": {\n- \"version\": \"1.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/he/-/he-1.1.1.tgz\",\n- \"integrity\": \"sha1-k0EP0hsAlzUVH4howvJx80J+I/0=\",\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/he/-/he-1.2.0.tgz\",\n+ \"integrity\": \"sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==\",\n\"dev\": true\n},\n\"help-me\": {\n\"resolved\": \"https://registry.npmjs.org/home-assistant-js-websocket/-/home-assistant-js-websocket-3.1.6.tgz\",\n\"integrity\": \"sha512-fmp44tlhdFYmENeC+g1f1wp2qhdHjZ8Qjd5vOmPALYDzmuWCpfK2q6p3JrQ41LokJXhvA2NwLvaxLQNqiXZv7Q==\"\n},\n+ \"homedir-polyfill\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz\",\n+ \"integrity\": \"sha1-TCu8inWJmP7r9e1oWA921GdotLw=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"parse-passwd\": \"^1.0.0\"\n+ }\n+ },\n\"hosted-git-info\": {\n\"version\": \"2.7.1\",\n\"resolved\": \"https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz\",\n\"loose-envify\": \"^1.0.0\"\n}\n},\n+ \"invert-kv\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz\",\n+ \"integrity\": \"sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==\",\n+ \"dev\": true\n+ },\n\"ipaddr.js\": {\n\"version\": \"1.8.0\",\n\"resolved\": \"https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz\",\n\"builtin-modules\": \"^1.0.0\"\n}\n},\n+ \"is-callable\": {\n+ \"version\": \"1.1.4\",\n+ \"resolved\": \"https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz\",\n+ \"integrity\": \"sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==\",\n+ \"dev\": true\n+ },\n\"is-ci\": {\n\"version\": \"1.2.1\",\n\"resolved\": \"https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz\",\n}\n}\n},\n+ \"is-date-object\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz\",\n+ \"integrity\": \"sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=\",\n+ \"dev\": true\n+ },\n\"is-descriptor\": {\n\"version\": \"0.1.6\",\n\"resolved\": \"https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz\",\n\"integrity\": \"sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=\",\n\"dev\": true\n},\n+ \"is-regex\": {\n+ \"version\": \"1.0.4\",\n+ \"resolved\": \"https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz\",\n+ \"integrity\": \"sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"has\": \"^1.0.1\"\n+ }\n+ },\n\"is-regexp\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz\",\n\"integrity\": \"sha1-EtSj3U5o4Lec6428hBc66A2RykQ=\",\n\"dev\": true\n},\n+ \"is-symbol\": {\n+ \"version\": \"1.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz\",\n+ \"integrity\": \"sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"has-symbols\": \"^1.0.0\"\n+ }\n+ },\n\"is-typedarray\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz\",\n\"package-json\": \"^4.0.0\"\n}\n},\n+ \"lcid\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz\",\n+ \"integrity\": \"sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"invert-kv\": \"^2.0.0\"\n+ }\n+ },\n\"lcov-parse\": {\n\"version\": \"0.0.10\",\n\"resolved\": \"https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz\",\n},\n\"chalk\": {\n\"version\": \"1.1.3\",\n- \"resolved\": \"https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n\"integrity\": \"sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=\",\n\"dev\": true,\n\"requires\": {\n},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n},\n\"load-json-file\": {\n\"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz\",\n\"integrity\": \"sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=\",\n\"dev\": true,\n\"requires\": {\n\"pify\": \"^3.0.0\"\n}\n},\n+ \"map-age-cleaner\": {\n+ \"version\": \"0.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz\",\n+ \"integrity\": \"sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"p-defer\": \"^1.0.0\"\n+ }\n+ },\n\"map-cache\": {\n\"version\": \"0.2.2\",\n\"resolved\": \"https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz\",\n\"integrity\": \"sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=\",\n\"dev\": true\n},\n+ \"mem\": {\n+ \"version\": \"4.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/mem/-/mem-4.1.0.tgz\",\n+ \"integrity\": \"sha512-I5u6Q1x7wxO0kdOpYBB28xueHADYps5uty/zg936CiG8NTe5sJL8EjrCuLneuDW3PlMdZBGDIn8BirEVdovZvg==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"map-age-cleaner\": \"^0.1.1\",\n+ \"mimic-fn\": \"^1.0.0\",\n+ \"p-is-promise\": \"^2.0.0\"\n+ }\n+ },\n\"memorystore\": {\n\"version\": \"1.6.0\",\n\"resolved\": \"https://registry.npmjs.org/memorystore/-/memorystore-1.6.0.tgz\",\n}\n},\n\"mocha\": {\n- \"version\": \"5.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz\",\n- \"integrity\": \"sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==\",\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/mocha/-/mocha-6.0.0.tgz\",\n+ \"integrity\": \"sha512-A7g9k3yr8oJaXn2IItFnfgjyxFc/LTe6Wwv7FczP+e8G74o9xYNSbMYmCf1ouldRojLrFcOb+z75P6Ak0GX6ug==\",\n\"dev\": true,\n\"requires\": {\n+ \"ansi-colors\": \"3.2.3\",\n\"browser-stdout\": \"1.3.1\",\n- \"commander\": \"2.15.1\",\n- \"debug\": \"3.1.0\",\n+ \"debug\": \"3.2.6\",\n\"diff\": \"3.5.0\",\n\"escape-string-regexp\": \"1.0.5\",\n- \"glob\": \"7.1.2\",\n+ \"findup-sync\": \"2.0.0\",\n+ \"glob\": \"7.1.3\",\n\"growl\": \"1.10.5\",\n- \"he\": \"1.1.1\",\n+ \"he\": \"1.2.0\",\n+ \"js-yaml\": \"3.12.0\",\n+ \"log-symbols\": \"2.2.0\",\n\"minimatch\": \"3.0.4\",\n\"mkdirp\": \"0.5.1\",\n- \"supports-color\": \"5.4.0\"\n+ \"ms\": \"2.1.1\",\n+ \"node-environment-flags\": \"1.0.4\",\n+ \"object.assign\": \"4.1.0\",\n+ \"strip-json-comments\": \"2.0.1\",\n+ \"supports-color\": \"6.0.0\",\n+ \"which\": \"1.3.1\",\n+ \"wide-align\": \"1.1.3\",\n+ \"yargs\": \"12.0.5\",\n+ \"yargs-parser\": \"11.1.1\",\n+ \"yargs-unparser\": \"1.5.0\"\n},\n\"dependencies\": {\n- \"commander\": {\n- \"version\": \"2.15.1\",\n- \"resolved\": \"http://registry.npmjs.org/commander/-/commander-2.15.1.tgz\",\n- \"integrity\": \"sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==\",\n- \"dev\": true\n- },\n\"debug\": {\n- \"version\": \"3.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz\",\n- \"integrity\": \"sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==\",\n+ \"version\": \"3.2.6\",\n+ \"resolved\": \"https://registry.npmjs.org/debug/-/debug-3.2.6.tgz\",\n+ \"integrity\": \"sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==\",\n\"dev\": true,\n\"requires\": {\n- \"ms\": \"2.0.0\"\n+ \"ms\": \"^2.1.1\"\n+ }\n+ },\n+ \"glob\": {\n+ \"version\": \"7.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/glob/-/glob-7.1.3.tgz\",\n+ \"integrity\": \"sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"fs.realpath\": \"^1.0.0\",\n+ \"inflight\": \"^1.0.4\",\n+ \"inherits\": \"2\",\n+ \"minimatch\": \"^3.0.4\",\n+ \"once\": \"^1.3.0\",\n+ \"path-is-absolute\": \"^1.0.0\"\n}\n},\n\"growl\": {\n\"integrity\": \"sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==\",\n\"dev\": true\n},\n+ \"js-yaml\": {\n+ \"version\": \"3.12.0\",\n+ \"resolved\": \"https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz\",\n+ \"integrity\": \"sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"argparse\": \"^1.0.7\",\n+ \"esprima\": \"^4.0.0\"\n+ }\n+ },\n+ \"ms\": {\n+ \"version\": \"2.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.1.tgz\",\n+ \"integrity\": \"sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==\",\n+ \"dev\": true\n+ },\n\"supports-color\": {\n- \"version\": \"5.4.0\",\n- \"resolved\": \"https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz\",\n- \"integrity\": \"sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==\",\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/supports-color/-/supports-color-6.0.0.tgz\",\n+ \"integrity\": \"sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg==\",\n\"dev\": true,\n\"requires\": {\n\"has-flag\": \"^3.0.0\"\n}\n+ },\n+ \"which\": {\n+ \"version\": \"1.3.1\",\n+ \"resolved\": \"https://registry.npmjs.org/which/-/which-1.3.1.tgz\",\n+ \"integrity\": \"sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"isexe\": \"^2.0.0\"\n+ }\n}\n}\n},\n\"semver\": \"^5.5.0\"\n}\n},\n+ \"node-environment-flags\": {\n+ \"version\": \"1.0.4\",\n+ \"resolved\": \"https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.4.tgz\",\n+ \"integrity\": \"sha512-M9rwCnWVLW7PX+NUWe3ejEdiLYinRpsEre9hMkU/6NS4h+EEulYaDH1gCEZ2gyXsmw+RXYDaV2JkkTNcsPDJ0Q==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"object.getownpropertydescriptors\": \"^2.0.3\"\n+ }\n+ },\n\"node-red\": {\n\"version\": \"0.19.5\",\n\"resolved\": \"https://registry.npmjs.org/node-red/-/node-red-0.19.5.tgz\",\n}\n}\n},\n+ \"object-keys\": {\n+ \"version\": \"1.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/object-keys/-/object-keys-1.1.0.tgz\",\n+ \"integrity\": \"sha512-6OO5X1+2tYkNyNEx6TsCxEqFfRWaqx6EtMiSbGrw8Ob8v9Ne+Hl8rBAgLBZn5wjEz3s/s6U1WXFUFOcxxAwUpg==\",\n+ \"dev\": true\n+ },\n\"object-visit\": {\n\"version\": \"1.0.1\",\n\"resolved\": \"https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz\",\n\"isobject\": \"^3.0.0\"\n}\n},\n+ \"object.assign\": {\n+ \"version\": \"4.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz\",\n+ \"integrity\": \"sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"define-properties\": \"^1.1.2\",\n+ \"function-bind\": \"^1.1.1\",\n+ \"has-symbols\": \"^1.0.0\",\n+ \"object-keys\": \"^1.0.11\"\n+ }\n+ },\n+ \"object.getownpropertydescriptors\": {\n+ \"version\": \"2.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz\",\n+ \"integrity\": \"sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"define-properties\": \"^1.1.2\",\n+ \"es-abstract\": \"^1.5.1\"\n+ }\n+ },\n\"object.pick\": {\n\"version\": \"1.3.0\",\n\"resolved\": \"https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz\",\n\"integrity\": \"sha1-/7xJiDNuDoM94MFox+8VISGqf7M=\",\n\"dev\": true\n},\n+ \"os-locale\": {\n+ \"version\": \"3.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz\",\n+ \"integrity\": \"sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"execa\": \"^1.0.0\",\n+ \"lcid\": \"^2.0.0\",\n+ \"mem\": \"^4.0.0\"\n+ }\n+ },\n\"os-tmpdir\": {\n\"version\": \"1.0.2\",\n\"resolved\": \"https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz\",\n\"os-tmpdir\": \"^1.0.0\"\n}\n},\n+ \"p-defer\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz\",\n+ \"integrity\": \"sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=\",\n+ \"dev\": true\n+ },\n\"p-finally\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz\",\n\"integrity\": \"sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=\",\n\"dev\": true\n},\n+ \"p-is-promise\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.0.0.tgz\",\n+ \"integrity\": \"sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==\",\n+ \"dev\": true\n+ },\n\"p-iteration\": {\n\"version\": \"1.1.7\",\n\"resolved\": \"https://registry.npmjs.org/p-iteration/-/p-iteration-1.1.7.tgz\",\n\"error-ex\": \"^1.2.0\"\n}\n},\n+ \"parse-passwd\": {\n+ \"version\": \"1.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz\",\n+ \"integrity\": \"sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=\",\n+ \"dev\": true\n+ },\n\"parseurl\": {\n\"version\": \"1.3.2\",\n\"resolved\": \"https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz\",\n}\n}\n},\n+ \"require-directory\": {\n+ \"version\": \"2.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz\",\n+ \"integrity\": \"sha1-jGStX9MNqxyXbiNE/+f3kqam30I=\",\n+ \"dev\": true\n+ },\n+ \"require-main-filename\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz\",\n+ \"integrity\": \"sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=\",\n+ \"dev\": true\n+ },\n\"resolve\": {\n\"version\": \"1.10.0\",\n\"resolved\": \"https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz\",\n}\n}\n},\n+ \"resolve-dir\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz\",\n+ \"integrity\": \"sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"expand-tilde\": \"^2.0.0\",\n+ \"global-modules\": \"^1.0.0\"\n+ }\n+ },\n\"resolve-from\": {\n\"version\": \"4.0.0\",\n\"resolved\": \"https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz\",\n\"send\": \"0.16.2\"\n}\n},\n+ \"set-blocking\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz\",\n+ \"integrity\": \"sha1-BF+XgtARrppoA93TgrJDkrPYkPc=\",\n+ \"dev\": true\n+ },\n\"set-value\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz\",\n},\n\"through\": {\n\"version\": \"2.3.8\",\n- \"resolved\": \"https://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n\"integrity\": \"sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=\",\n\"dev\": true\n},\n\"isexe\": \"^2.0.0\"\n}\n},\n+ \"which-module\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz\",\n+ \"integrity\": \"sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=\",\n+ \"dev\": true\n+ },\n+ \"wide-align\": {\n+ \"version\": \"1.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz\",\n+ \"integrity\": \"sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"string-width\": \"^1.0.2 || 2\"\n+ }\n+ },\n\"widest-line\": {\n\"version\": \"2.0.1\",\n\"resolved\": \"https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz\",\n}\n},\n\"ws\": {\n- \"version\": \"6.1.2\",\n- \"resolved\": \"https://registry.npmjs.org/ws/-/ws-6.1.2.tgz\",\n- \"integrity\": \"sha512-rfUqzvz0WxmSXtJpPMX2EeASXabOrSMk1ruMOV3JBTBjo4ac2lDjGGsbQSyxj8Odhw5fBib8ZKEjDNvgouNKYw==\",\n+ \"version\": \"6.1.4\",\n+ \"resolved\": \"https://registry.npmjs.org/ws/-/ws-6.1.4.tgz\",\n+ \"integrity\": \"sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==\",\n\"requires\": {\n\"async-limiter\": \"~1.0.0\"\n}\n\"integrity\": \"sha1-pcbVMr5lbiPbgg77lDofBJmNY68=\",\n\"dev\": true\n},\n+ \"y18n\": {\n+ \"version\": \"4.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz\",\n+ \"integrity\": \"sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==\",\n+ \"dev\": true\n+ },\n\"yallist\": {\n\"version\": \"2.1.2\",\n\"resolved\": \"https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz\",\n\"integrity\": \"sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=\",\n\"dev\": true\n},\n+ \"yargs\": {\n+ \"version\": \"12.0.5\",\n+ \"resolved\": \"https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz\",\n+ \"integrity\": \"sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"cliui\": \"^4.0.0\",\n+ \"decamelize\": \"^1.2.0\",\n+ \"find-up\": \"^3.0.0\",\n+ \"get-caller-file\": \"^1.0.1\",\n+ \"os-locale\": \"^3.0.0\",\n+ \"require-directory\": \"^2.1.1\",\n+ \"require-main-filename\": \"^1.0.1\",\n+ \"set-blocking\": \"^2.0.0\",\n+ \"string-width\": \"^2.0.0\",\n+ \"which-module\": \"^2.0.0\",\n+ \"y18n\": \"^3.2.1 || ^4.0.0\",\n+ \"yargs-parser\": \"^11.1.1\"\n+ },\n+ \"dependencies\": {\n+ \"find-up\": {\n+ \"version\": \"3.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz\",\n+ \"integrity\": \"sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"locate-path\": \"^3.0.0\"\n+ }\n+ },\n+ \"locate-path\": {\n+ \"version\": \"3.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz\",\n+ \"integrity\": \"sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"p-locate\": \"^3.0.0\",\n+ \"path-exists\": \"^3.0.0\"\n+ }\n+ },\n+ \"p-limit\": {\n+ \"version\": \"2.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz\",\n+ \"integrity\": \"sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"p-try\": \"^2.0.0\"\n+ }\n+ },\n+ \"p-locate\": {\n+ \"version\": \"3.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz\",\n+ \"integrity\": \"sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"p-limit\": \"^2.0.0\"\n+ }\n+ },\n+ \"p-try\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz\",\n+ \"integrity\": \"sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==\",\n+ \"dev\": true\n+ }\n+ }\n+ },\n+ \"yargs-parser\": {\n+ \"version\": \"11.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz\",\n+ \"integrity\": \"sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"camelcase\": \"^5.0.0\",\n+ \"decamelize\": \"^1.2.0\"\n+ },\n+ \"dependencies\": {\n+ \"camelcase\": {\n+ \"version\": \"5.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz\",\n+ \"integrity\": \"sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==\",\n+ \"dev\": true\n+ }\n+ }\n+ },\n+ \"yargs-unparser\": {\n+ \"version\": \"1.5.0\",\n+ \"resolved\": \"https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz\",\n+ \"integrity\": \"sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"flat\": \"^4.1.0\",\n+ \"lodash\": \"^4.17.11\",\n+ \"yargs\": \"^12.0.5\"\n+ },\n+ \"dependencies\": {\n+ \"lodash\": {\n+ \"version\": \"4.17.11\",\n+ \"resolved\": \"https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz\",\n+ \"integrity\": \"sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==\",\n+ \"dev\": true\n+ }\n+ }\n+ },\n\"yup\": {\n\"version\": \"0.26.10\",\n\"resolved\": \"https://registry.npmjs.org/yup/-/yup-0.26.10.tgz\",\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"selectn\": \"1.1.2\",\n\"time-ago\": \"0.2.1\",\n\"timestring\": \"5.0.1\",\n- \"ws\": \"6.1.2\"\n+ \"ws\": \"6.1.4\"\n},\n\"devDependencies\": {\n\"coveralls\": \"^3.0.2\",\n- \"eslint\": \"^5.14.0\",\n+ \"eslint\": \"^5.14.1\",\n\"eslint-config-prettier\": \"^3.6.0\",\n\"eslint-config-standard\": \"^12.0.0\",\n\"eslint-plugin-import\": \"^2.16.0\",\n\"husky\": \"^1.3.1\",\n\"istanbul\": \"^1.1.0-alpha.1\",\n\"lint-staged\": \"^8.1.4\",\n- \"mocha\": \"^5.2.0\",\n+ \"mocha\": \"^6.0.0\",\n\"nock\": \"^10.0.6\",\n\"node-red\": \"^0.19.5\",\n\"node-red-node-test-helper\": \"^0.1.8\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(packages): Updated mocha, eslint and ws |
748,234 | 26.02.2019 13:57:27 | 28,800 | 11c440c214d8d509e005f262abf5a5de1e81d46b | feat: hass.io connection delay toggleable
hass.io user now have the option to enable/disable the 5 second
connection delay | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -316,7 +316,10 @@ class HaWebsocket extends EventEmitter {\nreturn new Promise((resolve, reject) => {\n// if hass.io, do a 5 second delay so it doesn't spam the hass.io proxy\n// https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/76\n- if (process.env.HASSIO_TOKEN) {\n+ if (\n+ process.env.HASSIO_TOKEN &&\n+ self.config.connectionDelay !== false\n+ ) {\nsetTimeout(\n() =>\nconnect(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.html",
"new_path": "nodes/config-server/config-server.html",
"diff": "legacy: { value: false },\nhassio: { value: false },\nrejectUnauthorizedCerts: { value: true },\n- ha_boolean: { value: \"y|yes|true|on|home|open\" }\n+ ha_boolean: { value: \"y|yes|true|on|home|open\" },\n+ connectionDelay: { value: true }\n},\ncredentials: {\nhost: { value: \"\", required: true },\nreturn this.name || this.url;\n},\noneditprepare: function() {\n- var $hassio = $(\"#node-config-input-hassio\");\n- var $host = $(\"#node-config-input-host\");\n- var $legacy = $(\"#node-config-input-legacy\");\n+ const $hassio = $(\"#node-config-input-hassio\");\n+ const $host = $(\"#node-config-input-host\");\n+ const $legacy = $(\"#node-config-input-legacy\");\nif (this.ha_boolean === undefined) {\n$(\"#node-config-input-ha_boolean\").val(\"y|yes|true|on|home|open\");\n$(\"#accept_unauthorized_certs\").prop(\"checked\", true);\n}\n+ if (this.connectionDelay === undefined) {\n+ $(\"#node-config-input-connectionDelay\").prop(\"checked\", true);\n+ }\n+\nif (\n!$hassio.prop(\"checked\") &&\n$host.val() === \"http://hassio/homeassistant\"\n}\nfunction updateHassio() {\n$(\"#server-info\").toggle(!$hassio.prop(\"checked\"));\n+ $(\".hassio\").toggle($hassio.prop(\"checked\"));\n}\nupdateHassio();\n$hassio.on(\"click\", function() {\n});\nfunction updateLegacy() {\n- var tokenName = $legacy.prop(\"checked\") ? \"Password\" : \"Access Token\";\n+ const tokenName = $legacy.prop(\"checked\") ? \"Password\" : \"Access Token\";\n$(\"#access-token-label\").html(\n'<i class=\"fa fa-user-secret\"></i> ' + tokenName\n});\n},\noneditsave: function() {\n- var hassio = $(\"#node-config-input-hassio\").is(\":checked\");\n- var $host = $(\"#node-config-input-host\");\n- var hostname = $host.val();\n+ const hassio = $(\"#node-config-input-hassio\").is(\":checked\");\n+ const $host = $(\"#node-config-input-host\");\n+ const hostname = $host.val();\nif (hassio) {\n$host.val(\"http://hassio/homeassistant\");\nthis.legacy = false;\nthis.rejectUnauthorizedCerts = true;\n+ // this.connectionDelay = $(\"#node-config-input-connectionDelay\").is(\n+ // \":checked\"\n+ // );\n} else {\n- var parser = document.createElement(\"a\");\n+ const parser = document.createElement(\"a\");\nparser.href = hostname;\nif (hostname !== parser.origin) {\nthis.rejectUnauthorizedCerts = !$(\"#accept_unauthorized_certs\").prop(\n\"checked\"\n);\n+ this.connectionDelay = false;\n}\n}\n});\n<label for=\"node-config-input-hassio\" style=\"width: auto;\"> I use Hass.io</label>\n</div>\n+ <div class=\"form-row hassio\">\n+ <input type=\"checkbox\" id=\"node-config-input-connectionDelay\" style=\"width: auto;margin-left: 125px;vertical-align: top\" />\n+ <label for=\"node-config-input-connectionDelay\" style=\"width: auto;\"> Delay connection attempts</label>\n+ </div>\n+\n<div id=\"server-info\">\n<div class=\"form-row\">\n<label for=\"node-config-input-host\" style=\"width: 120px\"><i class=\"fa fa-link\"></i> Base URL</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -89,7 +89,8 @@ module.exports = function(RED) {\nlegacy: {},\nhassio: {},\nrejectUnauthorizedCerts: {},\n- ha_boolean: {}\n+ ha_boolean: {},\n+ connectionDelay: {}\n}\n};\n@@ -154,7 +155,8 @@ module.exports = function(RED) {\napiPass: this.credentials.access_token,\nlegacy: this.nodeConfig.legacy,\nrejectUnauthorizedCerts: this.nodeConfig\n- .rejectUnauthorizedCerts\n+ .rejectUnauthorizedCerts,\n+ connectionDelay: this.nodeConfig.connectionDelay\n});\nthis.api = this.homeAssistant.api;\nthis.websocket = this.homeAssistant.websocket;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat: hass.io connection delay toggleable
hass.io user now have the option to enable/disable the 5 second
connection delay |
748,234 | 26.02.2019 14:05:45 | 28,800 | b8c7df8401806de341777ebb0dee87472360d1fc | refactor: consolidated split messages into the base-node | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -122,6 +122,24 @@ class BaseNode {\nthis.node.send(...arguments);\n}\n+ sendSplit(message, data) {\n+ delete message._msgid;\n+ message.parts = {\n+ id: this.RED.util.generateId(),\n+ type: 'array',\n+ count: data.length,\n+ len: 1\n+ };\n+\n+ let pos = 0;\n+ for (let i = 0; i < data.length; i++) {\n+ message.payload = data.slice(pos, pos + 1)[0];\n+ message.parts.index = i;\n+ pos += 1;\n+ this.send(this.RED.util.cloneMessage(message));\n+ }\n+ }\n+\nsetStatus(opts = { shape: 'dot', fill: 'blue', text: '' }) {\nthis.node.status(opts);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -69,20 +69,6 @@ module.exports = function(RED) {\nnoPayload = true;\nbreak;\n}\n- message.parts = {};\n- message.parts.id = RED.util.generateId();\n- delete message._msgid;\n- message.parts.type = 'array';\n- message.parts.count = entities.length;\n-\n- let pos = 0;\n- message.parts.len = 1;\n- for (let i = 0; i < entities.length; i++) {\n- message.payload = entities.slice(pos, pos + 1)[0];\n- message.parts.index = i;\n- pos += 1;\n- this.node.send(this.RED.util.cloneMessage(message));\n- }\nthis.status({\nfill: 'green',\n@@ -90,6 +76,7 @@ module.exports = function(RED) {\ntext: `${statusText} at: ${this.getPrettyDate()}`\n});\n+ this.sendSplit(message, entities);\nreturn;\ncase 'random':\nif (entities.length === 0) {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -154,20 +154,7 @@ module.exports = function(RED) {\nresults = results[0];\n}\n- message.parts = {};\n- message.parts.id = RED.util.generateId();\n- delete message._msgid;\n- message.parts.type = 'array';\n- message.parts.count = results.length;\n-\n- let pos = 0;\n- message.parts.len = 1;\n- for (let i = 0; i < results.length; i++) {\n- message.payload = results.slice(pos, pos + 1)[0];\n- message.parts.index = i;\n- pos += 1;\n- this.node.send(this.RED.util.cloneMessage(message));\n- }\n+ this.sendSplit(message, results);\nbreak;\ncase 'array':\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: consolidated split messages into the base-node |
748,234 | 26.02.2019 14:44:13 | 28,800 | 1dfd33ae62832590d955016ad09915f5f599ac91 | refactor(mustache-context): Moved all mustache operations to seperate file | [
{
"change_type": "MODIFY",
"old_path": "lib/mustache-context.js",
"new_path": "lib/mustache-context.js",
"diff": "@@ -78,4 +78,13 @@ NodeContext.prototype.push = function push(view) {\n);\n};\n-module.exports = NodeContext;\n+function RenderTemplate(data, message, context, serverName) {\n+ return (data || '').indexOf('{{') !== -1\n+ ? mustache.render(\n+ data,\n+ new NodeContext(message, null, context, serverName)\n+ )\n+ : data;\n+}\n+\n+module.exports = RenderTemplate;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "/* eslint-disable camelcase */\nconst BaseNode = require('../../lib/base-node');\n-const mustache = require('mustache');\n-const Context = require('../../lib/mustache-context');\n+// const mustache = require('mustache');\n+const RenderTemplate = require('../../lib/mustache-context');\nmodule.exports = function(RED) {\nconst nodeOptions = {\n@@ -64,7 +64,13 @@ module.exports = function(RED) {\nconst configService = this.nodeConfig.service;\nconst apiDomain = payloadDomain || configDomain;\nconst apiService = payloadService || configService;\n- let apiData = this.getApiData(payload);\n+ const configData = RenderTemplate(\n+ this.nodeConfig.data,\n+ message,\n+ this.node.context(),\n+ this.utils.toCamelCase(this.nodeConfig.server.name)\n+ );\n+ const apiData = this.getApiData(payload, configData);\nif (!apiDomain) {\nthrow new Error(\n@@ -78,18 +84,6 @@ module.exports = function(RED) {\n);\n}\n- apiData = JSON.parse(\n- mustache.render(\n- JSON.stringify(apiData),\n- new Context(\n- message,\n- null,\n- this.node.context(),\n- this.utils.toCamelCase(this.nodeConfig.server.name)\n- )\n- )\n- );\n-\nthis.debug(\n`Calling Service: ${apiDomain}:${apiService} -- ${JSON.stringify(\napiData || {}\n@@ -155,12 +149,12 @@ module.exports = function(RED) {\n});\n}\n- getApiData(payload) {\n+ getApiData(payload, data) {\nlet apiData;\nlet contextData = {};\nlet payloadData = this.utils.reach('data', payload);\n- let configData = this.tryToObject(this.nodeConfig.data);\n+ let configData = this.tryToObject(data);\npayloadData = payloadData || {};\nconfigData = configData || {};\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "const BaseNode = require('../../lib/base-node');\n-const mustache = require('mustache');\n-const Context = require('../../lib/mustache-context');\n+const RenderTemplate = require('../../lib/mustache-context');\nmodule.exports = function(RED) {\nconst nodeOptions = {\n@@ -8,7 +7,6 @@ module.exports = function(RED) {\nconfig: {\nevent: {},\ndata: {},\n- render_data: {},\nmergecontext: {},\nname: {},\nserver: { isNode: true }\n@@ -41,7 +39,13 @@ module.exports = function(RED) {\nconst configEvent = this.nodeConfig.event;\nconst eventType = payloadEvent || configEvent;\n- let eventData = this.getEventData(payload);\n+ const configData = RenderTemplate(\n+ this.nodeConfig.data,\n+ message,\n+ this.node.context(),\n+ this.utils.toCamelCase(this.nodeConfig.server.name)\n+ );\n+ const eventData = this.getEventData(payload, configData);\nif (!eventType) {\nthrow new Error(\n@@ -51,18 +55,6 @@ module.exports = function(RED) {\nthis.debug(`Fire Event: ${eventType} -- ${JSON.stringify({})}`);\n- eventData = JSON.parse(\n- mustache.render(\n- JSON.stringify(eventData),\n- new Context(\n- message,\n- null,\n- this.node.context(),\n- this.utils.toCamelCase(this.nodeConfig.server.name)\n- )\n- )\n- );\n-\nmessage.payload = {\nevent: eventType,\ndata: eventData || null\n@@ -99,12 +91,12 @@ module.exports = function(RED) {\n});\n}\n- getEventData(payload) {\n+ getEventData(payload, data) {\nlet eventData;\nlet contextData = {};\nlet payloadData = this.utils.reach('data', payload);\n- let configData = this.tryToObject(this.nodeConfig.data);\n+ let configData = this.tryToObject(data);\npayloadData = payloadData || {};\nconfigData = configData || {};\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(mustache-context): Moved all mustache operations to seperate file |
748,234 | 27.02.2019 17:03:46 | 28,800 | be85eac45707d42e06855311857029e3f9a7f295 | chore(package): Updated coveralls and mocha for devDep | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n},\n\"async\": {\n\"version\": \"0.1.22\",\n- \"resolved\": \"https://registry.npmjs.org/async/-/async-0.1.22.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/async/-/async-0.1.22.tgz\",\n\"integrity\": \"sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=\",\n\"dev\": true\n},\n\"balanced-match\": {\n\"version\": \"1.0.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"brace-expansion\": {\n\"version\": \"1.1.11\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"balanced-match\": \"^1.0.0\",\n\"concat-map\": \"0.0.1\"\n\"code-point-at\": {\n\"version\": \"1.1.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"concat-map\": {\n\"version\": \"0.0.1\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"console-control-strings\": {\n\"version\": \"1.1.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"core-util-is\": {\n\"version\": \"1.0.2\",\n\"inherits\": {\n\"version\": \"2.0.3\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"ini\": {\n\"version\": \"1.3.5\",\n\"version\": \"1.0.0\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"number-is-nan\": \"^1.0.0\"\n}\n\"version\": \"3.0.4\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"brace-expansion\": \"^1.1.7\"\n}\n\"minimist\": {\n\"version\": \"0.0.8\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"minipass\": {\n\"version\": \"2.2.4\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"safe-buffer\": \"^5.1.1\",\n\"yallist\": \"^3.0.0\"\n\"yallist\": {\n\"version\": \"3.0.2\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n}\n}\n},\n\"version\": \"0.5.1\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"minimist\": \"0.0.8\"\n}\n\"number-is-nan\": {\n\"version\": \"1.0.1\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"object-assign\": {\n\"version\": \"4.1.1\",\n\"version\": \"1.4.0\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"wrappy\": \"1\"\n}\n\"version\": \"1.0.2\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"code-point-at\": \"^1.0.0\",\n\"is-fullwidth-code-point\": \"^1.0.0\",\n},\n\"needle\": {\n\"version\": \"0.10.0\",\n- \"resolved\": \"https://registry.npmjs.org/needle/-/needle-0.10.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/needle/-/needle-0.10.0.tgz\",\n\"integrity\": \"sha1-FqJNY/KmEVLrdMzh0Sr4XFB1d9Q=\",\n\"dev\": true,\n\"requires\": {\n\"dependencies\": {\n\"readable-stream\": {\n\"version\": \"1.1.14\",\n- \"resolved\": \"https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n\"integrity\": \"sha1-fPTFTvZI44EwhMY23SB54WbAgdk=\",\n\"dev\": true,\n\"requires\": {\n\"dependencies\": {\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n}\n}\n},\n\"coveralls\": {\n- \"version\": \"3.0.2\",\n- \"resolved\": \"https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz\",\n- \"integrity\": \"sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==\",\n+ \"version\": \"3.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/coveralls/-/coveralls-3.0.3.tgz\",\n+ \"integrity\": \"sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg==\",\n\"dev\": true,\n\"requires\": {\n\"growl\": \"~> 1.10.0\",\n\"lcov-parse\": \"^0.0.10\",\n\"log-driver\": \"^1.2.7\",\n\"minimist\": \"^1.2.0\",\n- \"request\": \"^2.85.0\"\n+ \"request\": \"^2.86.0\"\n},\n\"dependencies\": {\n\"js-yaml\": {\n- \"version\": \"3.12.0\",\n- \"resolved\": \"https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz\",\n- \"integrity\": \"sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==\",\n+ \"version\": \"3.12.2\",\n+ \"resolved\": \"https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz\",\n+ \"integrity\": \"sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==\",\n\"dev\": true,\n\"requires\": {\n\"argparse\": \"^1.0.7\",\n\"dependencies\": {\n\"readable-stream\": {\n\"version\": \"1.1.14\",\n- \"resolved\": \"https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n\"integrity\": \"sha1-fPTFTvZI44EwhMY23SB54WbAgdk=\",\n\"dev\": true,\n\"requires\": {\n},\n\"finalhandler\": {\n\"version\": \"1.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz\",\n\"integrity\": \"sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==\",\n\"dev\": true,\n\"requires\": {\n\"balanced-match\": {\n\"version\": \"1.0.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"brace-expansion\": {\n\"version\": \"1.1.11\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"balanced-match\": \"^1.0.0\",\n\"concat-map\": \"0.0.1\"\n\"code-point-at\": {\n\"version\": \"1.1.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"concat-map\": {\n\"version\": \"0.0.1\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"console-control-strings\": {\n\"version\": \"1.1.0\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"core-util-is\": {\n\"version\": \"1.0.2\",\n\"inherits\": {\n\"version\": \"2.0.3\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"ini\": {\n\"version\": \"1.3.5\",\n\"version\": \"1.0.0\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"number-is-nan\": \"^1.0.0\"\n}\n\"version\": \"3.0.4\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"brace-expansion\": \"^1.1.7\"\n}\n\"minimist\": {\n\"version\": \"0.0.8\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"minipass\": {\n\"version\": \"2.3.5\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"safe-buffer\": \"^5.1.2\",\n\"yallist\": \"^3.0.0\"\n\"version\": \"0.5.1\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"minimist\": \"0.0.8\"\n}\n\"number-is-nan\": {\n\"version\": \"1.0.1\",\n\"bundled\": true,\n- \"dev\": true,\n- \"optional\": true\n+ \"dev\": true\n},\n\"object-assign\": {\n\"version\": \"4.1.1\",\n\"version\": \"1.4.0\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"wrappy\": \"1\"\n}\n\"version\": \"1.0.2\",\n\"bundled\": true,\n\"dev\": true,\n- \"optional\": true,\n\"requires\": {\n\"code-point-at\": \"^1.0.0\",\n\"is-fullwidth-code-point\": \"^1.0.0\",\n\"integrity\": \"sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=\"\n},\n\"growl\": {\n- \"version\": \"1.10.3\",\n- \"resolved\": \"https://registry.npmjs.org/growl/-/growl-1.10.3.tgz\",\n- \"integrity\": \"sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==\",\n+ \"version\": \"1.10.5\",\n+ \"resolved\": \"https://registry.npmjs.org/growl/-/growl-1.10.5.tgz\",\n+ \"integrity\": \"sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==\",\n\"dev\": true\n},\n\"handlebars\": {\n- \"version\": \"4.0.12\",\n- \"resolved\": \"https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz\",\n- \"integrity\": \"sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==\",\n+ \"version\": \"4.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz\",\n+ \"integrity\": \"sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==\",\n\"dev\": true,\n\"requires\": {\n\"async\": \"^2.5.0\",\n},\n\"dependencies\": {\n\"async\": {\n- \"version\": \"2.6.1\",\n- \"resolved\": \"https://registry.npmjs.org/async/-/async-2.6.1.tgz\",\n- \"integrity\": \"sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==\",\n+ \"version\": \"2.6.2\",\n+ \"resolved\": \"https://registry.npmjs.org/async/-/async-2.6.2.tgz\",\n+ \"integrity\": \"sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==\",\n\"dev\": true,\n\"requires\": {\n- \"lodash\": \"^4.17.10\"\n+ \"lodash\": \"^4.17.11\"\n}\n}\n}\n\"integrity\": \"sha512-fmp44tlhdFYmENeC+g1f1wp2qhdHjZ8Qjd5vOmPALYDzmuWCpfK2q6p3JrQ41LokJXhvA2NwLvaxLQNqiXZv7Q==\"\n},\n\"homedir-polyfill\": {\n- \"version\": \"1.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz\",\n- \"integrity\": \"sha1-TCu8inWJmP7r9e1oWA921GdotLw=\",\n+ \"version\": \"1.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz\",\n+ \"integrity\": \"sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==\",\n\"dev\": true,\n\"requires\": {\n\"parse-passwd\": \"^1.0.0\"\n\"dependencies\": {\n\"readable-stream\": {\n\"version\": \"1.1.14\",\n- \"resolved\": \"https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz\",\n\"integrity\": \"sha1-fPTFTvZI44EwhMY23SB54WbAgdk=\",\n\"dev\": true,\n\"requires\": {\n}\n},\n\"lodash\": {\n- \"version\": \"4.17.10\",\n- \"resolved\": \"https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz\",\n- \"integrity\": \"sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==\"\n+ \"version\": \"4.17.11\",\n+ \"resolved\": \"https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz\",\n+ \"integrity\": \"sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==\"\n},\n\"lodash.assign\": {\n\"version\": \"4.2.0\",\n}\n},\n\"mocha\": {\n- \"version\": \"6.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/mocha/-/mocha-6.0.0.tgz\",\n- \"integrity\": \"sha512-A7g9k3yr8oJaXn2IItFnfgjyxFc/LTe6Wwv7FczP+e8G74o9xYNSbMYmCf1ouldRojLrFcOb+z75P6Ak0GX6ug==\",\n+ \"version\": \"6.0.2\",\n+ \"resolved\": \"https://registry.npmjs.org/mocha/-/mocha-6.0.2.tgz\",\n+ \"integrity\": \"sha512-RtTJsmmToGyeTznSOMoM6TPEk1A84FQaHIciKrRqARZx+B5ccJ5tXlmJzEKGBxZdqk9UjpRsesZTUkZmR5YnuQ==\",\n\"dev\": true,\n\"requires\": {\n\"ansi-colors\": \"3.2.3\",\n\"path-is-absolute\": \"^1.0.0\"\n}\n},\n- \"growl\": {\n- \"version\": \"1.10.5\",\n- \"resolved\": \"https://registry.npmjs.org/growl/-/growl-1.10.5.tgz\",\n- \"integrity\": \"sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==\",\n- \"dev\": true\n- },\n\"js-yaml\": {\n\"version\": \"3.12.0\",\n\"resolved\": \"https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz\",\n\"dependencies\": {\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n}\n},\n\"needle\": {\n\"version\": \"0.11.0\",\n- \"resolved\": \"https://registry.npmjs.org/needle/-/needle-0.11.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/needle/-/needle-0.11.0.tgz\",\n\"integrity\": \"sha1-AqcbAI6vfVWuifuf12hbe4jXvCk=\",\n\"dev\": true,\n\"requires\": {\n},\n\"nodemailer\": {\n\"version\": \"1.11.0\",\n- \"resolved\": \"https://registry.npmjs.org/nodemailer/-/nodemailer-1.11.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/nodemailer/-/nodemailer-1.11.0.tgz\",\n\"integrity\": \"sha1-TmnLObAwFbHR7wx4qBVBK56Xb3k=\",\n\"dev\": true,\n\"requires\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"ws\": \"6.1.4\"\n},\n\"devDependencies\": {\n- \"coveralls\": \"^3.0.2\",\n+ \"coveralls\": \"^3.0.3\",\n\"eslint\": \"^5.14.1\",\n\"eslint-config-prettier\": \"^4.1.0\",\n\"eslint-config-standard\": \"^12.0.0\",\n\"husky\": \"^1.3.1\",\n\"istanbul\": \"^1.1.0-alpha.1\",\n\"lint-staged\": \"^8.1.4\",\n- \"mocha\": \"^6.0.0\",\n+ \"mocha\": \"^6.0.2\",\n\"nock\": \"^10.0.6\",\n\"node-red\": \"^0.19.6\",\n\"node-red-node-test-helper\": \"^0.1.8\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(package): Updated coveralls and mocha for devDep |
748,234 | 01.03.2019 22:27:17 | 28,800 | 635aa48defcde410c197ffcd7431efa96078c73f | refactor(call-service): Change default output location to none | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "},\nmergecontext: { value: null },\noutput_location: { value: \"payload\" },\n- output_location_type: { value: \"msg\" }\n+ output_location_type: { value: \"none\" }\n},\noneditprepare: function() {\nconst node = this;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(call-service): Change default output location to none |
748,234 | 07.03.2019 14:53:43 | 28,800 | ed7341a83bdd9956533c3ce0583445e2671ec7fc | feat(api): New node for direct access to api
New node to have direct access to home assistant api either by http or
websocket | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -144,6 +144,29 @@ class BaseNode {\nthis.node.status(opts);\n}\n+ setStatusSuccess(text = 'Success') {\n+ this.status({\n+ fill: 'green',\n+ shape: 'dot',\n+ text: `${text} called at: ${this.getPrettyDate()}`\n+ });\n+ }\n+\n+ setStatusSending(text = 'Sending') {\n+ this.status({\n+ fill: 'yellow',\n+ shape: 'dot',\n+ text: `${text} at: ${this.getPrettyDate()}`\n+ });\n+ }\n+ setStatusFailed(text = 'Failed') {\n+ this.status({\n+ fill: 'red',\n+ shape: 'ring',\n+ text: `${text} at: ${this.getPrettyDate()}`\n+ });\n+ }\n+\nupdateConnectionStatus(additionalText) {\nthis.setConnectionStatus(this.connectionState, additionalText);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -211,6 +211,12 @@ class HaWebsocket extends EventEmitter {\nreturn result;\n}\n+ async send(data) {\n+ const response = await this.client.sendMessagePromise(data);\n+\n+ return response;\n+ }\n+\n/*\n* Pretty much a copy from https://github.com/home-assistant/home-assistant-js-websocket\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/node-home-assistant.js",
"new_path": "lib/node-home-assistant.js",
"diff": "@@ -23,7 +23,7 @@ class HomeAssistant {\nconstructor(config) {\ndebug('Instantiating HomeAssistant');\nthis.config = Object.assign({}, DEFAULTS, config);\n- this.api = new HaHttp(this.config);\n+ this.http = new HaHttp(this.config);\nthis.websocket = new HaWebsocket(this.config);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "nodes/api/api.html",
"diff": "+<script type=\"text/javascript\">\n+ RED.nodes.registerType(\"ha-api\", {\n+ category: \"home_assistant\",\n+ color: \"#52C0F2\",\n+ inputs: 1,\n+ outputs: 1,\n+ icon: \"server.png\",\n+ paletteLabel: \"API\",\n+ label: function() {\n+ return this.name || \"API\";\n+ },\n+ defaults: {\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ protocol: { value: \"websocket\" },\n+ method: { value: \"get\" },\n+ path: { value: \"\" },\n+ data: { value: \"\" },\n+ location: { value: \"payload\" },\n+ locationType: { value: \"msg\" }\n+ },\n+ oneditprepare: function() {\n+ const node = this;\n+ const $server = $(\"#node-input-server\");\n+ const utils = {\n+ setDefaultServerSelection: function() {\n+ let defaultServer;\n+ RED.nodes.eachConfig(n => {\n+ if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n+ });\n+ if (defaultServer) $server.val(defaultServer);\n+ }\n+ };\n+\n+ if (!node.server) {\n+ utils.setDefaultServerSelection();\n+ }\n+\n+ $(\"#node-input-data\")\n+ .typedInput({\n+ types: [\n+ {\n+ value: \"json\",\n+ label: \"JSON\",\n+ icon: \"red/images/typedInput/json.png\",\n+ validate: function(v) {\n+ if (!v) return true;\n+ try {\n+ JSON.parse(v);\n+ return true;\n+ } catch (e) {\n+ return false;\n+ }\n+ },\n+ expand: function() {\n+ const that = this;\n+ const value = this.value();\n+ try {\n+ value = JSON.stringify(JSON.parse(value), null, 4);\n+ } catch (err) {}\n+ RED.editor.editJSON({\n+ value: value,\n+ complete: function(v) {\n+ const value = v;\n+ try {\n+ value = JSON.stringify(JSON.parse(v));\n+ } catch (err) {}\n+ that.value(value);\n+ }\n+ });\n+ }\n+ }\n+ ]\n+ })\n+ .typedInput(\"width\", \"68%\");\n+\n+ $(\"#node-input-protocol\")\n+ .on(\"change\", function() {\n+ const isHttp = $(this).val() === \"http\";\n+ $(\".http\").toggle(isHttp);\n+ $(\"#node-input-method\").trigger(\"change\");\n+ })\n+ .trigger(\"change\");\n+\n+ $(\"#node-input-method\").on(\"change\", function() {\n+ const label =\n+ $(\"#node-input-protocol\").val() === \"http\" &&\n+ $(\"#node-input-method\").val() === \"get\"\n+ ? \"Params\"\n+ : \"Data\";\n+ $(\"#data-label\").text(label);\n+ });\n+\n+ $(\"#node-input-location\")\n+ .typedInput({\n+ types: [\n+ \"msg\",\n+ \"flow\",\n+ \"global\",\n+ { value: \"none\", label: \"None\", hasValue: false }\n+ ],\n+ typeField: \"#node-input-locationType\"\n+ })\n+ .typedInput(\"width\", \"68%\");\n+ }\n+ });\n+</script>\n+\n+<script type=\"text/x-red\" data-template-name=\"ha-api\">\n+ <div class=\"form-row\">\n+ <label for=\"node-input-name\">Name</label>\n+ <input type=\"text\" id=\"node-input-name\" placeholder=\"Name\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-server\">Server</label>\n+ <input type=\"text\" id=\"node-input-server\" />\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-protocol\">Protocol</label>\n+ <select type=\"text\" id=\"node-input-protocol\" style=\"width:70%;\">\n+ <option value=\"websocket\">WebSocket</option>\n+ <option value=\"http\">HTTP</option>\n+ </select>\n+ </div>\n+\n+ <div class=\"form-row http\">\n+ <label for=\"node-input-method\">Method</label>\n+ <select type=\"text\" id=\"node-input-method\" style=\"width:70%;\">\n+ <option value=\"get\">GET</option>\n+ <option value=\"post\">POST</option>\n+ </select>\n+ </div>\n+\n+ <div class=\"form-row http\">\n+ <label for=\"node-input-path\">Path</label>\n+ <input type=\"text\" id=\"node-input-path\" placeholder=\"config\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label id=\"data-label\" for=\"node-input-data\">Data</label>\n+ <input type=\"text\" id=\"node-input-data\">\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-location\">Results</label>\n+ <input type=\"text\" id=\"node-input-location\">\n+ </div>\n+</script>\n+\n+<script type=\"text/x-red\" data-help-name=\"ha-api\">\n+ <h3>Configuration</h3>\n+ <dl class=\"message-properties\">\n+ <dt>Protocol<span class=\"property-type\">[websocket|http] string</span></dt>\n+ <dd>Protocol to use to access Home Assistant API.</dd>\n+\n+ <dt>Method<span class=\"property-type\">[get|post] string</span></dt>\n+ <dd>Type of method to use to access the HTTP endpoint.</dd>\n+\n+ <dt>Path<span class=\"property-type\">string</span></dt>\n+ <dd>URL of the API endpoint.</dd>\n+\n+ <dt>Params<span class=\"property-type\">JSON</span></dt>\n+ <dd>JSON object with key/value pairs that will be converted into URL parameters.</dd>\n+\n+ <dt>Data<span class=\"property-type\">JSON</span></dt>\n+ <dd>JSON Object to send for WebSocket requests and HTTP posts.</dd>\n+\n+ <dt>Results<span class=\"property-type\">string</span></dt>\n+ <dd>Location to saved the API results.</dd>\n+\n+ <dt>Templates</dt>\n+ <dd>Templates can be used in path, params and data fields.</dd>\n+ </dl>\n+\n+ <h3>Outputs</h3>\n+ Will output the results received from the API call to the location defined in the config.\n+</script>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "nodes/api/api.js",
"diff": "+const RenderTemplate = require('../../lib/mustache-context');\n+const BaseNode = require('../../lib/base-node');\n+\n+module.exports = function(RED) {\n+ const nodeOptions = {\n+ config: {\n+ name: {},\n+ server: { isNode: true },\n+ protocol: {},\n+ method: {},\n+ path: {},\n+ data: {},\n+ location: {},\n+ locationType: {}\n+ }\n+ };\n+ class ApiNode extends BaseNode {\n+ constructor(nodeDefinition) {\n+ super(nodeDefinition, RED, nodeOptions);\n+ }\n+\n+ onInput({ message }) {\n+ const node = this;\n+ const config = node.nodeConfig;\n+ const serverName = node.utils.toCamelCase(config.server.name);\n+ const data = RenderTemplate(\n+ config.data,\n+ message,\n+ node.node.context(),\n+ serverName\n+ );\n+ let apiCall;\n+\n+ if (config.protocol === 'http') {\n+ const path = RenderTemplate(\n+ config.path,\n+ message,\n+ node.node.context(),\n+ serverName\n+ ).replace(/^\\/(?:api\\/)?/, '');\n+\n+ if (!path) {\n+ node.error('HTTP request requires a valid path.');\n+ return;\n+ }\n+\n+ if (!['get', 'post'].includes(config.method)) {\n+ node.error('HTTP request requires a valid method');\n+ return;\n+ }\n+\n+ apiCall = config.server.http[`_${config.method}`].bind(\n+ config.server.http,\n+ path,\n+ data\n+ );\n+ } else {\n+ try {\n+ const json = JSON.parse(data);\n+\n+ if (!json.type) {\n+ node.error(\n+ `A WebSocket request requires a 'type' property in the data object.`\n+ );\n+ return null;\n+ }\n+\n+ apiCall = config.server.websocket.send.bind(\n+ config.server.websocket,\n+ json\n+ );\n+ } catch (e) {\n+ node.error(e.message);\n+ node.setStatusFailed();\n+ return;\n+ }\n+ }\n+\n+ node.setStatusSending();\n+\n+ return apiCall()\n+ .then(results => {\n+ node.setStatusSuccess(config.protocol);\n+\n+ const contextKey = RED.util.parseContextStore(\n+ config.location\n+ );\n+ contextKey.key = contextKey.key || 'payload';\n+ const locationType = config.location_type || 'msg';\n+\n+ if (locationType === 'flow' || locationType === 'global') {\n+ node.node\n+ .context()\n+ [locationType].set(\n+ contextKey.key,\n+ results,\n+ contextKey.store\n+ );\n+ } else if (locationType === 'msg') {\n+ message[contextKey.key] = results;\n+ }\n+\n+ node.send(message);\n+ })\n+ .catch(err => {\n+ node.error(\n+ 'API Error. ' + err.message\n+ ? `Error Message: ${err.message}`\n+ : ''\n+ );\n+ node.setStatusFailed('API Error');\n+ });\n+ }\n+ }\n+\n+ RED.nodes.registerType('ha-api', ApiNode);\n+};\n"
},
{
"change_type": "ADD",
"old_path": "nodes/api/icons/server.png",
"new_path": "nodes/api/icons/server.png",
"diff": "Binary files /dev/null and b/nodes/api/icons/server.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -158,7 +158,7 @@ module.exports = function(RED) {\n.rejectUnauthorizedCerts,\nconnectionDelay: this.nodeConfig.connectionDelay\n});\n- this.api = this.homeAssistant.api;\n+ this.http = this.homeAssistant.http;\nthis.websocket = this.homeAssistant.websocket;\nthis.homeAssistant\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "@@ -66,7 +66,7 @@ module.exports = function(RED) {\ntext: `Sending at: ${this.getPrettyDate()}`\n});\n- return this.nodeConfig.server.api\n+ return this.nodeConfig.server.http\n.fireEvent(eventType, eventData)\n.then(() => {\nthis.status({\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -92,7 +92,7 @@ module.exports = function(RED) {\nlet apiRequest =\nentityidtype.value === 'includes' && entityid\n- ? this.nodeConfig.server.api.getHistory(\n+ ? this.nodeConfig.server.http.getHistory(\nstartdate,\nnull,\nenddate,\n@@ -100,7 +100,7 @@ module.exports = function(RED) {\ninclude: new RegExp(entityid)\n}\n)\n- : this.nodeConfig.server.api.getHistory(\n+ : this.nodeConfig.server.http.getHistory(\nstartdate,\nentityid,\nenddate\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -41,7 +41,7 @@ module.exports = function(RED) {\ntext: `Requesting at: ${this.getPrettyDate()}`\n});\n- return this.nodeConfig.server.api\n+ return this.nodeConfig.server.http\n.renderTemplate(template)\n.then(res => {\nmessage.template = template;\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"ha-get-entities\": \"nodes/get-entities/get-entities.js\",\n\"api-get-history\": \"nodes/get-history/get-history.js\",\n\"api-render-template\": \"nodes/render-template/render-template.js\",\n- \"ha-wait-until\": \"nodes/wait-until/wait-until.js\"\n+ \"ha-wait-until\": \"nodes/wait-until/wait-until.js\",\n+ \"ha-api\": \"nodes/api/api.js\"\n}\n},\n\"dependencies\": {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "test/api_spec.js",
"diff": "+const helper = require('node-red-node-test-helper');\n+const api = require('../nodes/api/api.js');\n+\n+helper.init(require.resolve('node-red'));\n+\n+describe('api node', function() {\n+ beforeEach(function(done) {\n+ helper.startServer(done);\n+ });\n+\n+ afterEach(function(done) {\n+ helper.unload();\n+ helper.stopServer(done);\n+ });\n+\n+ it('should be loaded', function(done) {\n+ var flow = [{ id: 'n1', type: 'ha-api', name: 'API' }];\n+ helper.load(api, flow, function() {\n+ var n1 = helper.getNode('n1');\n+ n1.should.have.property('name', 'API');\n+ done();\n+ });\n+ });\n+});\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(api): New node for direct access to api
New node to have direct access to home assistant api either by http or
websocket |
748,234 | 07.03.2019 16:12:45 | 28,800 | ae8f728fa88eab5f0514875210620012637d607d | refactor: Refactor setStatus
Refactor setStatus to setStatusSuccess, setStatusFailed and
setStatusSending | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -148,7 +148,7 @@ class BaseNode {\nthis.status({\nfill: 'green',\nshape: 'dot',\n- text: `${text} called at: ${this.getPrettyDate()}`\n+ text: `${text} at: ${this.getPrettyDate()}`\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -40,11 +40,7 @@ module.exports = function(RED) {\nthis.nodeConfig.server.websocket.connectionState !==\nthis.nodeConfig.server.websocket.CONNECTED\n) {\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `No Connection at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed('No Connection');\nthis.warn(\n'Call-Service attempted without connection to server.'\n);\n@@ -96,20 +92,12 @@ module.exports = function(RED) {\ndata: apiData || null\n};\n- this.status({\n- fill: 'yellow',\n- shape: 'dot',\n- text: `Sending at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSending();\nreturn this.nodeConfig.server.websocket\n.callService(apiDomain, apiService, apiData)\n.then(() => {\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${apiDomain}.${apiService} called at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(`${apiDomain}.${apiService}`);\nconst contextKey = RED.util.parseContextStore(\nthis.nodeConfig.output_location\n@@ -141,11 +129,7 @@ module.exports = function(RED) {\n}`;\nthis.error(errorMessage);\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `API Error at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed('API Error');\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -157,18 +157,10 @@ module.exports = function(RED) {\nconst debugMsg = `Get current state: halting processing due to current state of ${entity_id} matches \"halt if state\" option`;\nthis.debug(debugMsg);\nthis.debugToClient(debugMsg);\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `${currentState.state} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed(currentState.state);\nthis.node.send([null, message]);\n} else {\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${currentState.state} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(currentState.state);\nthis.node.send([message, null]);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.js",
"new_path": "nodes/events-all/events-all.js",
"diff": "@@ -22,11 +22,7 @@ module.exports = function(RED) {\ntopic: evt.event_type,\npayload: evt\n});\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${evt.event_type} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(evt.event_type);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.js",
"new_path": "nodes/events-state-changed/events-state-changed.js",
"diff": "@@ -119,22 +119,11 @@ module.exports = function(RED) {\nif (shouldHaltIfState) {\nthis.debug('flow halted due to \"halt if state\" setting');\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `${\n- event.new_state.state\n- } at: ${this.getPrettyDate()}`\n- });\n-\n+ this.setStatusFailed(event.new_state.state);\nreturn this.send([null, msg]);\n}\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${event.new_state.state} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(event.new_state.state);\nevent.old_state\n? this.debug(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "@@ -60,20 +60,12 @@ module.exports = function(RED) {\ndata: eventData || null\n};\n- this.status({\n- fill: 'yellow',\n- shape: 'dot',\n- text: `Sending at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSending();\nreturn this.nodeConfig.server.http\n.fireEvent(eventType, eventData)\n.then(() => {\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${eventType} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(eventType);\nthis.send(message);\n})\n.catch(err => {\n@@ -83,11 +75,7 @@ module.exports = function(RED) {\n}`,\nmessage\n);\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `API Error at: ${this.prettyDate}`\n- });\n+ this.setStatusFailed('API Error');\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -70,12 +70,7 @@ module.exports = function(RED) {\nbreak;\n}\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${statusText} at: ${this.getPrettyDate()}`\n- });\n-\n+ this.setStatusSuccess(statusText);\nthis.sendSplit(message, entities);\nreturn;\ncase 'random':\n@@ -113,20 +108,11 @@ module.exports = function(RED) {\n}\nif (noPayload) {\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `No Results at: ${this.getPrettyDate()}`\n- });\n-\n+ this.setStatusFailed('No Results');\nreturn null;\n}\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${statusText} at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess(statusText);\nconst contextKey = RED.util.parseContextStore(\nthis.nodeConfig.output_location\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -106,11 +106,7 @@ module.exports = function(RED) {\nenddate\n);\n- this.status({\n- fill: 'yellow',\n- shape: 'dot',\n- text: `Requesting at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSending('Requesting');\ntry {\nvar results = await apiRequest;\n@@ -125,12 +121,7 @@ module.exports = function(RED) {\nerr.response.data.message\n}`;\nthis.error(errorMessage);\n-\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `Error at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed('Error');\nreturn null;\n}\n@@ -143,11 +134,7 @@ module.exports = function(RED) {\nswitch (this.nodeConfig.output_type) {\ncase 'split':\nif (results.length === 0) {\n- this.status({\n- fill: 'red',\n- shape: 'dot',\n- text: `No Results at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed('No Results');\nreturn;\n}\nif (entityidtype.value === 'is') {\n@@ -179,11 +166,7 @@ module.exports = function(RED) {\nbreak;\n}\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `Success at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -129,22 +129,11 @@ module.exports = function(RED) {\n} matches \"halt if state\" option`;\nthis.debug(debugMsg);\nthis.debugToClient(debugMsg);\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `${\n- pollState.state\n- } at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed(pollState.state);\nreturn this.send([null, msg]);\n}\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `${pollState.state} at: ${this.getPrettyDate()}`\n- });\n-\n+ this.setStatusSuccess(pollState.state);\nthis.send([msg, null]);\n} else {\nthis.warn(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -35,11 +35,7 @@ module.exports = function(RED) {\nreturn null;\n}\n- this.status({\n- fill: 'yellow',\n- shape: 'dot',\n- text: `Requesting at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSending('Requesting');\nreturn this.nodeConfig.server.http\n.renderTemplate(template)\n@@ -47,11 +43,7 @@ module.exports = function(RED) {\nmessage.template = template;\nmessage.payload = res;\nthis.node.send(message);\n- this.status({\n- fill: 'green',\n- shape: 'dot',\n- text: `Success at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess();\n})\n.catch(err => {\nlet errorMessage =\n@@ -62,11 +54,7 @@ module.exports = function(RED) {\n}`;\nthis.error(errorMessage);\n- this.status({\n- fill: 'red',\n- shape: 'ring',\n- text: `Error at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusFailed('Error');\n});\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -54,10 +54,7 @@ module.exports = function(RED) {\nclearTimeout(this.timeoutId);\nthis.active = false;\n- this.status({\n- fill: 'green',\n- text: `true at: ${this.getPrettyDate()}`\n- });\n+ this.setStatusSuccess('true');\nif (\nconfig.entityLocationType !== 'none' &&\n@@ -160,14 +157,10 @@ module.exports = function(RED) {\nnode.active = false;\nnode.send([null, message]);\n- node.status({\n- fill: 'red',\n- shape: 'dot',\n- text: `timed out at: ${node.getPrettyDate()}`\n- });\n+ node.setStatusFailed('timed out');\n}, node.timeout);\n}\n- node.status({ fill: 'blue', text: statusText });\n+ node.setStatus({ text: statusText });\nif (config.checkCurrentState === true) {\nconst currentState = await this.nodeConfig.server.homeAssistant.getStates(\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Refactor setStatus
Refactor setStatus to setStatusSuccess, setStatusFailed and
setStatusSending |
748,234 | 07.03.2019 16:14:08 | 28,800 | 126f2271a87b0b6810e00210b5cc1bff68fe18ac | chore(api): fixed status success message | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -80,7 +80,7 @@ module.exports = function(RED) {\nreturn apiCall()\n.then(results => {\n- node.setStatusSuccess(config.protocol);\n+ node.setStatusSuccess(`${config.protocol} called`);\nconst contextKey = RED.util.parseContextStore(\nconfig.location\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(api): fixed status success message |
748,234 | 07.03.2019 20:05:47 | 28,800 | 44f75c0762c3d8b93470fb9175fe402f0da0aa11 | feat(poll-state): Added Interval Units
Added Interval Units and check for extra spaces around entity id | [
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "name: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\nupdateinterval: { value: \"10\", validate: v => !isNaN(v) },\n+ updateIntervalUnits: { value: \"seconds\" },\noutputinitially: { value: false },\noutputonchanged: { value: false },\nentity_id: {\n});\n},\noneditsave: function() {\n- this.entity_id = $(\"#entity_id\").val();\n+ this.entity_id = $(\"#entity_id\")\n+ .val()\n+ .trim();\nconst outputs = $(\"#node-input-halt_if\").val() ? 2 : 1;\n$(\"#node-input-outputs\").val(outputs);\n},\n<div class=\"form-row\">\n<label for=\"node-input-updateinterval\"><i class=\"fa fa-clock-o\"></i> Update Interval</label>\n- <input type=\"text\" id=\"node-input-updateinterval\" placeholder=\"10\" style=\"width: auto;\"/> <span style=\"padding-left: 5px;\">Seconds</span>\n+ <input type=\"text\" id=\"node-input-updateinterval\" style=\"text-align:end; width:50px !important\">\n+ <select id=\"node-input-updateIntervalUnits\" style=\"width:auto !important\">\n+ <option value=\"seconds\">seconds</option>\n+ <option value=\"minutes\">minutes</option>\n+ <option value=\"hours\">hours</option>\n+ </select>\n</div>\n<div class=\"form-row\">\n<h3>Config</h3>\n<dl class=\"message-properties\">\n<dt>Update Interval<span class=\"property-type\">number</span></dt>\n- <dd>Number of seconds between checking / sending updates</dd>\n+ <dd>The amount of time between checking / sending updates</dd>\n<dt>Half If<span class=\"property-type\">string</span></dt>\n- <dd>If the new_state === this setting then skip sending</dd>\n+ <dd>If the new state equals this value the message will be sent to the second output</dd>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n<dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -7,6 +7,7 @@ module.exports = function(RED) {\nconfig: {\nentity_id: {},\nupdateinterval: {},\n+ updateIntervalUnits: {},\noutputinitially: {},\noutputonchanged: {},\nstate_type: {},\n@@ -19,30 +20,41 @@ module.exports = function(RED) {\nclass TimeSinceStateNode extends EventsNode {\nconstructor(nodeDefinition) {\nsuper(nodeDefinition, RED, nodeOptions);\n+ this.entityId = (this.nodeConfig.entity_id || '').trim();\nthis.init();\n}\ninit() {\n- if (!this.nodeConfig.entity_id)\n- throw new Error('Entity ID is required');\n+ if (!this.entityId) {\n+ throw new Error('Entity Id is required');\n+ }\nif (!this.timer) {\nconst interval =\n!this.nodeConfig.updateinterval ||\nparseInt(this.nodeConfig.updateinterval) < 1\n- ? 1\n+ ? 10\n: parseInt(this.nodeConfig.updateinterval);\n+\n+ switch (this.nodeConfig.updateIntervalUnits) {\n+ case 'minutes':\n+ this.updateInterval = interval * (60 * 1000);\n+ break;\n+ case 'hours':\n+ this.updateInterval = interval * (60 * 60 * 1000);\n+ break;\n+ default:\n+ this.updateInterval = interval * 1000;\n+ }\nthis.timer = setInterval(\nthis.onTimer.bind(this),\n- interval * 1000\n+ this.updateInterval\n);\n}\nif (this.nodeConfig.outputonchanged) {\nthis.addEventClientListener({\n- event: `ha_events:state_changed:${\n- this.nodeConfig.entity_id\n- }`,\n+ event: `ha_events:state_changed:${this.entityId}`,\nhandler: this.onTimer.bind(this)\n});\n}\n@@ -55,7 +67,7 @@ module.exports = function(RED) {\n}\n}\n- onClose(removed) {\n+ onClose() {\nsuper.onClose();\nif (this.timer) {\nclearInterval(this.timer);\n@@ -67,26 +79,31 @@ module.exports = function(RED) {\nif (!this.isConnected) return;\ntry {\n- const pollState = this.utils.merge(\n- {},\n- await this.getState(this.nodeConfig.entity_id)\n+ const pollState = await this.nodeConfig.server.homeAssistant.getStates(\n+ this.entityId\n);\n+\nif (!pollState) {\nthis.warn(\n- `could not find state with entity_id \"${\n- this.nodeConfig.entity_id\n- }\"`\n+ `could not find state with entity_id \"${this.entityId}\"`\n);\nthis.status({\nfill: 'red',\nshape: 'ring',\n- text: `no state found for ${this.nodeConfig.entity_id}`\n+ text: `no state found for ${this.entityId}`\n});\nreturn;\n}\nconst dateChanged = this.calculateTimeSinceChanged(pollState);\n- if (dateChanged) {\n+ if (!dateChanged) {\n+ this.warn(\n+ `could not calculate time since changed for entity_id \"${\n+ this.entityId\n+ }\"`\n+ );\n+ return;\n+ }\npollState.timeSinceChanged = ta.ago(dateChanged);\npollState.timeSinceChangedMs =\nDate.now() - dateChanged.getTime();\n@@ -118,7 +135,7 @@ module.exports = function(RED) {\n));\nconst msg = {\n- topic: this.nodeConfig.entity_id,\n+ topic: this.entityId,\npayload: pollState.state,\ndata: pollState\n};\n@@ -135,13 +152,6 @@ module.exports = function(RED) {\nthis.setStatusSuccess(pollState.state);\nthis.send([msg, null]);\n- } else {\n- this.warn(\n- `could not calculate time since changed for entity_id \"${\n- this.nodeConfig.entity_id\n- }\"`\n- );\n- }\n} catch (e) {\nthrow e;\n}\n@@ -151,14 +161,6 @@ module.exports = function(RED) {\nconst entityLastChanged = entityState.last_changed;\nreturn new Date(entityLastChanged);\n}\n-\n- async getState(entityId) {\n- let state = await this.nodeConfig.server.homeAssistant.getStates(\n- this.nodeConfig.entity_id\n- );\n-\n- return state;\n- }\n}\nRED.nodes.registerType('poll-state', TimeSinceStateNode);\n};\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(poll-state): Added Interval Units
Added Interval Units and check for extra spaces around entity id |
748,234 | 07.03.2019 20:24:29 | 28,800 | b46a4d50aeb2ad22464dc4edb0ba63b11562a440 | feat(get-history): Add flatten option
Instead of returning the data from home assistant ( array for each
entity_id ) return one flattened array of one item per history entry | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.html",
"new_path": "nodes/get-history/get-history.html",
"diff": "entityidtype: { value: \"\" },\nuseRelativeTime: { value: false },\nrelativeTime: { value: \"\" },\n+ flatten: { value: true },\noutput_type: { value: \"array\" },\noutput_location_type: { value: \"msg\" },\noutput_location: { value: \"payload\" }\n.trigger(\"change\");\n},\noneditsave: function() {\n- this.entityid = $(\"#entity_id\").val();\n+ this.entityid = $(\"#entity_id\")\n+ .val()\n+ .trim();\n}\n});\n</script>\n</div>\n<div class=\"form-row\">\n- <input type=\"checkbox\" id=\"node-input-useRelativeTime\" checked style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\"> \n+ <input type=\"checkbox\" id=\"node-input-useRelativeTime\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\"> \n<label for=\"node-input-useRelativeTime\" style=\"width: auto;\">Use Relative Time</label>\n</div>\n</ol>\n</div>\n+ <div class=\"form-row\">\n+ <input type=\"checkbox\" id=\"node-input-flatten\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\"> \n+ <label for=\"node-input-flatten\" style=\"width: auto;\">Flatten Results</label>\n+ </div>\n+\n<div class=\"form-row\">\n<label for=\"node-input-output_type\">Output Type</label>\n<select id=\"node-input-output_type\">\n<h3>Inputs</h3>\n<dl class=\"message-properties\">\n+ <dt class=\"optional\">entityid <span class=\"property-type\">string</span></dt>\n+ <dd>Exact entity_id to fetch history for, must be an exact match as is passed directly to the home-assistant api</dd>\n+\n<dt class=\"optional\">startdate <span class=\"property-type\">string | date</span></dt>\n<dd>Date to start fetching history from. Will override the nodes configuration if passed in</dd>\n<dt class=\"optional\">relativetime <span class=\"property-type\">string</span></dt>\n<dd>A timestring to be parsed into datetime string</dd>\n- <dt class=\"optional\">entityid <span class=\"property-type\">string</span></dt>\n- <dd>Exact entity_id to fetch history for, must be an exact match as is passed directly to the home-assistant api</dd>\n+ <dt>Flatten</dt>\n+ <dd>Instead of returning the data from home assistant ( array for each entity_id ) return one flattened array of one item per history entry</dd>\n+\n</dl>\n<h3>Outputs</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -14,6 +14,7 @@ module.exports = function(RED) {\nentityidtype: {},\nuseRelativeTime: {},\nrelativeTime: {},\n+ flatten: {},\noutput_type: {},\noutput_location_type: {},\noutput_location: {}\n@@ -53,6 +54,10 @@ module.exports = function(RED) {\nrelativeTime: {\nmessageProp: 'relativetime',\nconfigProp: 'relativeTime'\n+ },\n+ flatten: {\n+ messageProp: 'flatten',\n+ configProp: 'flatten'\n}\n}\n};\n@@ -68,12 +73,14 @@ module.exports = function(RED) {\nenddate,\nentityid,\nentityidtype,\n- relativeTime\n+ relativeTime,\n+ flatten\n} = parsedMessage;\nstartdate = startdate.value;\nenddate = enddate.value;\nentityid = entityid.value;\nrelativeTime = relativeTime.value;\n+ flatten = flatten.value;\nlet useRelativeTime = this.nodeConfig.useRelativeTime;\nif (this.nodeConfig.server === null) {\n@@ -97,13 +104,17 @@ module.exports = function(RED) {\nnull,\nenddate,\n{\n+ flatten: flatten,\ninclude: new RegExp(entityid)\n}\n)\n: this.nodeConfig.server.http.getHistory(\nstartdate,\nentityid,\n- enddate\n+ enddate,\n+ {\n+ flatten: flatten\n+ }\n);\nthis.setStatusSending('Requesting');\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(get-history): Add flatten option
Instead of returning the data from home assistant ( array for each
entity_id ) return one flattened array of one item per history entry |
748,234 | 07.03.2019 21:59:19 | 28,800 | 4ee501e4bee3602470f3c1d019a6f107a28b4434 | fix: Fix for checking valid entity id
Fix for checking valid entity id in the poll-state and current-state
nodes | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -59,7 +59,7 @@ module.exports = function(RED) {\n{},\nawait this.nodeConfig.server.homeAssistant.getStates(entity_id)\n);\n- if (!currentState)\n+ if (!currentState.entity_id)\nreturn logAndContinueEmpty(\n`entity could not be found in cache for entity_id: ${entity_id}, sending empty payload`\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -79,11 +79,14 @@ module.exports = function(RED) {\nif (!this.isConnected) return;\ntry {\n- const pollState = await this.nodeConfig.server.homeAssistant.getStates(\n+ const pollState = this.utils.merge(\n+ {},\n+ await this.nodeConfig.server.homeAssistant.getStates(\nthis.entityId\n+ )\n);\n- if (!pollState) {\n+ if (!pollState.entity_id) {\nthis.warn(\n`could not find state with entity_id \"${this.entityId}\"`\n);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: Fix for checking valid entity id
Fix for checking valid entity id in the poll-state and current-state
nodes |
748,234 | 07.03.2019 22:16:39 | 28,800 | bd1decad2fafc7b49c5b54f4559ebe75049d8be5 | refactor(api): Add failed status messages | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -41,11 +41,13 @@ module.exports = function(RED) {\nif (!path) {\nnode.error('HTTP request requires a valid path.');\n+ node.setStatusFailed();\nreturn;\n}\nif (!['get', 'post'].includes(config.method)) {\nnode.error('HTTP request requires a valid method');\n+ node.setStatusFailed();\nreturn;\n}\n@@ -62,6 +64,7 @@ module.exports = function(RED) {\nnode.error(\n`A WebSocket request requires a 'type' property in the data object.`\n);\n+ node.setStatusFailed();\nreturn null;\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(api): Add failed status messages |
748,234 | 07.03.2019 23:33:52 | 28,800 | 8f869060033b39108ddb04196295a30cb9a1e0d1 | feat(call-service): domain and service fields accept templates | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "$data\n.typedInput({\n- types: [\"json\"]\n+ types: [\n+ {\n+ value: \"json\",\n+ label: \"JSON\",\n+ icon: \"red/images/typedInput/json.png\",\n+ validate: function(v) {\n+ if (!v) return true;\n+ try {\n+ JSON.parse(v);\n+ return true;\n+ } catch (e) {\n+ return false;\n+ }\n+ },\n+ expand: function() {\n+ const that = this;\n+ const value = this.value();\n+ try {\n+ value = JSON.stringify(JSON.parse(value), null, 4);\n+ } catch (err) {}\n+ RED.editor.editJSON({\n+ value: value,\n+ complete: function(v) {\n+ const value = v;\n+ try {\n+ value = JSON.stringify(JSON.parse(v));\n+ } catch (err) {}\n+ that.value(value);\n+ }\n+ });\n+ }\n+ }\n+ ]\n})\n.typedInput(\"width\", \"68%\");\n<dd>A comma delimited list of entity ids</dd>\n<dt class=\"optional\">data <span class=\"property-type\">JSON</span></dt>\n<dd>JSON object to pass along.</dd>\n- <dt>Templates</dt>\n- <dd>You can use templates in the <code>Entity Id</code> and <code>data</code> fields. When using templates the top level is a property of the message object: <code>msg.payload</code> would be <code>{{payload}}</code>. You can also access the <code>flow, global and states</code> contexts <code>{{flow.foobar}}</code> <code>{{global.something}}</code>. For the <code>states</code> context you can use the <code>{{states.domain.entity_id}}</code> to just get the state or drill further down like <code>{{states.light.kitchen.attributes.friendly_name}}</code>. <code>{{states.light.kitchen}}</code> and <code>{{states.light.kitchen.state}}</code> are equivalent.</dd>\n</dl>\n<h3>Inputs</h3>\n<dd>Service <code>data</code> used in call, if one was used</dd>\n</dl>\n+ <h3>Templates</h3>\n+ <p>You can use templates in the <code>Domain</code>, <code>Service</code>, <code>Entity Id</code>, and <code>data</code> fields. When using templates the top level is a property of the message object: <code>msg.payload</code> would be <code>{{payload}}</code>. You can also access the <code>flow, global and states</code> contexts <code>{{flow.foobar}}</code> <code>{{global.something}}</code>. For the <code>states</code> context you can use the <code>{{states.domain.entity_id}}</code> to just get the state or drill further down like <code>{{states.light.kitchen.attributes.friendly_name}}</code>. <code>{{states.light.kitchen}}</code> and <code>{{states.light.kitchen.state}}</code> are equivalent.</p>\n+\n<h3>Details</h3>\n<p>If the incoming message has a <code>payload</code> property with <code>domain</code>, <code>service</code> set it will override any config values if set.</p>\n<p>If the incoming message has a <code>payload.data</code> that is an object or parseable into an object these properties will be <strong>merged</strong> with any config values set.<p>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -55,29 +55,40 @@ module.exports = function(RED) {\npayloadDomain = this.utils.reach('domain', payload);\npayloadService = this.utils.reach('service', payload);\n}\n-\nconst configDomain = this.nodeConfig.service_domain;\nconst configService = this.nodeConfig.service;\n- const apiDomain = payloadDomain || configDomain;\n- const apiService = payloadService || configService;\n+ const serverName = this.utils.toCamelCase(\n+ this.nodeConfig.server.name\n+ );\n+ const context = this.node.context();\n+ const apiDomain = RenderTemplate(\n+ payloadDomain || configDomain,\n+ message,\n+ context,\n+ serverName\n+ );\n+ const apiService = RenderTemplate(\n+ payloadService || configService,\n+ message,\n+ context,\n+ serverName\n+ );\nconst configData = RenderTemplate(\nthis.nodeConfig.data,\nmessage,\n- this.node.context(),\n- this.utils.toCamelCase(this.nodeConfig.server.name)\n+ context,\n+ serverName\n);\nconst apiData = this.getApiData(payload, configData);\n- if (!apiDomain) {\n- throw new Error(\n- 'call service node is missing api \"domain\" property, not found in config or payload'\n- );\n- }\n-\n- if (!apiService) {\n- throw new Error(\n- 'call service node is missing api \"service\" property, not found in config or payload'\n+ if (!apiDomain || !apiService) {\n+ this.error(\n+ `call service node is missing api \"${\n+ !apiDomain ? 'domain' : 'service'\n+ }\" property, not found in config or payload`\n);\n+ this.setStatusFailed('Error');\n+ return;\n}\nthis.debug(\n@@ -121,13 +132,11 @@ module.exports = function(RED) {\nthis.send(message);\n})\n.catch(err => {\n- let errorMessage =\n- 'Error call service, home assistant api error.';\n- if (err.message)\n- errorMessage = `${errorMessage} Error Message: ${\n- err.message\n- }`;\n- this.error(errorMessage);\n+ this.error(\n+ `Call-service API error.${\n+ err.message ? ` Error Message: ${err.message}` : ''\n+ }`\n+ );\nthis.setStatusFailed('API Error');\n});\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(call-service): domain and service fields accept templates |
748,234 | 07.03.2019 23:37:11 | 28,800 | 2fa74004fc655ec8d803ae368cf1ac4f50c2e767 | docs(wait-until): document compare against current state | [
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "<dt>Entity Location <span class=\"property-type optional\">object</span></dt>\n<dd>The entity object can also be pass with the message object.</dd>\n+\n+ <dt>Check against current state <span class=\"property-type optional\">boolean</span></dt>\n+ <dd>When input is received it will check the comparator against current state instead of waiting for a state change.</dd>\n+\n</dl>\n<h3>Outputs</h3>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | docs(wait-until): document compare against current state |
748,234 | 08.03.2019 00:14:08 | 28,800 | 1d2bde8a3936f9649b3b7054d515e18a2b7d99ef | chore(api): Changed icon image | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.html",
"new_path": "nodes/api/api.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- icon: \"server.png\",\n+ icon: \"plane.png\",\npaletteLabel: \"API\",\nlabel: function() {\nreturn this.name || \"API\";\n"
},
{
"change_type": "ADD",
"old_path": "nodes/api/icons/plane.png",
"new_path": "nodes/api/icons/plane.png",
"diff": "Binary files /dev/null and b/nodes/api/icons/plane.png differ\n"
},
{
"change_type": "DELETE",
"old_path": "nodes/api/icons/server.png",
"new_path": "nodes/api/icons/server.png",
"diff": "Binary files a/nodes/api/icons/server.png and /dev/null differ\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(api): Changed icon image |
748,234 | 08.03.2019 16:52:33 | 28,800 | e1ce911422469ba21a154915fa1cdbeecbff3bcd | feat: Access to msg, flow and global context
Able to access flow and global context from the state-change, poll-state
nodes. Able to access msg, flow and global context from current-state,
wait-until and get-entities nodes. | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -277,11 +277,21 @@ class BaseNode {\n}\n}\n+ getContextValue(location, property, message) {\n+ if (message && location === 'msg') {\n+ return this.RED.util.getMessageProperty(message, property);\n+ }\n+\n+ const contextKey = this.RED.util.parseContextStore(property);\n+ return this.context()[location].get(contextKey.key, contextKey.store);\n+ }\n+\nasync getComparatorResult(\ncomparatorType,\ncomparatorValue,\nactualValue,\n- comparatorValueDatatype\n+ comparatorValueDatatype,\n+ message\n) {\nif (\ncomparatorType === 'includes' ||\n@@ -293,10 +303,19 @@ class BaseNode {\ncomparatorValue = comparatorValue === 'true';\n}\n- const cValue = this.getCastValue(\n+ let cValue;\n+ if (['msg', 'flow', 'global'].includes(comparatorValueDatatype)) {\n+ cValue = this.getContextValue(\n+ comparatorValueDatatype,\n+ comparatorValue,\n+ message\n+ );\n+ } else {\n+ cValue = this.getCastValue(\ncomparatorValueDatatype,\ncomparatorValue\n);\n+ }\nswitch (comparatorType) {\ncase 'is':\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/haltif.js",
"new_path": "nodes/_static/haltif.js",
"diff": "const $ = window.jQuery;\n-const defaultTypes = ['str', 'num', 'bool', 're'];\nconst resizeHaltIf = function(input) {\nconst $clearHaltIf = $('#clearHaltIf');\n@@ -17,7 +16,11 @@ const resizeHaltIf = function(input) {\nwindow.resizeHaltIf = resizeHaltIf;\n-window.setupHaltIf = function(input, compare) {\n+window.setupHaltIf = function(\n+ input,\n+ compare,\n+ defaultTypes = ['str', 'num', 'bool', 're', 'flow', 'global']\n+) {\nconst $input = $(input);\nconst $compare = $(compare);\nconst $help = $('#halt_if_help');\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "}\n$.getScript(\"/homeassistant/static/haltif.js\", function() {\n- setupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\");\n+ setupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\", [\n+ \"str\",\n+ \"num\",\n+ \"bool\",\n+ \"re\",\n+ \"msg\",\n+ \"flow\",\n+ \"global\"\n+ ]);\n});\n},\noneditsave: function() {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -88,7 +88,8 @@ module.exports = function(RED) {\nthis.nodeConfig.halt_if_compare,\nthis.nodeConfig.halt_if,\ncurrentState.state,\n- this.nodeConfig.halt_if_type\n+ this.nodeConfig.halt_if_type,\n+ message\n);\nconst shouldHaltIfState = this.nodeConfig.halt_if && isHaltValid;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "{ value: \"starts_with\", text: \"starts with\" },\n{ value: \"in_group\", text: \"in group\" }\n];\n- const defaultTypes = [\"str\", \"num\", \"bool\", \"re\"];\n+ const defaultTypes = [\n+ \"str\",\n+ \"num\",\n+ \"bool\",\n+ \"re\",\n+ \"msg\",\n+ \"flow\",\n+ \"global\"\n+ ];\nconst $logic = $(\"#logic\");\nif (!NODE.server) {\ncase \"lte\":\ncase \"gt\":\ncase \"gte\":\n- types = [\"num\"];\n+ types = [\"num\", \"msg\", \"flow\", \"global\"];\nbreak;\ncase \"includes\":\ncase \"does_not_include\":\ncase \"starts_with\":\ncase \"in_group\":\n- types = [\"str\"];\n+ types = [\"str\", \"msg\", \"flow\", \"global\"];\nbreak;\n}\n$value.typedInput(\"types\", types);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -48,7 +48,8 @@ module.exports = function(RED) {\nrule.logic,\nrule.value,\nvalue,\n- rule.valueType\n+ rule.valueType,\n+ message\n);\nif (value === undefined || !result) {\nreturn false;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "$(\"#node-input-checkCurrentState\").prop(\"checked\", false);\n}\n- const defaultTypes = [\"str\", \"num\", \"bool\", \"re\"];\n+ const defaultTypes = [\n+ \"str\",\n+ \"num\",\n+ \"bool\",\n+ \"re\",\n+ \"msg\",\n+ \"flow\",\n+ \"global\"\n+ ];\n$(\"#node-input-value\")\n.typedInput({\ndefault: \"str\",\ncase \"lte\":\ncase \"gt\":\ncase \"gte\":\n- types = [\"num\"];\n+ types = [\"num\", \"msg\", \"flow\", \"global\"];\nbreak;\ncase \"includes\":\ncase \"does_not_include\":\n- types = [\"str\"];\n+ types = [\"str\", \"msg\", \"flow\", \"global\"];\nbreak;\n}\n$(\"#node-input-value\").typedInput(\"types\", types);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -45,7 +45,8 @@ module.exports = function(RED) {\nconfig.comparator,\nconfig.value,\nthis.utils.selectn(config.property, event.new_state),\n- config.valueType\n+ config.valueType,\n+ this.savedMessage\n);\nif (!result) {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat: Access to msg, flow and global context
Able to access flow and global context from the state-change, poll-state
nodes. Able to access msg, flow and global context from current-state,
wait-until and get-entities nodes. |
748,234 | 08.03.2019 19:16:56 | 28,800 | 61f9768bee671bf1898a12bb05a50656f2654b9f | fix(poll-state): Set default value for updateIntervalUnits | [
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n+ if (this.updateIntervalUnits === undefined) {\n+ $(\"#node-input-updateIntervalUnits\").val(\"seconds\");\n+ }\n+\n$.getScript(\"/homeassistant/static/haltif.js\", function() {\nsetupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\");\n});\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(poll-state): Set default value for updateIntervalUnits |
748,234 | 08.03.2019 19:35:50 | 28,800 | 1a250b91b1793b34ee39d30686d57dd66bee67fa | fix(haltif): Fix to include contexts on other operators | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/haltif.js",
"new_path": "nodes/_static/haltif.js",
"diff": "@@ -38,8 +38,13 @@ window.setupHaltIf = function(\n$compare.change(function(e) {\nlet types = defaultTypes;\n+ let extraTypes = ['flow', 'global'];\n$help.hide();\n+ if (defaultTypes.includes('msg')) {\n+ extraTypes = ['msg'].concat(extraTypes);\n+ }\n+\nswitch (e.target.value) {\ncase 'is':\ncase 'is_not':\n@@ -48,12 +53,12 @@ window.setupHaltIf = function(\ncase 'lte':\ncase 'gt':\ncase 'gte':\n- types = ['num'];\n+ types = ['num'].concat(extraTypes);\nbreak;\ncase 'includes':\ncase 'does_not_include':\n$help.show();\n- types = ['str'];\n+ types = ['str'].concat(extraTypes);\nbreak;\n}\n$input.typedInput('types', types);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(haltif): Fix to include contexts on other operators |
748,234 | 08.03.2019 23:24:21 | 28,800 | bcacc43e75a9ccd2021c1492e2471af466015544 | chore: Add note of breaking change to v0.8.0 | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG.md",
"new_path": "CHANGELOG.md",
"diff": "@@ -31,6 +31,10 @@ All notable changes to this project will be documented in this file. See [standa\n# [0.8.0](https://github.com/zachowj/node-red-contrib-home-assistant-websocket/compare/v0.7.1...v0.8.0) (2019-02-26)\n+## Breaking Change\n+\n+- jinja2 (HA) templates will no longer work in fields where mustache templates are rendered.\n+\n### Bug Fixes\n- **get-history:** fix backwards compatibility for output location ([8bd6e42](https://github.com/zachowj/node-red-contrib-home-assistant-websocket/commit/8bd6e42)), closes [mit/3154f79a5758c74967742e282660dac1decfbe74#r32270616](https://github.com/mit/3154f79a5758c74967742e282660dac1decfbe74/issues/r32270616)\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore: Add note of breaking change to v0.8.0 |
748,234 | 09.03.2019 00:10:04 | 28,800 | b8f4c3f6a4b703d42791c9885a4a86cff5d12ac3 | chore(call-service): Added back in missing work to status message | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -108,7 +108,7 @@ module.exports = function(RED) {\nreturn this.nodeConfig.server.websocket\n.callService(apiDomain, apiService, apiData)\n.then(() => {\n- this.setStatusSuccess(`${apiDomain}.${apiService}`);\n+ this.setStatusSuccess(`${apiDomain}.${apiService} called`);\nconst contextKey = RED.util.parseContextStore(\nthis.nodeConfig.output_location\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(call-service): Added back in missing work to status message |
748,234 | 10.03.2019 14:57:48 | 25,200 | 16a9b814bf5ea46a2eb054faa6fcf21f02e45632 | refactor(call-service): Revert to use the original json editor | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "$data\n.typedInput({\n- types: [\n- {\n- value: \"json\",\n- label: \"JSON\",\n- icon: \"red/images/typedInput/json.png\",\n- validate: function(v) {\n- if (!v) return true;\n- try {\n- JSON.parse(v);\n- return true;\n- } catch (e) {\n- return false;\n- }\n- },\n- expand: function() {\n- const that = this;\n- const value = this.value();\n- try {\n- value = JSON.stringify(JSON.parse(value), null, 4);\n- } catch (err) {}\n- RED.editor.editJSON({\n- value: value,\n- complete: function(v) {\n- const value = v;\n- try {\n- value = JSON.stringify(JSON.parse(v));\n- } catch (err) {}\n- that.value(value);\n- }\n- });\n- }\n- }\n- ]\n+ types: [\"json\"]\n})\n.typedInput(\"width\", \"68%\");\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(call-service): Revert to use the original json editor |
748,234 | 10.03.2019 15:00:32 | 25,200 | 7296cd20cdef03d87b5e814afeef031cac78bfd5 | feat(api): Allows input to set/override config values
Closes | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.html",
"new_path": "nodes/api/api.html",
"diff": "$(\"#node-input-data\")\n.typedInput({\n- types: [\n- {\n- value: \"json\",\n- label: \"JSON\",\n- icon: \"red/images/typedInput/json.png\",\n- validate: function(v) {\n- if (!v) return true;\n- try {\n- JSON.parse(v);\n- return true;\n- } catch (e) {\n- return false;\n- }\n- },\n- expand: function() {\n- const that = this;\n- const value = this.value();\n- try {\n- value = JSON.stringify(JSON.parse(value), null, 4);\n- } catch (err) {}\n- RED.editor.editJSON({\n- value: value,\n- complete: function(v) {\n- const value = v;\n- try {\n- value = JSON.stringify(JSON.parse(v));\n- } catch (err) {}\n- that.value(value);\n- }\n- });\n- }\n- }\n- ]\n+ types: [\"json\"]\n})\n.typedInput(\"width\", \"68%\");\n<dd>JSON Object to send for WebSocket requests and HTTP posts.</dd>\n<dt>Results<span class=\"property-type\">string</span></dt>\n- <dd>Location to saved the API results.</dd>\n+ <dd>Location to save the API results.</dd>\n+ </dl>\n- <dt>Templates</dt>\n- <dd>Templates can be used in path, params and data fields.</dd>\n+ <h3>Inputs</h3>\n+ <dl class=\"message-properties\">\n+ <dt>payload.protocol<span class=\"property-type\">[websocket|http] string</span></dt>\n+ <dd>Overrides or sets the protocol property of the config.</dd>\n+\n+ <dt>payload.method<span class=\"property-type\">[get|post] string</span></dt>\n+ <dd>Overrides or sets the method property of the config.</dd>\n+\n+ <dt>payload.path<span class=\"property-type\">string</span></dt>\n+ <dd>Overrides or sets the path property of the config.</dd>\n+\n+ <dt>payload.data<span class=\"property-type\">JSON | string</span></dt>\n+ <dd>Overrides or sets the data/params property of the config.</dd>\n+\n+ <dt>payload.location<span class=\"property-type\">string</span></dt>\n+ <dd>Overrides or sets the results property of the config.</dd>\n+\n+ <dt>payload.locationType<span class=\"property-type\">[msg|flow|global] string</span></dt>\n+ <dd>Overrides or sets the results type property of the config.</dd>\n</dl>\n<h3>Outputs</h3>\n- Will output the results received from the API call to the location defined in the config.\n+ <p>Will output the results received from the API call to the location defined in the config.</p>\n+\n+ <h3>Templates</h3>\n+ <p>Templates can be used in path, params and data fields. When using templates the top level is a property of the message object: <code>msg.payload</code> would be <code>{{payload}}</code>.</p>\n+\n+ <h3>References</h3>\n+ <p>\n+ <a href=\"https://developers.home-assistant.io/docs/en/external_api_rest.html\">http api</a><br />\n+ <a href=\"https://developers.home-assistant.io/docs/en/external_api_websocket.html\">websocket api</a>\n+ </p>\n</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "const RenderTemplate = require('../../lib/mustache-context');\nconst BaseNode = require('../../lib/base-node');\n+const Joi = require('joi');\nmodule.exports = function(RED) {\nconst nodeOptions = {\n@@ -12,6 +13,52 @@ module.exports = function(RED) {\ndata: {},\nlocation: {},\nlocationType: {}\n+ },\n+ input: {\n+ protocol: {\n+ messageProp: 'payload.protocol',\n+ configProp: 'protocol',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string().valid('websocket', 'http')\n+ }\n+ },\n+ method: {\n+ messageProp: 'payload.method',\n+ configProp: 'method',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string().valid('get', 'post')\n+ }\n+ },\n+ path: {\n+ messageProp: 'payload.path',\n+ configProp: 'path',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string()\n+ }\n+ },\n+ data: {\n+ messageProp: 'payload.data',\n+ configProp: 'data'\n+ },\n+ location: {\n+ messageProp: 'payload.location',\n+ configProp: 'location',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string()\n+ }\n+ },\n+ locationType: {\n+ messageProp: 'payload.locationType',\n+ configProp: 'locationType',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string().valid('msg', 'flow', 'global')\n+ }\n+ }\n}\n};\nclass ApiNode extends BaseNode {\n@@ -19,21 +66,24 @@ module.exports = function(RED) {\nsuper(nodeDefinition, RED, nodeOptions);\n}\n- onInput({ message }) {\n+ onInput({ message, parsedMessage }) {\nconst node = this;\nconst config = node.nodeConfig;\nconst serverName = node.utils.toCamelCase(config.server.name);\nconst data = RenderTemplate(\n- config.data,\n+ typeof parsedMessage.data.value === 'object'\n+ ? JSON.stringify(parsedMessage.data.value)\n+ : parsedMessage.data.value,\nmessage,\nnode.node.context(),\nserverName\n);\n+ const method = parsedMessage.method.value;\nlet apiCall;\n- if (config.protocol === 'http') {\n+ if (parsedMessage.protocol.value === 'http') {\nconst path = RenderTemplate(\n- config.path,\n+ parsedMessage.path.value,\nmessage,\nnode.node.context(),\nserverName\n@@ -45,13 +95,13 @@ module.exports = function(RED) {\nreturn;\n}\n- if (!['get', 'post'].includes(config.method)) {\n+ if (!['get', 'post'].includes(method)) {\nnode.error('HTTP request requires a valid method');\nnode.setStatusFailed();\nreturn;\n}\n- apiCall = config.server.http[`_${config.method}`].bind(\n+ apiCall = config.server.http[`_${method}`].bind(\nconfig.server.http,\npath,\ndata\n@@ -83,18 +133,21 @@ module.exports = function(RED) {\nreturn apiCall()\n.then(results => {\n- node.setStatusSuccess(`${config.protocol} called`);\n+ node.setStatusSuccess(\n+ `${parsedMessage.protocol.value} called`\n+ );\nconst contextKey = RED.util.parseContextStore(\n- config.location\n+ parsedMessage.location.value\n);\ncontextKey.key = contextKey.key || 'payload';\n- const locationType = config.location_type || 'msg';\n+ const locationType =\n+ parsedMessage.locationType.value || 'msg';\nif (locationType === 'flow' || locationType === 'global') {\nnode.node\n.context()\n- [locationType].set(\n+ [parsedMessage.locationType.value].set(\ncontextKey.key,\nresults,\ncontextKey.store\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(api): Allows input to set/override config values
Closes #100 |
748,234 | 13.03.2019 00:29:01 | 25,200 | 0eb85fb10693ccf6d19c5376549e9d1c150e0d52 | refactor(api): Factored out saving context to setContextValue | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -286,6 +286,25 @@ class BaseNode {\nreturn this.context()[location].get(contextKey.key, contextKey.store);\n}\n+ setContextValue(val, location, property, message) {\n+ const contextKey = this.RED.util.parseContextStore(property);\n+\n+ switch (location) {\n+ case 'none':\n+ break;\n+ case 'flow':\n+ case 'global':\n+ this.node\n+ .context()\n+ [location].set(contextKey.key, val, contextKey.store);\n+ break;\n+ case 'msg':\n+ default:\n+ this.RED.util.setObjectProperty(message, contextKey.key, val);\n+ break;\n+ }\n+ }\n+\nasync getComparatorResult(\ncomparatorType,\ncomparatorValue,\n@@ -427,6 +446,7 @@ const _eventHandlers = {\n} catch (e) {\nif (e && e.isJoi) {\nthis.node.warn(e.message);\n+ this.node.setStatusFailed('Error');\nreturn this.send(null);\n}\nthrow e;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -18,9 +18,12 @@ module.exports = function(RED) {\nprotocol: {\nmessageProp: 'payload.protocol',\nconfigProp: 'protocol',\n+ default: 'websocket',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string().valid('websocket', 'http')\n+ schema: Joi.string()\n+ .valid('websocket', 'http')\n+ .label('protocol')\n}\n},\nmethod: {\n@@ -28,7 +31,9 @@ module.exports = function(RED) {\nconfigProp: 'method',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string().valid('get', 'post')\n+ schema: Joi.string()\n+ .valid('get', 'post')\n+ .label('method')\n}\n},\npath: {\n@@ -37,6 +42,8 @@ module.exports = function(RED) {\nvalidation: {\nhaltOnFail: true,\nschema: Joi.string()\n+ .allow('')\n+ .label('path')\n}\n},\ndata: {\n@@ -46,17 +53,21 @@ module.exports = function(RED) {\nlocation: {\nmessageProp: 'payload.location',\nconfigProp: 'location',\n+ default: 'payload',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string()\n+ schema: Joi.string().label('location')\n}\n},\nlocationType: {\nmessageProp: 'payload.locationType',\nconfigProp: 'locationType',\n+ default: 'msg',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string().valid('msg', 'flow', 'global')\n+ schema: Joi.string()\n+ .valid('msg', 'flow', 'global', 'none')\n+ .label('locationType')\n}\n}\n}\n@@ -95,12 +106,6 @@ module.exports = function(RED) {\nreturn;\n}\n- if (!['get', 'post'].includes(method)) {\n- node.error('HTTP request requires a valid method');\n- node.setStatusFailed();\n- return;\n- }\n-\napiCall = config.server.http[`_${method}`].bind(\nconfig.server.http,\npath,\n@@ -137,24 +142,12 @@ module.exports = function(RED) {\n`${parsedMessage.protocol.value} called`\n);\n- const contextKey = RED.util.parseContextStore(\n- parsedMessage.location.value\n- );\n- contextKey.key = contextKey.key || 'payload';\n- const locationType =\n- parsedMessage.locationType.value || 'msg';\n-\n- if (locationType === 'flow' || locationType === 'global') {\n- node.node\n- .context()\n- [parsedMessage.locationType.value].set(\n- contextKey.key,\n+ this.setContextValue(\nresults,\n- contextKey.store\n+ parsedMessage.locationType.value,\n+ parsedMessage.location.value,\n+ message\n);\n- } else if (locationType === 'msg') {\n- message[contextKey.key] = results;\n- }\nnode.send(message);\n})\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(api): Factored out saving context to setContextValue |
748,234 | 13.03.2019 00:31:24 | 25,200 | 0be2bbe6295d0cd52b29521a6a2fb86e2e2d4c35 | refactor: Added Joi labels | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -32,6 +32,7 @@ module.exports = function(RED) {\nschema: Joi.date()\n.optional()\n.allow('')\n+ .label('startdate')\n}\n},\nenddate: {\n@@ -41,6 +42,7 @@ module.exports = function(RED) {\nschema: Joi.date()\n.optional()\n.allow('')\n+ .label('enddate')\n}\n},\nentityid: {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -15,7 +15,9 @@ module.exports = function(RED) {\nconfigProp: 'template',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string().required()\n+ schema: Joi.string()\n+ .required()\n+ .label('template')\n}\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Added Joi labels |
748,234 | 16.03.2019 00:10:35 | 25,200 | dfe4aade0decd676256e7e38dc2d7dd51025a6dc | refactor: Changed to setContextValue in all locations | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -36,9 +36,10 @@ module.exports = function(RED) {\n}\n}\nonInput({ message }) {\n+ const config = this.nodeConfig;\nif (\n- this.nodeConfig.server.websocket.connectionState !==\n- this.nodeConfig.server.websocket.CONNECTED\n+ config.server.websocket.connectionState !==\n+ config.server.websocket.CONNECTED\n) {\nthis.setStatusFailed('No Connection');\nthis.warn(\n@@ -55,11 +56,9 @@ module.exports = function(RED) {\npayloadDomain = this.utils.reach('domain', payload);\npayloadService = this.utils.reach('service', payload);\n}\n- const configDomain = this.nodeConfig.service_domain;\n- const configService = this.nodeConfig.service;\n- const serverName = this.utils.toCamelCase(\n- this.nodeConfig.server.name\n- );\n+ const configDomain = config.service_domain;\n+ const configService = config.service;\n+ const serverName = this.utils.toCamelCase(config.server.name);\nconst context = this.node.context();\nconst apiDomain = RenderTemplate(\npayloadDomain || configDomain,\n@@ -74,7 +73,7 @@ module.exports = function(RED) {\nserverName\n);\nconst configData = RenderTemplate(\n- this.nodeConfig.data,\n+ config.data,\nmessage,\ncontext,\nserverName\n@@ -105,30 +104,17 @@ module.exports = function(RED) {\nthis.setStatusSending();\n- return this.nodeConfig.server.websocket\n+ return config.server.websocket\n.callService(apiDomain, apiService, apiData)\n.then(() => {\nthis.setStatusSuccess(`${apiDomain}.${apiService} called`);\n- const contextKey = RED.util.parseContextStore(\n- this.nodeConfig.output_location\n- );\n- contextKey.key = contextKey.key || 'payload';\n- const locationType =\n- this.nodeConfig.output_location_type || 'msg';\n-\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\nmsgPayload,\n- contextKey.store\n+ config.output_location_type,\n+ config.output_location,\n+ message\n);\n- } else if (locationType === 'msg') {\n- message[contextKey.key] = msgPayload;\n- }\n-\nthis.send(message);\n})\n.catch(err => {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -37,125 +37,89 @@ module.exports = function(RED) {\n/* eslint-disable camelcase */\nasync onInput({ parsedMessage, message }) {\n- const entity_id = this.nodeConfig.entity_id\n- ? this.nodeConfig.entity_id\n+ const config = this.nodeConfig;\n+ const entityId = config.entity_id\n+ ? config.entity_id\n: parsedMessage.entity_id.value;\nconst logAndContinueEmpty = logMsg => {\nthis.node.warn(logMsg);\nreturn { payload: {} };\n};\n- if (this.nodeConfig.server === null) {\n+ if (config.server === null) {\nthis.node.error('No valid server selected.');\nreturn null;\n}\n- if (!entity_id)\n+ if (!entityId)\nreturn logAndContinueEmpty(\n'entity ID not set, cannot get current state, sending empty payload'\n);\nconst currentState = this.utils.merge(\n{},\n- await this.nodeConfig.server.homeAssistant.getStates(entity_id)\n+ await config.server.homeAssistant.getStates(entityId)\n);\nif (!currentState.entity_id)\nreturn logAndContinueEmpty(\n- `entity could not be found in cache for entity_id: ${entity_id}, sending empty payload`\n+ `entity could not be found in cache for entity_id: ${entityId}, sending empty payload`\n);\ncurrentState.timeSinceChangedMs =\nDate.now() - new Date(currentState.last_changed).getTime();\n// Convert and save original state if needed\n- if (\n- this.nodeConfig.state_type &&\n- this.nodeConfig.state_type !== 'str'\n- ) {\n+ if (config.state_type && config.state_type !== 'str') {\ncurrentState.original_state = currentState.state;\ncurrentState.state = this.getCastValue(\n- this.nodeConfig.state_type,\n+ config.state_type,\ncurrentState.state\n);\n}\n- this.nodeConfig.halt_if_compare =\n- this.nodeConfig.halt_if_compare || 'is';\n- this.nodeConfig.halt_if_type =\n- this.nodeConfig.halt_if_type || 'str';\n+ config.halt_if_compare = config.halt_if_compare || 'is';\n+ config.halt_if_type = config.halt_if_type || 'str';\nconst isHaltValid = await this.getComparatorResult(\n- this.nodeConfig.halt_if_compare,\n- this.nodeConfig.halt_if,\n+ config.halt_if_compare,\n+ config.halt_if,\ncurrentState.state,\n- this.nodeConfig.halt_if_type,\n+ config.halt_if_type,\nmessage\n);\n- const shouldHaltIfState = this.nodeConfig.halt_if && isHaltValid;\n+ const shouldHaltIfState = config.halt_if && isHaltValid;\n// default switch to true if undefined (backward compatibility\n- const override_topic = this.nodeConfig.override_topic !== false;\n- if (override_topic) message.topic = entity_id;\n+ const override_topic = config.override_topic !== false;\n+ if (override_topic) message.topic = entityId;\n- if (this.nodeConfig.state_location === undefined) {\n- this.nodeConfig.state_location = 'payload';\n- this.nodeConfig.override_payload =\n- this.nodeConfig.override_payload !== false ? 'msg' : 'none';\n+ if (config.state_location === undefined) {\n+ config.state_location = 'payload';\n+ config.override_payload =\n+ config.override_payload !== false ? 'msg' : 'none';\n}\n- if (this.nodeConfig.entity_location === undefined) {\n- this.nodeConfig.entity_location = 'data';\n- this.nodeConfig.override_data =\n- this.nodeConfig.override_data !== false ? 'msg' : 'none';\n+ if (config.entity_location === undefined) {\n+ config.entity_location = 'data';\n+ config.override_data =\n+ config.override_data !== false ? 'msg' : 'none';\n}\n- if (\n- this.nodeConfig.override_payload !== 'none' &&\n- this.nodeConfig.state_location\n- ) {\n- const contextKey = RED.util.parseContextStore(\n- this.nodeConfig.state_location\n- );\n- contextKey.key = contextKey.key || 'payload';\n- const locationType = this.nodeConfig.override_payload || 'msg';\n-\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\ncurrentState.state,\n- contextKey.store\n+ config.override_payload,\n+ config.state_location,\n+ message\n);\n- } else if (locationType === 'msg') {\n- message[contextKey.key] = currentState.state;\n- }\n- }\n- if (\n- this.nodeConfig.override_data !== 'none' &&\n- this.nodeConfig.entity_location\n- ) {\n- const contextKey = RED.util.parseContextStore(\n- this.nodeConfig.entity_location\n- );\n- contextKey.key = contextKey.key || 'data';\n- const locationType = this.nodeConfig.override_data || 'msg';\n-\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\ncurrentState,\n- contextKey.store\n+ config.override_data,\n+ config.entity_location,\n+ message\n);\n- } else if (locationType === 'msg') {\n- message[contextKey.key] = currentState;\n- }\n- }\nif (shouldHaltIfState) {\n- const debugMsg = `Get current state: halting processing due to current state of ${entity_id} matches \"halt if state\" option`;\n+ const debugMsg = `Get current state: halting processing due to current state of ${entityId} matches \"halt if state\" option`;\nthis.debug(debugMsg);\nthis.debugToClient(debugMsg);\nthis.setStatusFailed(currentState.state);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -23,15 +23,16 @@ module.exports = function(RED) {\n}\n/* eslint-disable camelcase */\n- async onInput({ parsedMessage, message }) {\n+ async onInput({ message }) {\n+ const config = this.nodeConfig;\nlet noPayload = false;\n- if (this.nodeConfig.server === null) {\n+ if (config.server === null) {\nthis.node.error('No valid server selected.');\nreturn null;\n}\n- const states = await this.nodeConfig.server.homeAssistant.getStates();\n+ const states = await config.server.homeAssistant.getStates();\nif (!states) {\nthis.node.warn(\n'local state cache missing sending empty payload'\n@@ -40,7 +41,7 @@ module.exports = function(RED) {\n}\nlet entities = await filter(Object.values(states), async entity => {\n- const rules = this.nodeConfig.rules;\n+ const rules = config.rules;\nfor (const rule of rules) {\nconst value = this.utils.reach(rule.property, entity);\n@@ -64,7 +65,7 @@ module.exports = function(RED) {\nlet statusText = `${entities.length} entities`;\nlet payload = {};\n- switch (this.nodeConfig.output_type) {\n+ switch (config.output_type) {\ncase 'split':\nif (entities.length === 0) {\nnoPayload = true;\n@@ -79,8 +80,7 @@ module.exports = function(RED) {\nnoPayload = true;\nbreak;\n}\n- let maxReturned =\n- Number(this.nodeConfig.output_results_count) || 1;\n+ let maxReturned = Number(config.output_results_count) || 1;\nconst max =\nentities.length <= maxReturned\n@@ -97,10 +97,7 @@ module.exports = function(RED) {\nbreak;\ncase 'array':\ndefault:\n- if (\n- entities.length === 0 &&\n- !this.nodeConfig.output_empty_results\n- ) {\n+ if (entities.length === 0 && !config.output_empty_results) {\nnoPayload = true;\n}\n@@ -115,21 +112,12 @@ module.exports = function(RED) {\nthis.setStatusSuccess(statusText);\n- const contextKey = RED.util.parseContextStore(\n- this.nodeConfig.output_location\n- );\n- const locationType = this.nodeConfig.output_location_type;\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\npayload,\n- contextKey.store\n+ config.output_location_type,\n+ config.output_location,\n+ message\n);\n- } else {\n- message[contextKey.key] = payload;\n- }\nthis.node.send(message);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -159,21 +159,12 @@ module.exports = function(RED) {\ncase 'array':\ndefault:\n- const contextKey = RED.util.parseContextStore(\n- this.nodeConfig.output_location\n- );\n- const locationType = this.nodeConfig.output_location_type;\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\nresults,\n- contextKey.store\n+ this.nodeConfig.output_location_type,\n+ this.nodeConfig.output_location,\n+ message\n);\n- } else {\n- message[contextKey.key] = results;\n- }\nthis.node.send(message);\nbreak;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -35,7 +35,7 @@ module.exports = function(RED) {\nasync onEntityChange(evt) {\ntry {\nconst config = this.nodeConfig;\n- const { event } = this.utils.merge({}, evt);\n+ const event = Object.assign({}, evt.event);\nif (!this.active) {\nreturn null;\n@@ -64,23 +64,13 @@ module.exports = function(RED) {\nevent.new_state.timeSinceChangedMs =\nDate.now() -\nnew Date(event.new_state.last_changed).getTime();\n- const contextKey = RED.util.parseContextStore(\n- config.entityLocation\n- );\n- contextKey.key = contextKey.key || 'data';\n- const locationType = config.entityLocationType || 'msg';\n-\n- if (locationType === 'flow' || locationType === 'global') {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+\n+ this.setContextValue(\nevent.new_state,\n- contextKey.store\n+ config.entityLocationType,\n+ config.entityLocation,\n+ this.savedMessage\n);\n- } else if (locationType === 'msg') {\n- this.savedMessage[contextKey.key] = event.new_state;\n- }\n}\nthis.send([this.savedMessage, null]);\n@@ -89,7 +79,7 @@ module.exports = function(RED) {\n}\n}\n- async onInput({ parsedMessage, message }) {\n+ async onInput({ message }) {\nconst node = this;\nconst config = node.nodeConfig;\n@@ -123,38 +113,22 @@ module.exports = function(RED) {\n}\nnode.timeoutId = setTimeout(async function() {\n- const state = await config.server.homeAssistant.getStates(\n+ const state = Object.assign(\n+ {},\n+ await config.server.homeAssistant.getStates(\nconfig.entityId\n+ )\n);\n- if (\n- config.entityLocationType !== 'none' &&\n- config.entityLocation\n- ) {\nstate.timeSinceChangedMs =\nDate.now() - new Date(state.last_changed).getTime();\n- const contextKey = RED.util.parseContextStore(\n- config.entityLocation\n- );\n- contextKey.key = contextKey.key || 'data';\n- const locationType = config.entityLocationType || 'msg';\n-\n- if (\n- locationType === 'flow' ||\n- locationType === 'global'\n- ) {\n- this.node\n- .context()\n- [locationType].set(\n- contextKey.key,\n+ this.setContextValue(\nstate,\n- contextKey.store\n+ config.entityLocationType,\n+ config.entityLocation,\n+ message\n);\n- } else if (locationType === 'msg') {\n- message[contextKey.key] = state;\n- }\n- }\nnode.active = false;\nnode.send([null, message]);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Changed to setContextValue in all locations |
748,234 | 16.03.2019 19:23:56 | 25,200 | e6ee48e4ce56fb2433b45ecd03e39a67fb7f2698 | docs: Removed need for docker v8 image as it is default | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -14,7 +14,7 @@ Project is going through active development and as such will probably have a few\nThis assumes you have [Node-RED](https://nodered.org) already installed and working, if you need to install Node-RED see [here](https://nodered.org/docs/getting-started/installation)\n-**NOTE:** This requires [Node.js](https://nodejs.org) v8.12+ and [Node-RED](https://nodered.org/) v0.19+. If you're running Node-Red in Docker you'll need to pull the -v8 image for this to work.\n+**NOTE:** This requires [Node.js](https://nodejs.org) v8.12+ and [Node-RED](https://nodered.org/) v0.19+.\nInstall via Node-RED Manage Palette\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | docs: Removed need for docker v8 image as it is default |
748,234 | 16.03.2019 21:49:17 | 25,200 | db2966f024bae862d4191bd6a4501f690938ebe2 | ci: Remove greenkeeper config | [
{
"change_type": "DELETE",
"old_path": "greenkeeper.json",
"new_path": null,
"diff": "-{\n- \"groups\": {\n- \"default\": {\n- \"packages\": [\n- \"docker/node-red/root-fs/app/package.json\",\n- \"docker/node-red/root-fs/data/package.json\",\n- \"package.json\"\n- ]\n- }\n- }\n-}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | ci: Remove greenkeeper config |
748,234 | 18.03.2019 16:10:05 | 25,200 | 306115129b73359c0b12f243f4485071b75ecbb2 | feat(get-entities): Added total count of entities as an output option | [
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "$(\"#output_empty_results\").show();\n$(\"#output_location\").show();\nbreak;\n+ case \"count\":\n+ $(\"#output_location\").show();\n+ break;\ncase \"random\":\n$(\"#output_results_count\").show();\n$(\"#output_location\").show();\n<label for=\"node-input-output_type\" style=\"width: 160px;\">Output Type</label>\n<select id=\"node-input-output_type\">\n<option value=\"array\">Array</option>\n- <option value=\"split\">Split</option>\n+ <option value=\"count\">Count</option>\n<option value=\"random\">Random</option>\n+ <option value=\"split\">Split</option>\n</select>\n</div>\n<dt>Array<span class=\"property-type\">array</span></dt>\n<dd>Sends an array of state objects from search criteria to the Output Location.</dd>\n- <dt>Split<span class=\"property-type\">msg part</span></dt>\n- <dd>Sends a message for each state object. In the same format as if the split node was used.</dd>\n+ <dt>Count<span class=\"property-type\">number</span></dt>\n+ <dd>Return the total count of valid entities.</dd>\n<dt>Random<span class=\"property-type\">object/array</span></dt>\n<dd>Return a random object or array from the available state objects to the Output Location. When <code>One Max Results</code> is selected it will return an object and when more than one is selected will always return an array of state objects.</dd>\n+\n+ <dt>Split<span class=\"property-type\">msg part</span></dt>\n+ <dd>Sends a message for each state object. In the same format as if the split node was used.</dd>\n</dl>\n<h3>State Object Format</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -66,6 +66,9 @@ module.exports = function(RED) {\nlet payload = {};\nswitch (config.output_type) {\n+ case 'count':\n+ payload = entities.length;\n+ break;\ncase 'split':\nif (entities.length === 0) {\nnoPayload = true;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(get-entities): Added total count of entities as an output option |
748,234 | 21.03.2019 00:58:46 | 25,200 | 04728a45475eff78ca7d66ff09e7058595e2248f | refactor: Removed alias for selectn | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -10,7 +10,6 @@ const utils = {\nselectn,\nmerge,\nJoi,\n- reach: (path, obj) => selectn(path, obj),\nformatDate: date => dateFns.format(date, 'ddd, h:mm:ss A'),\ntoCamelCase(str) {\nreturn str.replace(/(?:^\\w|[A-Z]|\\b\\w|\\s+)/g, function(match, index) {\n@@ -64,7 +63,7 @@ class BaseNode {\nthis.node.on('input', this._eventHandlers.preOnInput.bind(this));\nthis.node.on('close', this._eventHandlers.preOnClose.bind(this));\n- const name = this.reach('nodeConfig.name');\n+ const name = selectn('nodeConfig.name', this);\nthis.debug(`instantiated node, name: ${name || 'undefined'}`);\n}\n@@ -222,7 +221,7 @@ class BaseNode {\n}\nget eventsClient() {\n- return this.reach('nodeConfig.server.websocket');\n+ return selectn('nodeConfig.server.websocket', this);\n}\nget isConnected() {\n@@ -236,12 +235,6 @@ class BaseNode {\nreturn this.eventsClient && this.eventsClient.connectionState;\n}\n- // Returns the evaluated path on this class instance\n- // ex: myNode.reach('nodeConfig.server.events')\n- reach(path) {\n- return selectn(path, this);\n- }\n-\ngetPrettyDate() {\nreturn new Date().toLocaleDateString('en-US', {\nmonth: 'short',\n@@ -372,7 +365,7 @@ class BaseNode {\ncValue\n);\nconst groupEntities =\n- this.utils.reach('attributes.entity_id', entity) || [];\n+ selectn('attributes.entity_id', entity) || [];\nreturn groupEntities.includes(actualValue);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -53,8 +53,8 @@ module.exports = function(RED) {\nif (message && message.payload) {\npayload = this.tryToObject(message.payload);\n- payloadDomain = this.utils.reach('domain', payload);\n- payloadService = this.utils.reach('service', payload);\n+ payloadDomain = this.utils.selectn('domain', payload);\n+ payloadService = this.utils.selectn('service', payload);\n}\nconst configDomain = config.service_domain;\nconst configService = config.service;\n@@ -132,7 +132,7 @@ module.exports = function(RED) {\nlet apiData;\nlet contextData = {};\n- let payloadData = this.utils.reach('data', payload);\n+ let payloadData = this.utils.selectn('data', payload);\nlet configData = this.tryToObject(data);\npayloadData = payloadData || {};\nconfigData = configData || {};\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -260,7 +260,7 @@ module.exports = function(RED) {\n// Close WebSocket client on redeploy or node-RED shutdown\nasync onClose(removed) {\nsuper.onClose();\n- const webSocketClient = this.utils.reach(\n+ const webSocketClient = this.utils.selectn(\n'homeAssistant.websocket.client',\nthis\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "@@ -34,7 +34,7 @@ module.exports = function(RED) {\nif (message && message.payload) {\npayload = this.tryToObject(message.payload);\n- payloadEvent = this.utils.reach('event', payload);\n+ payloadEvent = this.utils.selectn('event', payload);\n}\nconst configEvent = this.nodeConfig.event;\n@@ -83,7 +83,7 @@ module.exports = function(RED) {\nlet eventData;\nlet contextData = {};\n- let payloadData = this.utils.reach('data', payload);\n+ let payloadData = this.utils.selectn('data', payload);\nlet configData = this.tryToObject(data);\npayloadData = payloadData || {};\nconfigData = configData || {};\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -44,7 +44,7 @@ module.exports = function(RED) {\nconst rules = config.rules;\nfor (const rule of rules) {\n- const value = this.utils.reach(rule.property, entity);\n+ const value = this.utils.selectn(rule.property, entity);\nconst result = await this.getComparatorResult(\nrule.logic,\nrule.value,\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.js",
"new_path": "nodes/trigger-state/trigger-state.js",
"diff": "@@ -219,7 +219,7 @@ module.exports = function(RED) {\nconstraint,\neventMessage.event\n);\n- const actualValue = this.utils.reach(\n+ const actualValue = this.utils.selectn(\nconstraint.propertyValue,\nconstraintTarget.state\n);\n@@ -289,7 +289,7 @@ module.exports = function(RED) {\n};\nif (output.comparatorPropertyType !== 'always') {\n- result.actualValue = this.utils.reach(\n+ result.actualValue = this.utils.selectn(\noutput.comparatorPropertyValue,\neventMessage.event\n);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Removed alias for selectn |
748,234 | 25.03.2019 05:58:48 | 25,200 | 93a64713b2f48e7dd199db17325381cf8735f6fb | refactor(api): Added check for connection to server | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -80,6 +80,17 @@ module.exports = function(RED) {\nonInput({ message, parsedMessage }) {\nconst node = this;\nconst config = node.nodeConfig;\n+\n+ if (\n+ config.server.websocket.connectionState !==\n+ config.server.websocket.CONNECTED\n+ ) {\n+ this.setStatusFailed('No Connection');\n+ this.warn('API call attempted without connection to server.');\n+\n+ return;\n+ }\n+\nconst serverName = node.utils.toCamelCase(config.server.name);\nconst data = RenderTemplate(\ntypeof parsedMessage.data.value === 'object'\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(api): Added check for connection to server |
748,234 | 28.03.2019 21:05:47 | 25,200 | 66d504df85b0513ec85ffeb02af252e6b2f1cf2d | feat(render-template): Added custom outputs | [
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.html",
"new_path": "nodes/render-template/render-template.html",
"diff": "<script type=\"text/javascript\">\n(function() {\n- RED.nodes.registerType('api-render-template', {\n- category: 'home_assistant',\n- color: '#52C0F2',\n+ RED.nodes.registerType(\"api-render-template\", {\n+ category: \"home_assistant\",\n+ color: \"#52C0F2\",\ndefaults: {\n- name: { value: '' },\n- server: { value: '', type: 'server', required: true },\n- template: { value: '' }\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ template: { value: \"\" },\n+ resultsLocation: { value: \"payload\" },\n+ resultsLocationType: { value: \"msg\" },\n+ templateLocation: { value: \"template\" },\n+ templateLocationType: { value: \"msg\" }\n},\ninputs: 1,\noutputs: 1,\nicon: \"parser-json.png\",\n- paletteLabel: 'get template',\n- label: function () { return this.name || `template: ${this.template || ''}` },\n+ paletteLabel: \"get template\",\n+ label: function() {\n+ return this.name || `template: ${this.template || \"\"}`;\n+ },\noneditprepare: function() {\n- const NODE = this;\n- const $server = $('#node-input-server');\n+ const $server = $(\"#node-input-server\");\nconst utils = {\nsetDefaultServerSelection: function() {\nlet defaultServer;\nRED.nodes.eachConfig(n => {\n- if (n.type === 'server' && !defaultServer) defaultServer = n.id;\n+ if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n});\nif (defaultServer) $server.val(defaultServer);\n}\n};\n- if (!NODE.server) {\n+ if (!this.server) {\nutils.setDefaultServerSelection();\n}\n$inputTemplate = $(\"#node-input-template\");\n+ if (this.templateLocation === undefined) {\n+ $(\"#node-input-templateLocation\").val(\"template\");\n+ }\n+ if (this.resultsLocation === undefined) {\n+ $(\"#node-input-resultsLocation\").val(\"payload\");\n+ }\n+ $(\"#node-input-templateLocation\").typedInput({\n+ types: [\n+ \"msg\",\n+ \"flow\",\n+ \"global\",\n+ { value: \"none\", label: \"none\", hasValue: false }\n+ ],\n+ typeField: \"#node-input-templateLocationType\"\n+ });\n+\n+ $(\"#node-input-resultsLocation\").typedInput({\n+ types: [\n+ \"msg\",\n+ \"flow\",\n+ \"global\",\n+ { value: \"none\", label: \"none\", hasValue: false }\n+ ],\n+ typeField: \"#node-input-resultsLocationType\"\n+ });\n+\n// NOTE: Copypasta from node-red/nodes/core/template node\n// TODO: How to get jinja syntax highlighting with ace editor?\n// TODO: Add a preview render button for testing (or call render on debounced keyup)\nthis.editor = RED.editor.createEditor({\n- id: 'node-input-template-editor',\n+ id: \"node-input-template-editor\",\nvalue: $inputTemplate.val()\n});\nthis.editor.focus();\n},\noneditresize: function(size) {\n- const $rows = $('#dialog-form>div:not(.node-text-editor-row)');\n- const $editorRow = $('#dialog-form>div.node-text-editor-row');\n- const $textEditor = $('.node-text-editor');\n- const $dialogForm = $('#dialog-form');\n+ const $rows = $(\"#dialog-form>div:not(.node-text-editor-row)\");\n+ const $editorRow = $(\"#dialog-form>div.node-text-editor-row\");\n+ const $textEditor = $(\".node-text-editor\");\n+ const $dialogForm = $(\"#dialog-form\");\nlet height = $dialogForm.height();\n- for (var i = 0; i < $rows.size(); i++) { height -= $($rows[i]).outerHeight(true); }\n- height -= (parseInt($editorRow.css('marginTop')) + parseInt($editorRow.css('marginBottom')));\n+ for (var i = 0; i < $rows.size(); i++) {\n+ height -= $($rows[i]).outerHeight(true);\n+ }\n+ height -=\n+ parseInt($editorRow.css(\"marginTop\")) +\n+ parseInt($editorRow.css(\"marginBottom\"));\n- $textEditor.css('height', `${height}px`);\n+ $textEditor.css(\"height\", `${height}px`);\nthis.editor.resize();\n},\noneditcancel: function() {\n})();\n</script>\n-\n<script type=\"text/x-red\" data-template-name=\"api-render-template\">\n<div class=\"form-row\">\n<label for=\"node-input-name\"><i class=\"fa fa-tag\"></i> Name</label>\n<div style=\"height: 250px; min-height:150px;\" class=\"node-text-editor\" id=\"node-input-template-editor\" ></div>\n</div>\n+ <div class=\"form-row\">\n+ <label for=\"node-input-templateLocation\">Template</label>\n+ <input type=\"text\" id=\"node-input-templateLocation\" />\n+ <input type=\"hidden\" id=\"node-input-templateLocationType\" />\n+ </div>\n+\n+ <div class=\"form-row\">\n+ <label for=\"node-input-resultsLocation\">Results</label>\n+ <input type=\"text\" id=\"node-input-resultsLocation\" />\n+ <input type=\"hidden\" id=\"node-input-resultsLocationType\" />\n+ </div>\n</script>\n<script type=\"text/x-red\" data-help-name=\"api-render-template\">\n<dl class=\"message-properties\">\n<dt class=\"optional\"> template <span class=\"property-type\">string</span></dt>\n<dd>Jinja template to be rendered, discarded if `msg.template` is provided via input msg </dd>\n- </dl>\n+ <dt>Template Location</dt>\n+ <dd>Customizable location to output original template</dd>\n+\n+ <dt>Results</dt>\n+ <dd>Customizable location to output rendered template</dd>\n+ </dl>\n<h3>Inputs</h3>\n<dl class=\"message-properties\">\n<li><a href=\"https://home-assistant.io/docs/configuration/templating/\">Home Assistant Template Docs</a></li>\n<li><a href=\"http://jinja.pocoo.org/docs/dev/templates/\">Jinja Docs</a></li>\n</ul>\n-\n</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -5,9 +5,13 @@ module.exports = function(RED) {\nconst nodeOptions = {\ndebug: true,\nconfig: {\n- template: {},\nname: {},\n- server: { isNode: true }\n+ server: { isNode: true },\n+ template: {},\n+ resultsLocation: {},\n+ resultsLocationType: {},\n+ templateLocation: {},\n+ templateLocationType: {}\n},\ninput: {\ntemplate: {\n@@ -19,6 +23,38 @@ module.exports = function(RED) {\n.required()\n.label('template')\n}\n+ },\n+ resultsLocation: {\n+ messageProp: 'resultsLocation',\n+ configProp: 'resultsLocation',\n+ default: 'payload'\n+ },\n+ resultsLocationType: {\n+ messageProp: 'resultsLocationType',\n+ configProp: 'resultsLocationType',\n+ default: 'msg',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string()\n+ .valid('msg', 'flow', 'global', 'none')\n+ .label('resultsLocationType')\n+ }\n+ },\n+ templateLocation: {\n+ messageProp: 'templateLocation',\n+ configProp: 'templateLocation',\n+ default: 'template'\n+ },\n+ templateLocationType: {\n+ messageProp: 'templateLocationType',\n+ configProp: 'templateLocationType',\n+ default: 'msg',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string()\n+ .valid('msg', 'flow', 'global', 'none')\n+ .label('templateLocationType')\n+ }\n}\n}\n};\n@@ -29,8 +65,13 @@ module.exports = function(RED) {\n}\nonInput({ parsedMessage, message }) {\n- let { template } = parsedMessage;\n- template = template.value;\n+ const {\n+ template,\n+ templateLocation,\n+ templateLocationType,\n+ resultsLocation,\n+ resultsLocationType\n+ } = parsedMessage;\nif (this.nodeConfig.server === null) {\nthis.node.error('No valid server selected.');\n@@ -40,22 +81,32 @@ module.exports = function(RED) {\nthis.setStatusSending('Requesting');\nreturn this.nodeConfig.server.http\n- .renderTemplate(template)\n+ .renderTemplate(template.value)\n.then(res => {\n- message.template = template;\n- message.payload = res;\n+ this.setContextValue(\n+ template.value,\n+ templateLocationType.value,\n+ templateLocation.value,\n+ message\n+ );\n+ this.setContextValue(\n+ res,\n+ resultsLocationType.value,\n+ resultsLocation.value,\n+ message\n+ );\n+\nthis.node.send(message);\nthis.setStatusSuccess();\n})\n.catch(err => {\n- let errorMessage =\n- 'Error get-template, home assistant api error.';\n- if (this.utils.selectn('response.data.message', err))\n- errorMessage = `${errorMessage} Error Message: ${\n- err.response.data.message\n- }`;\n-\n- this.error(errorMessage);\n+ this.error(\n+ `Error get-template, home assistant api error. ${\n+ this.utils.selectn('response.data.message', err)\n+ ? `Error Message: ${err.response.data.message}`\n+ : ''\n+ }`\n+ );\nthis.setStatusFailed('Error');\n});\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(render-template): Added custom outputs |
748,234 | 29.03.2019 10:00:40 | 25,200 | 3f24b1f8ad074bcef38396b4603822510b95e5c2 | refactor(ha-websocket): Simplified Reconnect time, removed unused getUser | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -40,7 +40,7 @@ class HaWebsocket extends EventEmitter {\ntry {\nthis.client = await homeassistant.createConnection({\n- auth: this,\n+ self: this,\ncreateSocket: this.createSocket\n});\n} catch (e) {\n@@ -67,12 +67,6 @@ class HaWebsocket extends EventEmitter {\nthis.onClientServices(ent)\n);\n- if (!this.config.legacy) {\n- homeassistant\n- .getUser(this.client)\n- .then(msg => debug('[Account Name] ' + msg.name));\n- }\n-\nreturn true;\n}\n@@ -221,10 +215,11 @@ class HaWebsocket extends EventEmitter {\n* Pretty much a copy from https://github.com/home-assistant/home-assistant-js-websocket\n*/\ncreateSocket() {\n- if (!this.auth.config.baseUrl) {\n+ const self = this.self;\n+\n+ if (!self.config.baseUrl) {\nthrow homeassistant.ERR_HASS_HOST_REQUIRED;\n}\n- const self = this.auth;\n// Convert from http:// -> ws://, https:// -> wss://\nconst isHassio = self.config.baseUrl === 'http://hassio/homeassistant';\n@@ -286,7 +281,7 @@ class HaWebsocket extends EventEmitter {\ndefault:\nif (message.type !== MSG_TYPE_AUTH_REQUIRED) {\n- debug('[Auth phase] Unhandled message', message);\n+ debug('[Auth Phase] Unhandled message', message);\n}\n}\n};\n@@ -322,24 +317,17 @@ class HaWebsocket extends EventEmitter {\nreturn new Promise((resolve, reject) => {\n// if hass.io, do a 5 second delay so it doesn't spam the hass.io proxy\n// https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/76\n- if (\n- process.env.HASSIO_TOKEN &&\n- self.config.connectionDelay !== false\n- ) {\nsetTimeout(\n() =>\nconnect(\nresolve,\nreject\n),\n- 5000\n- );\n- } else {\n- connect(\n- resolve,\n- reject\n+ process.env.HASSIO_TOKEN &&\n+ self.config.connectionDelay !== false\n+ ? 5000\n+ : 0\n);\n- }\n});\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(ha-websocket): Simplified Reconnect time, removed unused getUser |
748,234 | 29.03.2019 10:25:54 | 25,200 | ece176b88eb53808376c31220df98c02fe599ef1 | feat: Able to reference entity in comparators | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -303,7 +303,7 @@ class BaseNode {\ncomparatorValue,\nactualValue,\ncomparatorValueDatatype,\n- message\n+ { message, entity, prevEntity }\n) {\nif (\ncomparatorType === 'includes' ||\n@@ -322,6 +322,11 @@ class BaseNode {\ncomparatorValue,\nmessage\n);\n+ } else if (['entity', 'prevEntity'].includes(comparatorValueDatatype)) {\n+ cValue = selectn(\n+ comparatorValue,\n+ comparatorValueDatatype === 'entity' ? entity : prevEntity\n+ );\n} else {\ncValue = this.getCastValue(\ncomparatorValueDatatype,\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/haltif.js",
"new_path": "nodes/_static/haltif.js",
"diff": "@@ -16,14 +16,25 @@ const resizeHaltIf = function(input) {\nwindow.resizeHaltIf = resizeHaltIf;\n-window.setupHaltIf = function(\n- input,\n- compare,\n- defaultTypes = ['str', 'num', 'bool', 're', 'flow', 'global']\n-) {\n+window.setupHaltIf = function(input, compare, nodeName) {\nconst $input = $(input);\nconst $compare = $(compare);\nconst $help = $('#halt_if_help');\n+ const entityType = { value: 'entity', label: 'entity.' };\n+ let defaultTypes = [\n+ 'str',\n+ 'num',\n+ 'bool',\n+ 're',\n+ 'msg',\n+ 'flow',\n+ 'global',\n+ entityType\n+ ];\n+\n+ if (nodeName === 'currentState') {\n+ defaultTypes.splice(4, 1);\n+ }\n$input.after(\n' <a id=\"clearHaltIf\" class=\"editor-button\"><i class=\"fa fa-remove\"></i></a>'\n@@ -38,7 +49,7 @@ window.setupHaltIf = function(\n$compare.change(function(e) {\nlet types = defaultTypes;\n- let extraTypes = ['flow', 'global'];\n+ let extraTypes = ['flow', 'global', entityType];\n$help.hide();\nif (defaultTypes.includes('msg')) {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "}\n$.getScript(\"/homeassistant/static/haltif.js\", function() {\n- setupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\", [\n- \"str\",\n- \"num\",\n- \"bool\",\n- \"re\",\n- \"msg\",\n- \"flow\",\n- \"global\"\n- ]);\n+ setupHaltIf(\n+ \"#node-input-halt_if\",\n+ \"#node-input-halt_if_compare\",\n+ \"currentState\"\n+ );\n});\n},\noneditsave: function() {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -85,7 +85,10 @@ module.exports = function(RED) {\nconfig.halt_if,\ncurrentState.state,\nconfig.halt_if_type,\n- message\n+ {\n+ message,\n+ entity: currentState\n+ }\n);\nconst shouldHaltIfState = config.halt_if && isHaltValid;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.js",
"new_path": "nodes/events-state-changed/events-state-changed.js",
"diff": "@@ -106,8 +106,13 @@ module.exports = function(RED) {\nthis.nodeConfig.halt_if_compare,\nthis.nodeConfig.haltIfState,\nevent.new_state.state,\n- this.nodeConfig.halt_if_type\n+ this.nodeConfig.halt_if_type,\n+ {\n+ entity: event.new_state,\n+ prevEntity: event.old_state\n+ }\n);\n+\nconst shouldHaltIfState =\nthis.nodeConfig.haltIfState && isHaltValid;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "{ value: \"starts_with\", text: \"starts with\" },\n{ value: \"in_group\", text: \"in group\" }\n];\n+ const typeEntity = { value: \"entity\", label: \"entity.\" };\nconst defaultTypes = [\n\"str\",\n\"num\",\n\"re\",\n\"msg\",\n\"flow\",\n- \"global\"\n+ \"global\",\n+ typeEntity\n];\nconst $logic = $(\"#logic\");\ncase \"lte\":\ncase \"gt\":\ncase \"gte\":\n- types = [\"num\", \"msg\", \"flow\", \"global\"];\n+ types = [\"num\", \"msg\", \"flow\", \"global\", typeEntity];\nbreak;\ncase \"includes\":\ncase \"does_not_include\":\ncase \"starts_with\":\ncase \"in_group\":\n- types = [\"str\", \"msg\", \"flow\", \"global\"];\n+ types = [\"str\", \"msg\", \"flow\", \"global\", typeEntity];\nbreak;\n}\n$value.typedInput(\"types\", types);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -50,7 +50,10 @@ module.exports = function(RED) {\nrule.value,\nvalue,\nrule.valueType,\n- message\n+ {\n+ message,\n+ entity\n+ }\n);\nif (value === undefined || !result) {\nreturn false;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -134,7 +134,10 @@ module.exports = function(RED) {\nthis.nodeConfig.halt_if_compare,\nthis.nodeConfig.halt_if,\npollState.state,\n- this.nodeConfig.halt_if_type\n+ this.nodeConfig.halt_if_type,\n+ {\n+ entity: pollState\n+ }\n));\nconst msg = {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "$constraints.comparatorValue.typedInput({\ndefault: \"str\",\n- types: [\"str\", \"num\", \"bool\", \"re\"]\n+ types: [\n+ \"str\",\n+ \"num\",\n+ \"bool\",\n+ \"re\",\n+ { value: \"entity\", label: \"entity.\" },\n+ { value: \"prevEntity\", label: \"prev entity.\" }\n+ ]\n});\n$constraints.comparatorValue.typedInput(\"width\", \"233px\");\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.js",
"new_path": "nodes/trigger-state/trigger-state.js",
"diff": "@@ -227,7 +227,11 @@ module.exports = function(RED) {\ncomparatorType,\ncomparatorValue,\nactualValue,\n- comparatorValueDatatype\n+ comparatorValueDatatype,\n+ {\n+ entity: eventMessage.event.new_state,\n+ prevEntity: eventMessage.event.old_state\n+ }\n);\nif (comparatorResult === false) {\n@@ -297,7 +301,11 @@ module.exports = function(RED) {\noutput.comparatorType,\noutput.comparatorValue,\nresult.actualValue,\n- output.comparatorValueDatatype\n+ output.comparatorValueDatatype,\n+ {\n+ entity: eventMessage.event.new_state,\n+ prevEntity: eventMessage.event.old_state\n+ }\n);\n}\nresult.message = this.getOutputMessage(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "$(\"#node-input-checkCurrentState\").prop(\"checked\", false);\n}\n+ const entityType = { value: \"entity\", label: \"entity.\" };\nconst defaultTypes = [\n\"str\",\n\"num\",\n\"re\",\n\"msg\",\n\"flow\",\n- \"global\"\n+ \"global\",\n+ entityType\n];\n$(\"#node-input-value\")\n.typedInput({\ncase \"lte\":\ncase \"gt\":\ncase \"gte\":\n- types = [\"num\", \"msg\", \"flow\", \"global\"];\n+ types = [\"num\", \"msg\", \"flow\", \"global\", entityType];\nbreak;\ncase \"includes\":\ncase \"does_not_include\":\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -46,7 +46,10 @@ module.exports = function(RED) {\nconfig.value,\nthis.utils.selectn(config.property, event.new_state),\nconfig.valueType,\n- this.savedMessage\n+ {\n+ message: this.savedMessage,\n+ entity: event.new_state\n+ }\n);\nif (!result) {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat: Able to reference entity in comparators |
748,234 | 29.03.2019 15:20:36 | 25,200 | a3d6f0f7c6ce911fd2c33fdfb1916be8da47e278 | refactor: Rebranded 'Halt if state' to 'If state' | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "</div>\n<div class=\"form-row\">\n- <label for=\"node-input-halt_if_compare\"><i class=\"fa fa-hand-paper-o\"></i> Halt if State</label>\n+ <label for=\"node-input-halt_if_compare\"><i class=\"fa fa-random\"></i> If State</label>\n<div style=\"width: 70%;display: inline-block;\">\n<select type=\"text\" id=\"node-input-halt_if_compare\" style=\"width: auto;\">\n<option value=\"is\">is</option>\n<dt>Entity ID<span class=\"property-type\">string</span></dt>\n<dd>Match for entity_id field</dd>\n- <dt>Half If<span class=\"property-type\">string</span></dt>\n- <dd>If the new_state === this setting then skip sending</dd>\n+ <dt>If state <span class=\"property-type\">string</span></dt>\n+ <dd>If the logic statement is true send message to second output</dd>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n- <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n+ <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n<dt>State Location<span class=\"property-type\">string</span></dt>\n<dd>Customizable location for the entity’s state. Defaults to <code>msg.payload</code></dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "<div class=\"form-row\">\n- <label for=\"node-input-haltifstate\"><i class=\"fa fa-hand-paper-o\"></i> Halt if State</label>\n+ <label for=\"node-input-haltifstate\"><i class=\"fa fa-random\"></i> If State</label>\n<div style=\"width: 70%;display: inline-block;\">\n<select type=\"text\" id=\"node-input-halt_if_compare\" style=\"width: auto;\">\n<option value=\"is\">is</option>\n<dt>Entity ID<span class=\"property-type\">string|regex</span></dt>\n<dd>matches for entity_id field</dd>\n- <dt>Halt If State<span class=\"property-type\">string</span></dt>\n- <dd>If the new_state === this setting then skip sending</dd>\n+ <dt>If State<span class=\"property-type\">string</span></dt>\n+ <dd>If the logic statement is true send message to second output</dd>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n- <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n+ <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n<dt>Output Initially<span class=\"property-type\">boolean</span></dt>\n<dd>Output once on startup/deploy then on each interval</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "</div>\n<div class=\"form-row\">\n- <label for=\"node-input-halt_if_compare\"><i class=\"fa fa-hand-paper-o\"></i> Halt if State</label>\n+ <label for=\"node-input-halt_if_compare\"><i class=\"fa fa-random\"></i> If State</label>\n<div style=\"width: 70%;display: inline-block;\">\n<select type=\"text\" id=\"node-input-halt_if_compare\" style=\"width: auto;\">\n<option value=\"is\">is</option>\n<dt>Update Interval<span class=\"property-type\">number</span></dt>\n<dd>The amount of time between checking / sending updates</dd>\n- <dt>Half If<span class=\"property-type\">string</span></dt>\n- <dd>If the new state equals this value the message will be sent to the second output</dd>\n+ <dt>If state <span class=\"property-type\">string</span></dt>\n+ <dd>If the logic statement is true send message to second output</dd>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n- <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equial by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n+ <dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n<dt>Output Initially<span class=\"property-type\">boolean</span></dt>\n<dd>Output once on startup/deploy then on each interval</dd>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Rebranded 'Halt if state' to 'If state' |
748,234 | 30.03.2019 19:17:32 | 25,200 | ccf9fbc60c71add734ee97ca46ae7ea39fa0a36e | feat(events-all): Will includes HA client events
Events all node will now receive HA client events: connecting,
connected, disconnected, and error under event_type
home_assistant_client
Closes | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.html",
"new_path": "nodes/events-all/events-all.html",
"diff": "<script type=\"text/javascript\">\n- RED.nodes.registerType('server-events', {\n- category: 'home_assistant',\n- color: '#038FC7',\n+ RED.nodes.registerType(\"server-events\", {\n+ category: \"home_assistant\",\n+ color: \"#038FC7\",\ndefaults: {\n- name: { value: '' },\n- server: { value: '', type: 'server', required: true },\n- event_type: { value: '', required: false },\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ event_type: { value: \"\", required: false }\n},\ninputs: 0,\noutputs: 1,\nicon: \"arrow-right-bold.png\",\n- paletteLabel: 'events: all',\n- label: function () { return this.name || `events: ${this.event_type || 'all'}` },\n+ paletteLabel: \"events: all\",\n+ label: function() {\n+ return this.name || `events: ${this.event_type || \"all\"}`;\n+ },\noneditprepare: function() {\nconst NODE = this;\n- const $server = $('#node-input-server');\n+ const $server = $(\"#node-input-server\");\nconst utils = {\nsetDefaultServerSelection: function() {\nlet defaultServer;\nRED.nodes.eachConfig(n => {\n- if (n.type === 'server' && !defaultServer) defaultServer = n.id;\n+ if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n});\nif (defaultServer) $server.val(defaultServer);\n}\n});\n</script>\n-\n<script type=\"text/x-red\" data-template-name=\"server-events\">\n<div class=\"form-row\">\n<label for=\"node-input-name\"><i class=\"fa fa-tag\"></i> Name</label>\n<script type=\"text/x-red\" data-help-name=\"server-events\">\n<h3>Outputs</h3>\n- <p>The outputted message object contains the following data, underscored values are straight from home assistant</p>\n+ <p>The outputted message object contains the following data, underscored values are straight from home assistant and home assistant client events.</p>\n+\n<dl class=\"message-properties\">\n<dt>topic <span class=\"property-type\">string</span></dt>\n<dd>event_type</dd>\n<dd>filter by event type or leave blank for all events</dd>\n</dl>\n+ <h3>Client Events</h3>\n+ <p>Possible Event Types</p>\n+ <ul>\n+ <li>connecting</li>\n+ <li>connected</li>\n+ <li>disconnected</li>\n+ <li>error</li>\n+ </ul>\n+ Structure\n+ <dl class=\"message-properties\">\n+ <dt>event_type <span class=\"property-type\">string</span></dt>\n+ <dd>home_assistant_client</dd>\n+\n+ <dt>topic <span class=\"property-type\">string</span></dt>\n+ <dd>home_assistant_client:{event_type}</dd>\n+\n+ <dt>payload <span class=\"property-type\">string</span></dt>\n+ <dd>connecting | connected | disconnected | error</dd>\n+\n+ <dt>data <span class=\"property-type optional\">string</span></dt>\n+ <dd>Will contain the error message if event type is type error</dd>\n+ </dl>\n</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.js",
"new_path": "nodes/events-all/events-all.js",
"diff": "@@ -24,6 +24,37 @@ module.exports = function(RED) {\n});\nthis.setStatusSuccess(evt.event_type);\n}\n+\n+ clientEvent(type, data) {\n+ this.send({\n+ event_type: 'home_assistant_client',\n+ topic: `home_assistant_client:${type}`,\n+ payload: type,\n+ data: data\n+ });\n+ }\n+\n+ onHaEventsClose() {\n+ super.onHaEventsClose();\n+ this.clientEvent('disconnected');\n+ }\n+\n+ onHaEventsOpen() {\n+ super.onHaEventsOpen();\n+ this.clientEvent('connected');\n+ }\n+\n+ onHaEventsConnecting() {\n+ super.onHaEventsConnecting();\n+ this.clientEvent('connecting');\n+ }\n+\n+ onHaEventsError(err) {\n+ super.onHaEventsError(err);\n+ if (err) {\n+ this.clientEvent('error', err.message);\n+ }\n+ }\n}\nRED.nodes.registerType('server-events', ServerEventsNode);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(events-all): Will includes HA client events
Events all node will now receive HA client events: connecting,
connected, disconnected, and error under event_type
home_assistant_client
Closes #75 |
748,234 | 30.03.2019 20:35:02 | 25,200 | b8097b861a96a3c49d21618dd231389acaa62cfa | feat(events-all): Added states_loaded and services_loaded
Event:all node will now also receive states_loaded and services_loaded
in the event_type of home_assistant_client | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.html",
"new_path": "nodes/events-all/events-all.html",
"diff": "<li>connected</li>\n<li>disconnected</li>\n<li>error</li>\n+ <li>states_loaded</li>\n+ <li>services_loaded</li>\n</ul>\nStructure\n<dl class=\"message-properties\">\n<dd>home_assistant_client:{event_type}</dd>\n<dt>payload <span class=\"property-type\">string</span></dt>\n- <dd>connecting | connected | disconnected | error</dd>\n+ <dd>connecting | connected | disconnected | error | states_loaded | services_loaded</dd>\n<dt>data <span class=\"property-type optional\">string</span></dt>\n<dd>Will contain the error message if event type is type error</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.js",
"new_path": "nodes/events-all/events-all.js",
"diff": "@@ -14,6 +14,14 @@ module.exports = function(RED) {\nevent: 'ha_events:' + (this.nodeConfig.event_type || 'all'),\nhandler: this.onHaEventsAll.bind(this)\n});\n+ this.addEventClientListener({\n+ event: 'ha_events:states_loaded',\n+ handler: this.onClientStatesLoaded.bind(this)\n+ });\n+ this.addEventClientListener({\n+ event: 'ha_events:services_loaded',\n+ handler: this.onClientServicesLoaded.bind(this)\n+ });\n}\nonHaEventsAll(evt) {\n@@ -34,6 +42,14 @@ module.exports = function(RED) {\n});\n}\n+ onClientStatesLoaded() {\n+ this.clientEvent('states_loaded');\n+ }\n+\n+ onClientServicesLoaded() {\n+ this.clientEvent('services_loaded');\n+ }\n+\nonHaEventsClose() {\nsuper.onHaEventsClose();\nthis.clientEvent('disconnected');\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(events-all): Added states_loaded and services_loaded
Event:all node will now also receive states_loaded and services_loaded
in the event_type of home_assistant_client |
748,234 | 30.03.2019 21:32:41 | 25,200 | d6deccb0ae3b687a87d1f2bd5f020fba6baa428a | refactor(events-all): Added status message for loaded events | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.js",
"new_path": "nodes/events-all/events-all.js",
"diff": "@@ -40,6 +40,10 @@ module.exports = function(RED) {\npayload: type,\ndata: data\n});\n+\n+ if (type === 'states_loaded' || type === 'services_loaded') {\n+ this.setStatusSuccess(type);\n+ }\n}\nonClientStatesLoaded() {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(events-all): Added status message for loaded events |
748,234 | 30.03.2019 22:08:51 | 25,200 | 3fdfa27f2015a2510d76db18341442c40540aafc | fix(wait-until): fixed scope for setContextValue | [
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -126,7 +126,7 @@ module.exports = function(RED) {\nstate.timeSinceChangedMs =\nDate.now() - new Date(state.last_changed).getTime();\n- this.setContextValue(\n+ node.setContextValue(\nstate,\nconfig.entityLocationType,\nconfig.entityLocation,\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(wait-until): fixed scope for setContextValue |
748,234 | 02.04.2019 17:11:49 | 25,200 | 9305c7d33f039ada2e3ff14dcb8fd5f2a8aa5d28 | feat(api): Output type added to http api: binary, json,txt | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-http.js",
"new_path": "lib/ha-http.js",
"diff": "@@ -111,12 +111,14 @@ class HaHttp {\n}\nrenderTemplate(templateString) {\n- return this._post('template', { template: templateString });\n+ return this._post('template', { template: templateString }, 'text');\n}\n- _post(path, data = {}) {\n+ _post(path, data = {}, responseType = 'json') {\ndebug(`POST: ${this.config.baseUrl}/${path}`);\n+ this.client.defaults.responseType = responseType;\n+\nreturn this.client\n.post(path, data)\n.then(res => res.data || '')\n@@ -126,9 +128,11 @@ class HaHttp {\n});\n}\n- _get(path, params = {}) {\n+ _get(path, params = {}, responseType = 'json') {\ndebug(`GET: ${this.config.baseUrl}/${path}`);\n+ this.client.defaults.responseType = responseType;\n+\nreturn this.client\n.request({ url: path, params: params })\n.then(res => res.data || '')\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.html",
"new_path": "nodes/api/api.html",
"diff": "path: { value: \"\" },\ndata: { value: \"\" },\nlocation: { value: \"payload\" },\n- locationType: { value: \"msg\" }\n+ locationType: { value: \"msg\" },\n+ responseType: { value: \"json\" }\n},\noneditprepare: function() {\nconst node = this;\n<input type=\"text\" id=\"node-input-location\">\n<input type=\"hidden\" id=\"node-input-locationType\">\n</div>\n+\n+ <div class=\"form-row http\">\n+ <label for=\"node-input-responseType\">Return</label>\n+ <select id=\"node-input-responseType\" style=\"width:70%;\">\n+ <option value=\"text\">a UTF-8 string</option>\n+ <option value=\"arraybuffer\">a binary buffer</option>\n+ <option value=\"json\">a parsed JSON object</option>\n+ </select>\n+ </div>\n</script>\n<script type=\"text/x-red\" data-help-name=\"ha-api\">\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -12,7 +12,8 @@ module.exports = function(RED) {\npath: {},\ndata: {},\nlocation: {},\n- locationType: {}\n+ locationType: {},\n+ responseType: {}\n},\ninput: {\nprotocol: {\n@@ -69,6 +70,16 @@ module.exports = function(RED) {\n.valid('msg', 'flow', 'global', 'none')\n.label('locationType')\n}\n+ },\n+ responseType: {\n+ messageProp: 'payload.responseType',\n+ configProp: 'responseType',\n+ default: 'json',\n+ validation: {\n+ schema: Joi.string()\n+ .valid('json', 'text', 'arraybuffer')\n+ .label('responseType')\n+ }\n}\n}\n};\n@@ -120,7 +131,8 @@ module.exports = function(RED) {\napiCall = config.server.http[`_${method}`].bind(\nconfig.server.http,\npath,\n- data\n+ data,\n+ parsedMessage.responseType.value\n);\n} else {\ntry {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(api): Output type added to http api: binary, json,txt |
748,234 | 02.04.2019 17:50:57 | 25,200 | 3a0d8b0bb70cebaaf3583aff5bcf1980770df2be | fix(call-service): Fix for having undefined output location and type | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -111,8 +111,8 @@ module.exports = function(RED) {\nthis.setContextValue(\nmsgPayload,\n- config.output_location_type,\n- config.output_location,\n+ config.output_location_type || 'msg',\n+ config.output_location || 'payload',\nmessage\n);\nthis.send(message);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(call-service): Fix for having undefined output location and type |
748,234 | 03.04.2019 20:00:54 | 25,200 | b8cf46ef6cf029cdc0f50b2fe4f0c51fa3607fc3 | build: Updated dep | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "},\n\"devDependencies\": {\n\"coveralls\": \"^3.0.3\",\n- \"eslint\": \"^5.15.3\",\n+ \"eslint\": \"^5.16.0\",\n\"eslint-config-prettier\": \"^4.1.0\",\n\"eslint-config-standard\": \"^12.0.0\",\n\"eslint-plugin-import\": \"^2.16.0\",\n\"eslint-plugin-node\": \"^8.0.1\",\n\"eslint-plugin-prettier\": \"^3.0.1\",\n- \"eslint-plugin-promise\": \"^4.0.1\",\n+ \"eslint-plugin-promise\": \"^4.1.1\",\n\"eslint-plugin-standard\": \"^4.0.0\",\n\"husky\": \"^1.3.1\",\n\"istanbul\": \"^1.1.0-alpha.1\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | build: Updated dep |
748,234 | 03.04.2019 20:09:47 | 25,200 | 5380869d12de389cfff577c841729cafb15de9d5 | build: fixed package-lock | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n\"dev\": true\n},\n\"eslint\": {\n- \"version\": \"5.15.3\",\n- \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.15.3.tgz\",\n- \"integrity\": \"sha512-vMGi0PjCHSokZxE0NLp2VneGw5sio7SSiDNgIUn2tC0XkWJRNOIoHIg3CliLVfXnJsiHxGAYrkw0PieAu8+KYQ==\",\n+ \"version\": \"5.16.0\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz\",\n+ \"integrity\": \"sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==\",\n\"dev\": true,\n\"requires\": {\n\"@babel/code-frame\": \"^7.0.0\",\n\"import-fresh\": \"^3.0.0\",\n\"imurmurhash\": \"^0.1.4\",\n\"inquirer\": \"^6.2.2\",\n- \"js-yaml\": \"^3.12.0\",\n+ \"js-yaml\": \"^3.13.0\",\n\"json-stable-stringify-without-jsonify\": \"^1.0.1\",\n\"levn\": \"^0.3.0\",\n\"lodash\": \"^4.17.11\",\n}\n},\n\"eslint-plugin-promise\": {\n- \"version\": \"4.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz\",\n- \"integrity\": \"sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==\",\n+ \"version\": \"4.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz\",\n+ \"integrity\": \"sha512-faAHw7uzlNPy7b45J1guyjazw28M+7gJokKUjC5JSFoYfUEyy6Gw/i7YQvmv2Yk00sUjWcmzXQLpU1Ki/C2IZQ==\",\n\"dev\": true\n},\n\"eslint-plugin-standard\": {\n},\n\"globby\": {\n\"version\": \"6.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/globby/-/globby-6.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/globby/-/globby-6.1.0.tgz\",\n\"integrity\": \"sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=\",\n\"dev\": true,\n\"requires\": {\n},\n\"chalk\": {\n\"version\": \"1.1.3\",\n- \"resolved\": \"https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz\",\n\"integrity\": \"sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=\",\n\"dev\": true,\n\"requires\": {\n},\n\"strip-ansi\": {\n\"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz\",\n\"integrity\": \"sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=\",\n\"dev\": true,\n\"requires\": {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | build: fixed package-lock |
748,234 | 06.04.2019 16:53:08 | 25,200 | 67857b5bc3d05e1c5aa91f7bc86f24d5c34128bf | fix(events-all): only send home_assistant_client events when needed | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.js",
"new_path": "nodes/events-all/events-all.js",
"diff": "@@ -14,6 +14,10 @@ module.exports = function(RED) {\nevent: 'ha_events:' + (this.nodeConfig.event_type || 'all'),\nhandler: this.onHaEventsAll.bind(this)\n});\n+ if (\n+ !this.nodeConfig.event_type ||\n+ this.nodeConfig.event_type === 'home_assistant_client'\n+ ) {\nthis.addEventClientListener({\nevent: 'ha_events:states_loaded',\nhandler: this.onClientStatesLoaded.bind(this)\n@@ -23,6 +27,7 @@ module.exports = function(RED) {\nhandler: this.onClientServicesLoaded.bind(this)\n});\n}\n+ }\nonHaEventsAll(evt) {\nthis.send({\n@@ -34,6 +39,10 @@ module.exports = function(RED) {\n}\nclientEvent(type, data) {\n+ if (\n+ !this.nodeConfig.event_type ||\n+ this.nodeConfig.event_type === 'home_assistant_client'\n+ ) {\nthis.send({\nevent_type: 'home_assistant_client',\ntopic: `home_assistant_client:${type}`,\n@@ -45,6 +54,7 @@ module.exports = function(RED) {\nthis.setStatusSuccess(type);\n}\n}\n+ }\nonClientStatesLoaded() {\nthis.clientEvent('states_loaded');\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(events-all): only send home_assistant_client events when needed |
748,234 | 06.04.2019 17:04:47 | 25,200 | 9af48070a0177711763bfc5fed4dde65547a2059 | fix(ha-websocket): Reset states/servicesLoaded on disconnect | [
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -173,6 +173,9 @@ class HaWebsocket extends EventEmitter {\nthis.emit('ha_events:error', err);\n}\n+ this.servicesLoaded = false;\n+ this.statesLoaded = false;\n+\nif (this.client && this.client.readyState === this.client.CLOSED) {\nthis.connectionState = HaWebsocket.DISCONNECTED;\nthis.emit('ha_events:close');\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "<div class=\"form-row\">\n<input type=\"checkbox\" id=\"node-input-outputinitially\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\">\n- <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output Initially / On Deploy</label>\n+ <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output on Connect</label>\n</div>\n</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "<div class=\"form-row\">\n<input type=\"checkbox\" id=\"node-input-outputinitially\" style=\"display: inline-block; width: auto; vertical-align: top;margin-left: 105px;\">\n- <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output Initially / On Deploy</label>\n+ <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output on Connect</label>\n</div>\n</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "<div class=\"form-row\">\n<input type=\"checkbox\" id=\"node-input-outputinitially\" style=\"display: inline-block; width: auto; vertical-align: top;\">\n- <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output Initially / On Deploy</label>\n+ <label for=\"node-input-outputinitially\" style=\"width: auto;\">Output on Connect</label>\n</div>\n<div class=\"form-row\">\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(ha-websocket): Reset states/servicesLoaded on disconnect |
748,234 | 24.04.2019 20:03:44 | 25,200 | 200641901711aaa3b8191cf2c52103046ce4a528 | docs: Updated Contributing guide | [
{
"change_type": "MODIFY",
"old_path": "CONTRIBUTING.md",
"new_path": "CONTRIBUTING.md",
"diff": "@@ -6,7 +6,7 @@ Following these guidelines helps to communicate that you respect the time of the\n## Using the issue tracker\n-The issue tracker is the preferred channel for [bug reports](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests). Currently [support issues](#support-issues) are acceptable in the issue tracker as well although this may change in the future to cut down on the noise.\n+The issue tracker is the preferred channel for [bug reports](#bug-reports), [features requests](#features-requets) and [submitting pull requests](#pull-requests). Currently [support issues](#support-issues) are acceptable in the issue tracker as well although this may change in the future to cut down on the noise.\n## Bug reports\n@@ -15,7 +15,7 @@ A bug is a _demonstrable problem_ that is caused by the code in the repository.\nGuidelines for bug reports:\n1. **Use the GitHub issue search** — check if the issue has already been reported.\n-2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` branch in the repository.\n+2. **Check if the issue has been fixed** — try to reproduce it using the latest `dev` branch in the repository.\n3. **Isolate the problem** — ideally create a reduced test case, an example flow in node-red that you can add to the issue is preferred.\nA good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What OS experiences the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs. Fill out all the information you can when presented with the Bug Issue template.\n@@ -48,8 +48,8 @@ If you never created a pull request before, welcome :tada: :smile: [Here is a gr\n2. If you cloned a while ago, get the latest changes from upstream:\n```bash\n- git checkout master\n- git pull upstream master\n+ git checkout dev\n+ git pull upstream dev\n```\n3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | docs: Updated Contributing guide |
748,234 | 24.04.2019 20:05:44 | 25,200 | 1b54c94d895d50f0aa517fe52de2e4b9ba2b6be6 | refactor(mustache-context): changed states.* to entity.* from templates | [
{
"change_type": "MODIFY",
"old_path": "lib/mustache-context.js",
"new_path": "lib/mustache-context.js",
"diff": "@@ -53,7 +53,8 @@ NodeContext.prototype.lookup = function(name) {\n}\n// try state entities\n- const match = /^states\\.(\\w+\\.\\w+)(?:\\.(.+))?/.exec(name);\n+ // version 0.10.3 changed from states.domain.entity to entity.d.e\n+ const match = /^[states|entity]\\.(\\w+\\.\\w+)(?:\\.(.+))?/.exec(name);\nif (match) {\nconst gHomeAssistant = this.nodeContext.global.get('homeassistant');\nconst states = gHomeAssistant[this.serverName].states;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(mustache-context): changed states.* to entity.* from templates |
748,234 | 24.04.2019 20:08:57 | 25,200 | 49b9c26ca4669b06ea30f271e1eaee415795d323 | fix(base-node): fix for using in/not in with context of msg/flow | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -305,12 +305,6 @@ class BaseNode {\ncomparatorValueDatatype,\n{ message, entity, prevEntity }\n) {\n- if (\n- comparatorType === 'includes' ||\n- comparatorType === 'does_not_include'\n- ) {\n- comparatorValueDatatype = 'list';\n- }\nif (comparatorValueDatatype === 'bool') {\ncomparatorValue = comparatorValue === 'true';\n}\n@@ -328,6 +322,13 @@ class BaseNode {\ncomparatorValueDatatype === 'entity' ? entity : prevEntity\n);\n} else {\n+ if (\n+ comparatorType === 'includes' ||\n+ comparatorType === 'does_not_include'\n+ ) {\n+ comparatorValueDatatype = 'list';\n+ }\n+\ncValue = this.getCastValue(\ncomparatorValueDatatype,\ncomparatorValue\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(base-node): fix for using in/not in with context of msg/flow |
748,234 | 24.04.2019 20:10:11 | 25,200 | d2c79297c060bce66b682698f2d0eb85768fe9cb | fix: show msg for current state not and not others | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/haltif.js",
"new_path": "nodes/_static/haltif.js",
"diff": "@@ -32,7 +32,7 @@ window.setupHaltIf = function(input, compare, nodeName) {\nentityType\n];\n- if (nodeName === 'currentState') {\n+ if (nodeName !== 'currentState') {\ndefaultTypes.splice(4, 1);\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: show msg for current state not and not others |
748,234 | 24.04.2019 20:11:03 | 25,200 | b8adf622a5e3a8d7c6c8f776fd56df348d7758ab | docs(call-service): Docs about states to entity change | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "</dl>\n<h3>Templates</h3>\n- <p>You can use templates in the <code>Domain</code>, <code>Service</code>, <code>Entity Id</code>, and <code>data</code> fields. When using templates the top level is a property of the message object: <code>msg.payload</code> would be <code>{{payload}}</code>. You can also access the <code>flow, global and states</code> contexts <code>{{flow.foobar}}</code> <code>{{global.something}}</code>. For the <code>states</code> context you can use the <code>{{states.domain.entity_id}}</code> to just get the state or drill further down like <code>{{states.light.kitchen.attributes.friendly_name}}</code>. <code>{{states.light.kitchen}}</code> and <code>{{states.light.kitchen.state}}</code> are equivalent.</p>\n+ <p>You can use templates in the <code>Domain</code>, <code>Service</code>, <code>Entity Id</code>, and <code>data</code> fields. When using templates the top level is a property of the message object: <code>msg.payload</code> would be <code>{{payload}}</code>. You can also access the <code>flow, global and states</code> contexts <code>{{flow.foobar}}</code> <code>{{global.something}}</code>. For the <code>states</code> context you can use the <code>{{entity.domain.entity_id}}</code> to just get the state or drill further down like <code>{{entity.light.kitchen.attributes.friendly_name}}</code>. <code>{{entity.light.kitchen}}</code> and <code>{{entity.light.kitchen.state}}</code> are equivalent.</p>\n<h3>Details</h3>\n<p>If the incoming message has a <code>payload</code> property with <code>domain</code>, <code>service</code> set it will override any config values if set.</p>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | docs(call-service): Docs about states to entity change |
748,234 | 30.04.2019 22:40:02 | 25,200 | 9217e0953119077c0d046b5ad91e4da03dd92b36 | feat(current-state): able to override config entity id from payload
This might be a small breaking change if your current-state node if
receiving a payload with entity_id set
Closes | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- outputLabels: [\"\", \"halt if\"],\n+ outputLabels: [\"\", \"if state\"],\nicon: \"code.png\",\npaletteLabel: \"current state\",\nlabel: function() {\n<dd>Match for entity_id field</dd>\n<dt>If state <span class=\"property-type\">string</span></dt>\n- <dd>If the logic statement is true send message to second output</dd>\n+ <dd>If the logic statement is true send message to only the second output</dd>\n<dt>State Type<span class=\"property-type\">string</span></dt>\n<dd>Convert the state of the entity to the selected type. Boolean will be convert to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -21,10 +21,10 @@ module.exports = function(RED) {\ninput: {\nentity_id: {\nmessageProp: 'payload.entity_id',\n- configProp: 'entity_id', // Will be used if value not found on message,\n+ configProp: 'entity_id',\nvalidation: {\nhaltOnFail: true,\n- schema: Joi.string() // Validates on message if exists, Joi will also attempt coercion\n+ schema: Joi.string().label('entity_id')\n}\n}\n}\n@@ -38,64 +38,45 @@ module.exports = function(RED) {\n/* eslint-disable camelcase */\nasync onInput({ parsedMessage, message }) {\nconst config = this.nodeConfig;\n- const entityId = config.entity_id\n- ? config.entity_id\n- : parsedMessage.entity_id.value;\n- const logAndContinueEmpty = logMsg => {\n- this.node.warn(logMsg);\n- return { payload: {} };\n- };\n+ const entityId = parsedMessage.entity_id.value;\nif (config.server === null) {\nthis.node.error('No valid server selected.');\n- return null;\n+ return;\n}\n- if (!entityId)\n- return logAndContinueEmpty(\n- 'entity ID not set, cannot get current state, sending empty payload'\n- );\n-\n- const currentState = this.utils.merge(\n+ const entity = this.utils.merge(\n{},\nawait config.server.homeAssistant.getStates(entityId)\n);\n- if (!currentState.entity_id)\n- return logAndContinueEmpty(\n- `entity could not be found in cache for entity_id: ${entityId}, sending empty payload`\n+\n+ if (!entity.entity_id) {\n+ this.node.error(\n+ `entity could not be found in cache for entity_id: ${entityId}`\n);\n+ return;\n+ }\n- currentState.timeSinceChangedMs =\n- Date.now() - new Date(currentState.last_changed).getTime();\n+ entity.timeSinceChangedMs =\n+ Date.now() - new Date(entity.last_changed).getTime();\n// Convert and save original state if needed\nif (config.state_type && config.state_type !== 'str') {\n- currentState.original_state = currentState.state;\n- currentState.state = this.getCastValue(\n+ entity.original_state = entity.state;\n+ entity.state = this.getCastValue(\nconfig.state_type,\n- currentState.state\n+ entity.state\n);\n}\nconfig.halt_if_compare = config.halt_if_compare || 'is';\nconfig.halt_if_type = config.halt_if_type || 'str';\n- const isHaltValid = await this.getComparatorResult(\n- config.halt_if_compare,\n- config.halt_if,\n- currentState.state,\n- config.halt_if_type,\n- {\n- message,\n- entity: currentState\n- }\n- );\n- const shouldHaltIfState = config.halt_if && isHaltValid;\n-\n- // default switch to true if undefined (backward compatibility\n- const override_topic = config.override_topic !== false;\n- if (override_topic) message.topic = entityId;\n+ // default switch to true if undefined (backward compatibility)\n+ message.topic =\n+ config.override_topic !== false ? entityId : message.topic;\n+ // Set Defaults\nif (config.state_location === undefined) {\nconfig.state_location = 'payload';\nconfig.override_payload =\n@@ -107,29 +88,39 @@ module.exports = function(RED) {\nconfig.override_data !== false ? 'msg' : 'none';\n}\n+ // Set 'State Location'\nthis.setContextValue(\n- currentState.state,\n+ entity.state,\nconfig.override_payload,\nconfig.state_location,\nmessage\n);\n+ // Set 'Entity Location'\nthis.setContextValue(\n- currentState,\n+ entity,\nconfig.override_data,\nconfig.entity_location,\nmessage\n);\n- if (shouldHaltIfState) {\n- const debugMsg = `Get current state: halting processing due to current state of ${entityId} matches \"halt if state\" option`;\n- this.debug(debugMsg);\n- this.debugToClient(debugMsg);\n- this.setStatusFailed(currentState.state);\n- this.node.send([null, message]);\n+ const isHaltValid = await this.getComparatorResult(\n+ config.halt_if_compare,\n+ config.halt_if,\n+ entity.state,\n+ config.halt_if_type,\n+ {\n+ message,\n+ entity\n+ }\n+ );\n+\n+ if (config.halt_if && isHaltValid) {\n+ this.setStatusFailed(entity.state);\n+ this.send([null, message]);\n} else {\n- this.setStatusSuccess(currentState.state);\n- this.node.send([message, null]);\n+ this.setStatusSuccess(entity.state);\n+ this.send([message, null]);\n}\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(current-state): able to override config entity id from payload
This might be a small breaking change if your current-state node if
receiving a payload with entity_id set
Closes #115 |
748,234 | 01.05.2019 16:21:20 | 25,200 | beb556a2270fdf8d187b38f5a05ebecefa3cd94b | fix: use relative path for haltif.js for hassio ingress | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n- $.getScript(\"/homeassistant/static/haltif.js\", function() {\n+ $.getScript(\"homeassistant/static/haltif.js\", function() {\nsetupHaltIf(\n\"#node-input-halt_if\",\n\"#node-input-halt_if_compare\",\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n- $.getScript(\"/homeassistant/static/haltif.js\", function() {\n+ $.getScript(\"homeassistant/static/haltif.js\", function() {\nsetupHaltIf(\"#node-input-haltifstate\", \"#node-input-halt_if_compare\");\n});\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "$(\"#node-input-updateIntervalUnits\").val(\"seconds\");\n}\n- $.getScript(\"/homeassistant/static/haltif.js\", function() {\n+ $.getScript(\"homeassistant/static/haltif.js\", function() {\nsetupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\");\n});\n},\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: use relative path for haltif.js for hassio ingress |
748,234 | 04.05.2019 12:04:53 | 25,200 | 4b098111885264a47a467cef3620f7481308d545 | fix(mustache-context): Fix for using both states/entity for templates | [
{
"change_type": "MODIFY",
"old_path": "lib/mustache-context.js",
"new_path": "lib/mustache-context.js",
"diff": "@@ -54,7 +54,7 @@ NodeContext.prototype.lookup = function(name) {\n// try state entities\n// version 0.10.3 changed from states.domain.entity to entity.d.e\n- const match = /^[states|entity]\\.(\\w+\\.\\w+)(?:\\.(.+))?/.exec(name);\n+ const match = /^(?:states|entity)\\.(\\w+\\.\\w+)(?:\\.(.+))?/.exec(name);\nif (match) {\nconst gHomeAssistant = this.nodeContext.global.get('homeassistant');\nconst states = gHomeAssistant[this.serverName].states;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(mustache-context): Fix for using both states/entity for templates |
748,234 | 14.05.2019 03:33:57 | 25,200 | a193360beaa544e0b09b2ec8c87dc6d24ad1c203 | refactor: Changed the loading of ifState.js
Moved ifState.js to load via the script tag and moved common.js and
ifState.js to use revealing module pattern | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.css",
"new_path": "nodes/_static/common.css",
"diff": "#versionUpdate strong {\npadding-right: 5px;\n}\n+\n+#errorIfState {\n+ text-align: center;\n+ padding: 5px;\n+ margin-top: 5px;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.js",
"new_path": "nodes/_static/common.js",
"diff": "-function wikiNodeLink(type) {\n+// eslint-disable-next-line no-unused-vars\n+var nodeVersion = (function($) {\n+ function wikiLink(type) {\nlet name = '';\nswitch (type) {\n@@ -16,11 +18,11 @@ function wikiNodeLink(type) {\n}\n// eslint-disable-next-line no-unused-vars\n-function versionCheck(node) {\n+ function check(node) {\nnode.version = node.version === undefined ? 0 : Number(node.version);\nconst versionAlert = `<div id=\"versionUpdate\" class=\"ui-state-error\"><p><strong>Alert:</strong>This node will be updated to version ${\nnode._def.defaults.version.value\n- } from ${node.version} (<a href=\"${wikiNodeLink(\n+ } from ${node.version} (<a href=\"${wikiLink(\nnode.type\n)}#version\" target=\"_blank\" rel=\"noreferrer\">changes</a>)</p></div>`;\n@@ -31,9 +33,16 @@ function versionCheck(node) {\n}\n// eslint-disable-next-line no-unused-vars\n-function updateNodeVersion(node) {\n+ function update(node) {\nif (node.version < node._def.defaults.version.value) {\n// eslint-disable-next-line no-undef\n$('#node-input-version').val(node._def.defaults.version.value);\n}\n}\n+\n+ return {\n+ check,\n+ update\n+ };\n+ // eslint-disable-next-line no-undef\n+})(jQuery);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/ifstate.js",
"new_path": "nodes/_static/ifstate.js",
"diff": "-const $ = window.jQuery;\n+// eslint-disable-next-line no-unused-vars\n+var ifState = (function($) {\n+ let $input;\n+\n+ const resize = function() {\n+ const $clearIfState = $('#clearIfState');\n+\n+ if (!$input.hasClass('red-ui-typedInput')) return;\n-const resizeHaltIf = function(input) {\n- const $clearHaltIf = $('#clearHaltIf');\nlet width =\n- input.parent('div').width() -\n+ $input.parent('div').width() -\n$('#node-input-halt_if_compare').width() -\n20.5;\n- if ($clearHaltIf.is(':visible')) {\n- width = width - $clearHaltIf.outerWidth(true) - 4;\n+ if ($clearIfState.is(':visible')) {\n+ width = width - $clearIfState.outerWidth(true) - 4;\n}\n- input.typedInput('width', width);\n+ $input.typedInput('width', width);\n};\n-window.resizeHaltIf = resizeHaltIf;\n+ const init = function(input, compare, nodeName) {\n+ $('#errorIfState').remove();\n-window.setupHaltIf = function(input, compare, nodeName) {\n- const $input = $(input);\n+ $input = $(input);\nconst $compare = $(compare);\n- const $help = $('#halt_if_help');\nconst entityType = { value: 'entity', label: 'entity.' };\nlet defaultTypes = [\n'str',\n@@ -37,9 +41,9 @@ window.setupHaltIf = function(input, compare, nodeName) {\n}\n$input.after(\n- ' <a id=\"clearHaltIf\" class=\"editor-button\"><i class=\"fa fa-remove\"></i></a>'\n+ ' <a id=\"clearIfState\" class=\"editor-button\"><i class=\"fa fa-remove\"></i></a>'\n);\n- const $clearHaltIf = $('#clearHaltIf');\n+ const $clearIfState = $('#clearIfState');\n$input.typedInput({\ndefault: 'str',\n@@ -50,7 +54,6 @@ window.setupHaltIf = function(input, compare, nodeName) {\n$compare.change(function(e) {\nlet types = defaultTypes;\nlet extraTypes = ['flow', 'global', entityType];\n- $help.hide();\nif (defaultTypes.includes('msg')) {\nextraTypes = ['msg'].concat(extraTypes);\n@@ -68,7 +71,6 @@ window.setupHaltIf = function(input, compare, nodeName) {\nbreak;\ncase 'includes':\ncase 'does_not_include':\n- $help.show();\ntypes = ['str'].concat(extraTypes);\nbreak;\n}\n@@ -79,21 +81,29 @@ window.setupHaltIf = function(input, compare, nodeName) {\n$input.on('change', function(e) {\nif (e.currentTarget.value) {\n- $clearHaltIf.show();\n- resizeHaltIf($input);\n+ $clearIfState.show();\n+ resize($input);\n}\n});\n- $clearHaltIf.on('click', function() {\n+ $clearIfState.on('click', function() {\n$input.typedInput('type', 'str');\n$input.typedInput('value', '');\n$(this).hide();\n- resizeHaltIf($input);\n+ resize($input);\n});\nif (!$input.val()) {\n- $clearHaltIf.hide();\n- resizeHaltIf($input);\n+ $clearIfState.hide();\n+ resize($input);\n}\n- resizeHaltIf($input);\n+ resize($input);\n};\n+\n+ return {\n+ init,\n+ resize\n+ };\n+\n+ // eslint-disable-next-line no-undef\n+})(jQuery);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n<script src=\"homeassistant/static/common.js\"></script>\n+<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"api-current-state\", {\ncategory: \"home_assistant\",\noverride_data: { value: \"msg\" } // entity location types\n},\noneditprepare: function() {\n- versionCheck(this);\n+ nodeVersion.check(this);\nconst $entityIdField = $(\"#entity_id\");\nconst $stateLocation = $(\"#node-input-state_location\");\n$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n- $.getScript(\"homeassistant/static/ifstate.js\", function() {\n- setupHaltIf(\n+ ifState.init(\n\"#node-input-halt_if\",\n\"#node-input-halt_if_compare\",\n\"currentState\"\n);\n- });\n},\noneditsave: function() {\nthis.entity_id = $(\"#entity_id\").val();\noutputs = JSON.stringify({ 0: 1, 1: 0 });\n}\n$(\"#node-input-outputs\").val(outputs);\n- updateNodeVersion(this);\n+ nodeVersion.update(this);\n},\noneditresize: function() {\n- $halt_if = $(\"#node-input-halt_if\");\n- if ($halt_if.hasClass(\"red-ui-typedInput\")) {\n- resizeHaltIf($halt_if);\n- }\n+ ifState.resize();\n}\n});\n</script>\n<input type=\"text\" id=\"node-input-halt_if\" />\n</div>\n<input type=\"hidden\" id=\"node-input-halt_if_type\" />\n+ <p id=\"errorIfState\" class=\"ui-state-error\">ifState.js not loaded</p>\n</div>\n- <span id=\"halt_if_help\" style=\"inline-block;margin-left: 210px;\">^ Comma delimited string</span>\n<div class=\"form-row\">\n<label for=\"node-input-state_type\"><i class=\"fa fa-tint\"></i> State Type</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n<script src=\"homeassistant/static/common.js\"></script>\n+<script src=\"homeassistant/static/ifState.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"server-state-changed\", {\ncategory: \"home_assistant\",\n);\n},\noneditprepare: function() {\n- versionCheck(this);\n+ nodeVersion.check(this);\nconst $entityidfilter = $(\"#node-input-entityidfilter\");\nconst $entityidfiltertype = $(\"#node-input-entityidfiltertype\");\n$(\"#node-input-halt_if_compare\").val(\"is\");\n}\n- $.getScript(\"homeassistant/static/ifstate.js\", function() {\n- setupHaltIf(\"#node-input-haltifstate\", \"#node-input-halt_if_compare\");\n- });\n+ ifState.init(\"#node-input-haltifstate\", \"#node-input-halt_if_compare\");\n},\noneditsave: function() {\nthis.entityidfilter = $(\"#node-input-entityidfilter\").val();\noutputs = JSON.stringify({ 0: 1, 1: 0 });\n}\n$(\"#node-input-outputs\").val(outputs);\n- updateNodeVersion(this);\n+ nodeVersion.update(this);\n},\noneditresize: function() {\n- $halt_if = $(\"#node-input-haltifstate\");\n- if ($halt_if.hasClass(\"red-ui-typedInput\")) {\n- resizeHaltIf($halt_if);\n- }\n+ ifState.resize();\n}\n});\n</script>\n<input type=\"text\" id=\"node-input-haltifstate\" />\n</div>\n<input type=\"hidden\" id=\"node-input-halt_if_type\" />\n+ <p id=\"errorIfState\" class=\"ui-state-error\">ifState.js not loaded</p>\n</div>\n- <span id=\"halt_if_help\" style=\"inline-block;margin-left: 210px;\">^ Comma delimited string</span>\n+\n<div class=\"form-row\">\n<label for=\"node-input-state_type\"><i class=\"fa fa-tint\"></i> State Type</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n<script src=\"homeassistant/static/common.js\"></script>\n+<script src=\"homeassistant/static/ifState.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"poll-state\", {\ncategory: \"home_assistant\",\n}\n},\noneditprepare: function() {\n- versionCheck(this);\n+ nodeVersion.check(this);\nconst $entityIdField = $(\"#entity_id\");\n$entityIdField.val(this.entity_id);\n$(\"#node-input-updateIntervalUnits\").val(\"seconds\");\n}\n- $.getScript(\"homeassistant/static/ifstate.js\", function() {\n- setupHaltIf(\"#node-input-halt_if\", \"#node-input-halt_if_compare\");\n- });\n+ ifState.init(\"#node-input-halt_if\", \"#node-input-halt_if_compare\");\n},\noneditsave: function() {\nthis.entity_id = $(\"#entity_id\")\noutputs = JSON.stringify({ 0: 1, 1: 0 });\n}\n$(\"#node-input-outputs\").val(outputs);\n- updateNodeVersion(this);\n+ nodeVersion.update(this);\n},\noneditresize: function() {\n- $halt_if = $(\"#node-input-halt_if\");\n- if ($halt_if.hasClass(\"red-ui-typedInput\")) {\n- resizeHaltIf($halt_if);\n- }\n+ ifState.resize();\n}\n});\n</script>\n<input type=\"text\" id=\"node-input-halt_if\" />\n</div>\n<input type=\"hidden\" id=\"node-input-halt_if_type\" />\n+ <p id=\"errorIfState\" class=\"ui-state-error\">ifState.js not loaded</p>\n</div>\n- <span id=\"halt_if_help\" style=\"inline-block;margin-left: 210px;\">^ Comma delimited string</span>\n<div class=\"form-row\">\n<label for=\"node-input-state_type\"><i class=\"fa fa-tint\"></i> State Type</label>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Changed the loading of ifState.js
Moved ifState.js to load via the script tag and moved common.js and
ifState.js to use revealing module pattern |
748,234 | 15.05.2019 21:24:03 | 25,200 | e032289cd5c99ff19080a5e167787989ff2b990d | refactor: lower case filenames | [
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n<script src=\"homeassistant/static/common.js\"></script>\n-<script src=\"homeassistant/static/ifState.js\"></script>\n+<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"server-state-changed\", {\ncategory: \"home_assistant\",\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n<script src=\"homeassistant/static/common.js\"></script>\n-<script src=\"homeassistant/static/ifState.js\"></script>\n+<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"poll-state\", {\ncategory: \"home_assistant\",\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: lower case filenames |
748,234 | 18.05.2019 00:31:14 | 25,200 | c8b2e0973d137a53e343435158fddd5855875a1e | fix: Update autocomplete on server change in ui
Moved server and autocomplete logic to common.js. Fixed issue when
changes the server in the UI it wouldn't update the autocomplete
entities. | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.js",
"new_path": "nodes/_static/common.js",
"diff": "@@ -17,7 +17,6 @@ var nodeVersion = (function($) {\nreturn `https://github.com/zachowj/node-red-contrib-home-assistant-websocket/wiki/${name}`;\n}\n- // eslint-disable-next-line no-unused-vars\nfunction check(node) {\nnode.version = node.version === undefined ? 0 : Number(node.version);\nconst versionAlert = `<div id=\"versionUpdate\" class=\"ui-state-error\"><p><strong>Alert:</strong>This node will be updated to version ${\n@@ -27,15 +26,12 @@ var nodeVersion = (function($) {\n)}#version\" target=\"_blank\" rel=\"noreferrer\">changes</a>)</p></div>`;\nif (node.version < node._def.defaults.version.value) {\n- // eslint-disable-next-line no-undef\n$('#dialog-form').prepend(versionAlert);\n}\n}\n- // eslint-disable-next-line no-unused-vars\nfunction update(node) {\nif (node.version < node._def.defaults.version.value) {\n- // eslint-disable-next-line no-undef\n$('#node-input-version').val(node._def.defaults.version.value);\n}\n}\n@@ -46,3 +42,70 @@ var nodeVersion = (function($) {\n};\n// eslint-disable-next-line no-undef\n})(jQuery);\n+\n+// eslint-disable-next-line no-unused-vars\n+var haServer = (function($, RED) {\n+ let $server;\n+ let serverId;\n+ let node;\n+\n+ function setDefault() {\n+ let defaultServer;\n+ RED.nodes.eachConfig(n => {\n+ if (n.type === 'server' && !defaultServer) defaultServer = n.id;\n+ });\n+ if (defaultServer) $server.val(defaultServer);\n+ }\n+\n+ function init(n, server) {\n+ $server = $(server);\n+ node = n;\n+\n+ if (!node.server) {\n+ setDefault();\n+ }\n+ }\n+\n+ function autocomplete(type, callback) {\n+ // If a server is selected populate drop downs\n+ const selectedServer = $server.val();\n+ if (node.server || (selectedServer && selectedServer !== '_ADD_')) {\n+ serverId = node.server || selectedServer;\n+ getItems(type, callback);\n+ }\n+\n+ $server.change(() => {\n+ serverId = $server.val();\n+ getItems(type, callback);\n+ });\n+ }\n+\n+ function getItems(type, callback) {\n+ // If no server added yet just return\n+ if (serverId === '_ADD_') return;\n+\n+ $.getJSON(`homeassistant/${serverId}/${type}`)\n+ .done(items => {\n+ callback(items);\n+ })\n+ .fail(err => {\n+ const serverConfig = RED.nodes.node($server.val());\n+\n+ if (serverConfig && serverConfig.dirty === true) {\n+ RED.notify(\n+ `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n+ err.responseText\n+ }`,\n+ 'error'\n+ );\n+ }\n+ });\n+ }\n+\n+ return {\n+ init,\n+ autocomplete\n+ };\n+\n+ // eslint-disable-next-line no-undef\n+})(jQuery, RED);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "},\noneditprepare: function() {\nconst node = this;\n- const $server = $(\"#node-input-server\");\nconst $domainField = $(\"#service_domain\");\nconst $serviceField = $(\"#service\");\n})\n.typedInput(\"width\", \"68%\");\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n-\n- if (!node.server) {\n- utils.setDefaultServerSelection();\n- }\n-\n- // If a server is selected populate dropdowns\n- const selectedServer = $server.val();\n- const serverId = node.server || selectedServer;\n- if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- setServicesAndDomains(node);\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n- _self = this;\n- _self.availableEntities = entities;\n+ haServer.init(node, \"#node-input-server\");\n+ haServer.autocomplete(\"entities\", entities => {\n+ node.availableEntities = entities;\nfunction split(val) {\nreturn val.split(/,\\s*/);\n}\n})\n.autocomplete({\n- source: _self.availableEntities,\n+ source: node.availableEntities,\nminLength: 0,\nsource: function(request, response) {\n// delegate back to autocomplete, but extract the last term\nresponse(\n$.ui.autocomplete.filter(\n- _self.availableEntities,\n+ node.availableEntities,\nextractLast(request.term)\n)\n);\nreturn false;\n}\n});\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n- // Calls the custom api backend defined in the config-server.js node\n- function setServicesAndDomains(node) {\n- return $.getJSON(`homeassistant/${serverId}/services`)\n- .then(services => {\n+ haServer.autocomplete(\"services\", services => {\nnode.allServices = services;\nnode.allDomains = Object.keys(node.allServices).sort();\nupdateServiceSelection({ serviceText: node.service || \"\" });\nreturn node;\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\nfunction updateServiceSelection({ event, serviceText }) {\nlet selectedServiceText = serviceText;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.html",
"new_path": "nodes/config-server/config-server.html",
"diff": "+<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n+<script src=\"homeassistant/static/common.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"server\", {\ncategory: \"config\",\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -5,6 +5,18 @@ const uniq = require('lodash.uniq');\nmodule.exports = function(RED) {\nconst HomeAssistant = require('../../lib/node-home-assistant');\n+ // Handle static files\n+ RED.httpAdmin.get(\n+ '/homeassistant/static/*',\n+ RED.auth.needsPermission('server.read'),\n+ function(req, res, next) {\n+ res.sendFile(req.params[0], {\n+ root: require('path').join(__dirname, '..', '/_static'),\n+ dotfiles: 'deny'\n+ });\n+ }\n+ );\n+\nconst httpHandlers = {\ngetEntities: function(req, res, next) {\nif (!this.homeAssistant) {\n@@ -135,16 +147,6 @@ module.exports = function(RED) {\nhttpHandlers.getProperties.bind(this)\n);\n- this.RED.httpAdmin.get('/homeassistant/static/*', function(\n- req,\n- res\n- ) {\n- res.sendFile(req.params[0], {\n- root: require('path').join(__dirname, '..', '/_static'),\n- dotfiles: 'deny'\n- });\n- });\n-\nthis.setOnContext('states', []);\nthis.setOnContext('services', []);\nthis.setOnContext('isConnected', false);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "-<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n-<script src=\"homeassistant/static/common.js\"></script>\n<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"api-current-state\", {\nconst $entityLocation = $(\"#node-input-entity_location\");\nconst node = this;\n- const $server = $(\"#node-input-server\");\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n- if (!node.server) {\n- utils.setDefaultServerSelection();\n- }\n-\n- const selectedServer = $server.val();\n- if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = node.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n- this.availableEntities = entities;\n+ haServer.init(node, \"#node-input-server\");\n+ haServer.autocomplete(\"entities\", entities => {\n+ node.availableEntities = entities;\n$entityIdField.autocomplete({\n- source: this.availableEntities,\n- minLength: 0,\n- change: (evt, ui) => {\n- const validSelection =\n- this.availableEntities.indexOf($(evt.target).val()) > -1;\n- }\n+ source: node.availableEntities,\n+ minLength: 0\n});\n-\n- const validSelection =\n- this.availableEntities.indexOf(this.entity_id) > -1;\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n$entityIdField.val(node.entity_id);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "-<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n-<script src=\"homeassistant/static/common.js\"></script>\n<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"server-state-changed\", {\nconst $entityidfilter = $(\"#node-input-entityidfilter\");\nconst $entityidfiltertype = $(\"#node-input-entityidfiltertype\");\n- const $server = $(\"#node-input-server\");\n$entityidfilter.val(this.entityidfilter);\nthis.entityidfiltertype = this.entityidfiltertype || \"substring\";\n$entityidfiltertype.val(this.entityidfiltertype);\n- const NODE = this;\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n-\n- if (!NODE.server) {\n- utils.setDefaultServerSelection();\n- }\n-\n- const setupAutocomplete = node => {\n- const selectedServer = $server.val();\n+ const node = this;\n- // A home assistant server is selected in the node config\n- if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = node.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n+ haServer.init(node, \"#node-input-server\");\n+ haServer.autocomplete(\"entities\", entities => {\nnode.availableEntities = entities;\n$entityidfilter.autocomplete({\nsource: node.availableEntities,\nminLength: 0\n});\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node(\n- $(\"#node-input-server\").val()\n- );\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n- };\n-\n- $server.change(() => setupAutocomplete(this));\nif (this.state_type === undefined) {\n$(\"#node-input-state_type\").val(\"str\");\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "oneditprepare: function() {\nconst NODE = this;\nconst $server = $(\"#node-input-server\");\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\nconst operators = [\n{ value: \"is\", text: \"is\" },\n{ value: \"is_not\", text: \"is not\" },\n];\nconst $logic = $(\"#logic\");\n- if (!NODE.server) {\n- utils.setDefaultServerSelection();\n- }\n-\n- const selectedServer = $server.val();\nlet availableProperties = [];\n- if (NODE.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = NODE.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/properties`)\n- .done(entities => {\n+ haServer.init(NODE, \"#node-input-server\");\n+ haServer.autocomplete(\"properties\", entities => {\navailableProperties = entities;\n$(\".input-property\").autocomplete({\nsource: availableProperties,\nminLength: 0\n});\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n$logic.editableList({\naddButton: true,\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.html",
"new_path": "nodes/get-history/get-history.html",
"diff": "},\noneditprepare: function() {\nconst NODE = this;\n- const $server = $(\"#node-input-server\");\nconst $entityIdField = $(\"#entity_id\");\n$entityIdField.val(this.entityid);\nNODE.entityidtype = NODE.entityidtype || \"is\";\n$(\"#node-input-entityidtype\").val(NODE.entityidtype);\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n-\n- if (!NODE.server) {\n- utils.setDefaultServerSelection();\n- }\n-\n- const selectedServer = $server.val();\n- if (NODE.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = NODE.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n- this.availableEntities = entities;\n+ haServer.init(NODE, \"#node-input-server\");\n+ let availableEntities = [];\n+ haServer.autocomplete(\"entities\", entities => {\n+ availableEntities = entities;\n$entityIdField.autocomplete({\n- source: this.availableEntities,\n- minLength: 0,\n- change: (evt, ui) => {\n- const validSelection =\n- this.availableEntities.indexOf($(evt.target).val()) > -1;\n- if (validSelection) {\n- $(evt.target).removeClass(\"input-error\");\n- } else {\n- $(evt.target).addClass(\"input-error\");\n- }\n- }\n+ source: availableEntities,\n+ minLength: 0\n});\n-\n- const validSelection =\n- this.availableEntities.indexOf(NODE.entityid) > -1;\n- if (validSelection) {\n- $entityIdField.removeClass(\"input-error\");\n- } else {\n- $entityIdField.addClass(\"input-error\");\n- }\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n$(\"#node-input-useRelativeTime\").on(\"change\", function() {\nif (this.checked) {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "-<link rel=\"stylesheet\" type=\"text/css\" href=\"homeassistant/static/common.css\" />\n-<script src=\"homeassistant/static/common.js\"></script>\n<script src=\"homeassistant/static/ifstate.js\"></script>\n<script type=\"text/javascript\">\nRED.nodes.registerType(\"poll-state\", {\nconst $entityIdField = $(\"#entity_id\");\n$entityIdField.val(this.entity_id);\n- const NODE = this;\n- const $server = $(\"#node-input-server\");\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n-\n- if (!NODE.server) {\n- utils.setDefaultServerSelection();\n- }\n+ const node = this;\n- const selectedServer = $server.val();\n- if (NODE.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = NODE.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n- this.availableEntities = entities;\n+ haServer.init(node, \"#node-input-server\");\n+ haServer.autocomplete(\"entities\", entities => {\n+ node.availableEntities = entities;\n$entityIdField.autocomplete({\n- source: this.availableEntities,\n+ source: node.availableEntities,\nminLength: 0,\nchange: (evt, ui) => {\nconst validSelection =\n- this.availableEntities.indexOf($(evt.target).val()) > -1;\n+ node.availableEntities.indexOf($(evt.target).val()) > -1;\nif (validSelection) {\n$(evt.target).removeClass(\"input-error\");\n} else {\n});\nconst validSelection =\n- this.availableEntities.indexOf(this.entity_id) > -1;\n+ node.availableEntities.indexOf(node.entity_id) > -1;\nif (validSelection) {\n$entityIdField.removeClass(\"input-error\");\n} else {\n$entityIdField.addClass(\"input-error\");\n}\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- }\n$(\"#node-input-updateinterval\").spinner({ min: 1 });\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "const $entityid = $(\"#node-input-entityid\");\nconst $entityidfiltertype = $(\"#node-input-entityidfiltertype\");\n- const $server = $(\"#node-input-server\");\nconst $outputs = $(\"#node-input-outputs\");\nconst $accordionContraint = $(\"#add-constraint-container\");\nconst $accordionOutput = $(\"#add-output-container\");\ngetRandomId: () =>\nMath.random()\n.toString(36)\n- .slice(2),\n- setupAutocomplete: () => {\n- const selectedServer = $server.val();\n-\n- // A home assistant server is selected in the node config\n- if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = node.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n+ .slice(2)\n+ };\n+\n+ haServer.init(node, \"#node-input-server\");\n+ haServer.autocomplete(\"entities\", entities => {\nnode.availableEntities = entities;\n$entityid.autocomplete({\nsource: node.availableEntities,\nsource: node.availableEntities,\nminLength: 0\n});\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node(\n- $(\"#node-input-server\").val()\n- );\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n});\n- $.getJSON(`homeassistant/${serverId}/properties`)\n- .done(entities => {\n- node.availableProperties = entities;\n+ haServer.autocomplete(\"properties\", properties => {\n+ node.availableProperties = properties;\n// prefix properties with new_state and old_state\nnode.availablePropertiesPrefixes = []\n.concat(\n- entities.map(e => `new_state.${e}`),\n- entities.map(e => `old_state.${e}`)\n+ properties.map(e => `new_state.${e}`),\n+ properties.map(e => `old_state.${e}`)\n)\n.sort();\n$(\"#constraint-property-value\").autocomplete({\n: node.availableProperties\n});\n});\n- })\n- .fail(err => {});\n- }\n- },\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n});\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n// **************************\n// * Add Constraints\n});\n$entityid.val(node.entityid);\n- $server.change(() => utils.setupAutocomplete(this));\n-\n- // New nodes, select first available home-assistant config node found\n- if (!node.server) {\n- utils.setDefaultServerSelection();\n- } else {\n- utils.setupAutocomplete();\n- }\n// Add previous constraints/outputs to editable lists\nnode.constraints.forEach(c =>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "const $entityIdField = $(\"#node-input-entityId\");\nconst node = this;\n- const $server = $(\"#node-input-server\");\n- const utils = {\n- setDefaultServerSelection: function() {\n- let defaultServer;\n- RED.nodes.eachConfig(n => {\n- if (n.type === \"server\" && !defaultServer) defaultServer = n.id;\n- });\n- if (defaultServer) $server.val(defaultServer);\n- }\n- };\n-\n- if (!node.server) {\n- utils.setDefaultServerSelection();\n- }\n- const selectedServer = $server.val();\n- if (node.server || (selectedServer && selectedServer !== \"_ADD_\")) {\n- const serverId = node.server || selectedServer;\n- $.getJSON(`homeassistant/${serverId}/entities`)\n- .done(entities => {\n- this.availableEntities = entities;\n+ haServer.init(node, \"#node-input-server\");\n+ let availableEntities = [];\n+ let availableProperties = [];\n+ haServer.autocomplete(\"entities\", entities => {\n+ availableEntities = entities;\n$entityIdField.autocomplete({\n- source: this.availableEntities,\n+ source: availableEntities,\nminLength: 0,\nchange: (evt, ui) => {\nconst validSelection =\n- this.availableEntities.indexOf($(evt.target).val()) > -1;\n+ availableEntities.indexOf($(evt.target).val()) > -1;\n}\n});\n- const validSelection =\n- this.availableEntities.indexOf(this.entityId) > -1;\n- })\n- .fail(err => {\n- const serverConfig = RED.nodes.node($(\"#node-input-server\").val());\n-\n- if (serverConfig && serverConfig.dirty === true) {\n- RED.notify(\n- `You probably haven't deployed since adding a server. Do that for autocomplete to work.\\n${\n- err.responseText\n- }`,\n- \"error\"\n- );\n- }\n+ const validSelection = availableEntities.indexOf(this.entityId) > -1;\n});\n+ haServer.autocomplete(\"properties\", entities => {\n+ availableProperties = entities;\n$(\"#node-input-property\").autocomplete({\n- source: function(request, response) {\n- $.ajax({\n- url: `homeassistant/${serverId}/properties`,\n- dataType: \"json\",\n- data: {\n- term: request.term,\n- entityId: $(\"#node-input-entityId\").val()\n- },\n- success: function(data) {\n- response(data);\n- }\n- });\n- },\n+ source: availableProperties,\nminLength: 0\n});\n- }\n+ });\nif (node.checkCurrentState === undefined) {\n$(\"#node-input-checkCurrentState\").prop(\"checked\", false);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: Update autocomplete on server change in ui
Moved server and autocomplete logic to common.js. Fixed issue when
changes the server in the UI it wouldn't update the autocomplete
entities. |
748,234 | 19.05.2019 19:10:27 | 25,200 | 3df9c180b9eb1f65870a6d12ec5faca60a1ffa77 | feat(trigger-state): More options for custom outputs
msg.payload can now be customized instead of the whole message.
There is now the option to select the output format.
Templates can be used within the custom output. The default context for
the template is event data (msg.data) | [
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "messageType: $(\"#output-message-type\"),\nmessageValue: $(\"#output-message-value\"),\n+ messageValueType: $(\"#output-message-value-type\"),\ncomparatorPropertyType: $(\"#output-comparator-property-type\"),\ncomparatorPropertyValue: $(\"#output-comparator-property-value\"),\n.slice(2)\n};\n+ let availableProperties = [];\n+ let availablePropertiesPrefixes = [];\nhaServer.init(node, \"#node-input-server\");\nhaServer.autocomplete(\"entities\", entities => {\nnode.availableEntities = entities;\n});\n});\nhaServer.autocomplete(\"properties\", properties => {\n- node.availableProperties = properties;\n+ availableProperties = properties;\n// prefix properties with new_state and old_state\n- node.availablePropertiesPrefixes = []\n+ availablePropertiesPrefixes = []\n.concat(\nproperties.map(e => `new_state.${e}`),\nproperties.map(e => `old_state.${e}`)\n)\n.sort();\n- $(\"#constraint-property-value\").autocomplete({\n- source: node.availablePropertiesPrefixes,\n- minLength: 0\n- });\n- $(\"#output-comparator-property-value\").autocomplete({\n- source: node.availableProperties,\n+ $(\n+ \"#constraint-property-value,#output-comparator-property-value\"\n+ ).autocomplete({\n+ source: availablePropertiesPrefixes,\nminLength: 0\n});\n$(\"#constraint-target-type\").on(\"change\", function() {\n$(\"#constraint-property-value\").autocomplete(\"option\", {\nsource:\n$(this).val() === \"this_entity\"\n- ? node.availablePropertiesPrefixes\n- : node.availableProperties\n+ ? availablePropertiesPrefixes\n+ : availableProperties\n});\n});\n});\nmessageType: $customoutputs.messageType.val(),\nmessageValue: $customoutputs.messageValue.val(),\n+ messageValueType: $customoutputs.messageValueType.val(),\ncomparatorPropertyType: $customoutputs.comparatorPropertyType.val(),\ncomparatorPropertyValue: $customoutputs.comparatorPropertyValue.val(),\n\"\"\n)} ${d.comparatorValue}`;\n- const html = `Send <strong>${messageText}</strong>, if <strong>${sendWhenText}</strong>`;\n+ const where =\n+ d.messageType === \"default\"\n+ ? \"Send\"\n+ : d.messageType === \"custom\"\n+ ? \"Msg\"\n+ : \"Payload\";\n+\n+ const html = `${where} <strong>${messageText}</strong>, if <strong>${sendWhenText}</strong>`;\n$row.html(html);\n},\n},\nonMessageTypeChange: function(e) {\nconst val = e.target.value;\n- val === \"default\"\n- ? $customoutputs.messageValue.attr(\"disabled\", \"disabled\")\n- : $customoutputs.messageValue.removeAttr(\"disabled\");\n+ $customoutputs.messageValue.typedInput(\n+ val === \"default\" ? \"hide\" : \"show\"\n+ );\n},\ncomparatorPropertyTypeChange: function(e) {\nconst val = e.target.value;\n\"change\",\noutputsHandler.onMessageTypeChange\n);\n+\n+ $customoutputs.messageValue.typedInput({\n+ default: \"json\",\n+ types: [\"str\", \"num\", \"bool\", \"json\"],\n+ typeField: \"#output-message-value-type\"\n+ });\n+ $customoutputs.messageType.trigger(\"change\");\n+\n$customoutputs.comparatorPropertyType.on(\n\"change\",\noutputsHandler.comparatorPropertyTypeChange\n<select type=\"text\" id=\"output-message-type\" style=\"width: 140px;\">\n<option value=\"default\">Default Msg</option>\n<option value=\"custom\">Custom Msg</option>\n+ <option value=\"payload\">Custom Payload</option>\n</select>\n- <input type=\"text\" id=\"output-message-value\" style=\"width: 62%\" disabled/>\n+ <input type=\"text\" id=\"output-message-value\" style=\"width: 62%\"/>\n+ <input type=\"hidden\" id=\"output-message-value-type\" />\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.js",
"new_path": "nodes/trigger-state/trigger-state.js",
"diff": "/* eslint-disable camelcase */\nconst EventsNode = require('../../lib/events-node');\nconst { reduce } = require('p-iteration');\n+const RenderTemplate = require('../../lib/mustache-context');\nmodule.exports = function(RED) {\nconst nodeOptions = {\n@@ -43,7 +44,6 @@ module.exports = function(RED) {\n});\nthis.NUM_DEFAULT_MESSAGES = 2;\n- this.messageTimers = {};\nthis.loadPersistedData();\n@@ -365,21 +365,48 @@ module.exports = function(RED) {\nreturn null;\n}\n- if (output.messageType === 'default') {\n+ let payload = eventMessage.event.new_state.state;\n+ if (\n+ output.messageType === 'custom' ||\n+ output.messageType === 'payload'\n+ ) {\n+ // Render Template Variables\n+ payload = RenderTemplate(\n+ output.messageValue,\n+ eventMessage.event,\n+ this.node.context(),\n+ this.utils.toCamelCase(this.nodeConfig.server.name)\n+ );\n+\n+ switch (output.messageValueType) {\n+ case 'num':\n+ payload = Number(payload);\n+ break;\n+ case 'bool':\n+ payload = payload === 'true';\n+ break;\n+ case 'str':\n+ break;\n+ case 'json':\n+ default:\n+ try {\n+ payload = JSON.parse(payload);\n+ } catch (e) {}\n+ break;\n+ }\n+\n+ if (output.messageType === 'custom') {\n+ return payload;\n+ }\n+ }\n+\nreturn {\ntopic: eventMessage.entity_id,\n- payload: eventMessage.event.new_state.state,\n+ payload,\ndata: eventMessage\n};\n}\n- try {\n- return JSON.parse(output.messageValue);\n- } catch (e) {\n- return output.messageValue;\n- }\n- }\n-\nasync loadPersistedData() {\ntry {\nconst data = await this.getNodeData();\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(trigger-state): More options for custom outputs
msg.payload can now be customized instead of the whole message.
There is now the option to select the output format.
Templates can be used within the custom output. The default context for
the template is event data (msg.data) |
748,234 | 19.05.2019 19:35:33 | 25,200 | 8bbca276924edd14855183f2ce78a4dd0afa7db7 | chore(dep): Updated Dependencies | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "}\n},\n\"@babel/runtime\": {\n- \"version\": \"7.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0.tgz\",\n- \"integrity\": \"sha512-7hGhzlcmg01CvH1EHdSPVXYX1aJ8KCEyz6I9xYIi/asDtzBPMyMhVibhM/K6g/5qnKBwjZtp10bNZIEFTRW1MA==\",\n+ \"version\": \"7.4.4\",\n+ \"resolved\": \"https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.4.tgz\",\n+ \"integrity\": \"sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg==\",\n\"dev\": true,\n\"requires\": {\n- \"regenerator-runtime\": \"^0.12.0\"\n+ \"regenerator-runtime\": \"^0.13.2\"\n},\n\"dependencies\": {\n\"regenerator-runtime\": {\n- \"version\": \"0.12.1\",\n- \"resolved\": \"https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz\",\n- \"integrity\": \"sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==\",\n+ \"version\": \"0.13.2\",\n+ \"resolved\": \"https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz\",\n+ \"integrity\": \"sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==\",\n\"dev\": true\n}\n}\n\"integrity\": \"sha512-mV6T0IYqb0xL1UALPFplXYQmR0twnXG0M6jUswpquqT2sD12BOiCiLy3EvMp/Fy7s3DZElC4/aPjEjo2jeZpvw==\"\n},\n\"@hapi/hoek\": {\n- \"version\": \"6.2.1\",\n- \"resolved\": \"https://registry.npmjs.org/@hapi/hoek/-/hoek-6.2.1.tgz\",\n- \"integrity\": \"sha512-+ryw4GU9pjr1uT6lBuErHJg3NYqzwJTvZ75nKuJijEzpd00Uqi6oiawTGDDf5Hl0zWmI7qHfOtaqB0kpQZJQzA==\"\n+ \"version\": \"6.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@hapi/hoek/-/hoek-6.2.3.tgz\",\n+ \"integrity\": \"sha512-CtV9cp35+6Sfh6OfB+AYBozNIorZ6npNJjfO8InIyh/iFQI7uBW9bIApYoYf6TWq9w9BArecw2DDJf7oK+VlRw==\"\n},\n\"@hapi/joi\": {\n- \"version\": \"15.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/@hapi/joi/-/joi-15.0.0.tgz\",\n- \"integrity\": \"sha512-pLCfcSeT26g59jEKZntmzlqe19dRMDNxCFKGD4CriF8+9FAD3Mq1aWNuKIFpKpX+u3x8lxLKXolDwk0gYl3b2w==\",\n+ \"version\": \"15.0.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@hapi/joi/-/joi-15.0.3.tgz\",\n+ \"integrity\": \"sha512-z6CesJ2YBwgVCi+ci8SI8zixoj8bGFn/vZb9MBPbSyoxsS2PnWYjHcyTM17VLK6tx64YVK38SDIh10hJypB+ig==\",\n\"requires\": {\n\"@hapi/address\": \"2.x.x\",\n\"@hapi/hoek\": \"6.x.x\",\n\"resolved\": \"https://registry.npmjs.org/mime/-/mime-2.4.0.tgz\",\n\"integrity\": \"sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==\",\n\"dev\": true\n+ },\n+ \"ws\": {\n+ \"version\": \"6.2.1\",\n+ \"resolved\": \"https://registry.npmjs.org/ws/-/ws-6.2.1.tgz\",\n+ \"integrity\": \"sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"async-limiter\": \"~1.0.0\"\n+ }\n}\n}\n},\n\"resolved\": \"https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz\",\n\"integrity\": \"sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==\",\n\"dev\": true\n+ },\n+ \"ws\": {\n+ \"version\": \"6.2.1\",\n+ \"resolved\": \"https://registry.npmjs.org/ws/-/ws-6.2.1.tgz\",\n+ \"integrity\": \"sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"async-limiter\": \"~1.0.0\"\n+ }\n}\n}\n},\n\"dev\": true\n},\n\"atob\": {\n- \"version\": \"2.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/atob/-/atob-2.1.1.tgz\",\n- \"integrity\": \"sha1-ri1acpR38onWDdf5amMUoi3Wwio=\",\n+ \"version\": \"2.1.2\",\n+ \"resolved\": \"https://registry.npmjs.org/atob/-/atob-2.1.2.tgz\",\n+ \"integrity\": \"sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==\",\n\"dev\": true\n},\n\"aws-sign2\": {\n\"requires\": {\n\"is-extendable\": \"^0.1.0\"\n}\n- },\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n}\n}\n},\n}\n},\n\"chokidar\": {\n- \"version\": \"2.1.5\",\n- \"resolved\": \"https://registry.npmjs.org/chokidar/-/chokidar-2.1.5.tgz\",\n- \"integrity\": \"sha512-i0TprVWp+Kj4WRPtInjexJ8Q+BqTE909VpH8xVhXrJkoc5QC8VO9TryGOqTr+2hljzc1sC62t22h5tZePodM/A==\",\n+ \"version\": \"2.1.6\",\n+ \"resolved\": \"https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz\",\n+ \"integrity\": \"sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g==\",\n\"dev\": true,\n\"requires\": {\n\"anymatch\": \"^2.0.0\",\n}\n},\n\"cosmiconfig\": {\n- \"version\": \"5.0.7\",\n- \"resolved\": \"https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.7.tgz\",\n- \"integrity\": \"sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA==\",\n+ \"version\": \"5.2.1\",\n+ \"resolved\": \"https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz\",\n+ \"integrity\": \"sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==\",\n\"dev\": true,\n\"requires\": {\n\"import-fresh\": \"^2.0.0\",\n\"is-directory\": \"^0.3.1\",\n- \"js-yaml\": \"^3.9.0\",\n+ \"js-yaml\": \"^3.13.1\",\n\"parse-json\": \"^4.0.0\"\n},\n\"dependencies\": {\n}\n},\n\"eslint-config-prettier\": {\n- \"version\": \"4.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.2.0.tgz\",\n- \"integrity\": \"sha512-y0uWc/FRfrHhpPZCYflWC8aE0KRJRY04rdZVfl8cL3sEZmOYyaBdhdlQPjKZBnuRMyLVK+JUZr7HaZFClQiH4w==\",\n+ \"version\": \"4.3.0\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz\",\n+ \"integrity\": \"sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA==\",\n\"dev\": true,\n\"requires\": {\n\"get-stdin\": \"^6.0.0\"\n}\n},\n\"eslint-plugin-node\": {\n- \"version\": \"8.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz\",\n- \"integrity\": \"sha512-ZjOjbjEi6jd82rIpFSgagv4CHWzG9xsQAVp1ZPlhRnnYxcTgENUVBvhYmkQ7GvT1QFijUSo69RaiOJKhMu6i8w==\",\n+ \"version\": \"9.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.0.1.tgz\",\n+ \"integrity\": \"sha512-fljT5Uyy3lkJzuqhxrYanLSsvaILs9I7CmQ31atTtZ0DoIzRbbvInBh4cQ1CrthFHInHYBQxfPmPt6KLHXNXdw==\",\n\"dev\": true,\n\"requires\": {\n- \"eslint-plugin-es\": \"^1.3.1\",\n+ \"eslint-plugin-es\": \"^1.4.0\",\n\"eslint-utils\": \"^1.3.1\",\n- \"ignore\": \"^5.0.2\",\n+ \"ignore\": \"^5.1.1\",\n\"minimatch\": \"^3.0.4\",\n- \"resolve\": \"^1.8.1\",\n- \"semver\": \"^5.5.0\"\n+ \"resolve\": \"^1.10.1\",\n+ \"semver\": \"^6.0.0\"\n},\n\"dependencies\": {\n\"ignore\": {\n- \"version\": \"5.0.5\",\n- \"resolved\": \"https://registry.npmjs.org/ignore/-/ignore-5.0.5.tgz\",\n- \"integrity\": \"sha512-kOC8IUb8HSDMVcYrDVezCxpJkzSQWTAzf3olpKM6o9rM5zpojx23O0Fl8Wr4+qJ6ZbPEHqf1fdwev/DS7v7pmA==\",\n+ \"version\": \"5.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/ignore/-/ignore-5.1.1.tgz\",\n+ \"integrity\": \"sha512-DWjnQIFLenVrwyRCKZT+7a7/U4Cqgar4WG8V++K3hw+lrW1hc/SIwdiGmtxKCVACmHULTuGeBbHJmbwW7/sAvA==\",\n+ \"dev\": true\n+ },\n+ \"path-parse\": {\n+ \"version\": \"1.0.6\",\n+ \"resolved\": \"https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz\",\n+ \"integrity\": \"sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==\",\n+ \"dev\": true\n+ },\n+ \"resolve\": {\n+ \"version\": \"1.11.0\",\n+ \"resolved\": \"https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz\",\n+ \"integrity\": \"sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"path-parse\": \"^1.0.6\"\n+ }\n+ },\n+ \"semver\": {\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/semver/-/semver-6.0.0.tgz\",\n+ \"integrity\": \"sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==\",\n\"dev\": true\n}\n}\n},\n\"eslint-plugin-prettier\": {\n- \"version\": \"3.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz\",\n- \"integrity\": \"sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ==\",\n+ \"version\": \"3.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz\",\n+ \"integrity\": \"sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA==\",\n\"dev\": true,\n\"requires\": {\n\"prettier-linter-helpers\": \"^1.0.0\"\n\"requires\": {\n\"is-extendable\": \"^0.1.0\"\n}\n- },\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n}\n}\n},\n\"requires\": {\n\"assign-symbols\": \"^1.0.0\",\n\"is-extendable\": \"^1.0.1\"\n+ },\n+ \"dependencies\": {\n+ \"is-extendable\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz\",\n+ \"integrity\": \"sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"is-plain-object\": \"^2.0.4\"\n+ }\n+ }\n}\n},\n\"external-editor\": {\n\"is-data-descriptor\": \"^1.0.0\",\n\"kind-of\": \"^6.0.2\"\n}\n- },\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n}\n}\n},\n\"requires\": {\n\"is-extendable\": \"^0.1.0\"\n}\n- },\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n}\n}\n},\n}\n},\n\"husky\": {\n- \"version\": \"2.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/husky/-/husky-2.1.0.tgz\",\n- \"integrity\": \"sha512-FHsqdIJPmQX/89Xg/761RMFCPSNNG2eiQMxChGP081NTohHexEuu/4nYh5m4TcFKq4xm+DqaGp8J/EUnkzL1Aw==\",\n+ \"version\": \"2.3.0\",\n+ \"resolved\": \"https://registry.npmjs.org/husky/-/husky-2.3.0.tgz\",\n+ \"integrity\": \"sha512-A/ZQSEILoq+mQM3yC3RIBSaw1bYXdkKnyyKVSUiJl+iBjVZc5LQEXdGY1ZjrDxC4IzfRPiJ0IqzEQGCN5TQa/A==\",\n\"dev\": true,\n\"requires\": {\n\"cosmiconfig\": \"^5.2.0\",\n\"is-ci\": \"^2.0.0\",\n\"pkg-dir\": \"^4.1.0\",\n\"please-upgrade-node\": \"^3.1.1\",\n- \"read-pkg\": \"^5.0.0\",\n+ \"read-pkg\": \"^5.1.1\",\n\"run-node\": \"^1.0.0\",\n- \"slash\": \"^2.0.0\"\n+ \"slash\": \"^3.0.0\"\n},\n\"dependencies\": {\n- \"cosmiconfig\": {\n- \"version\": \"5.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.0.tgz\",\n- \"integrity\": \"sha512-nxt+Nfc3JAqf4WIWd0jXLjTJZmsPLrA9DDc4nRw2KFJQJK7DNooqSXrNI7tzLG50CF8axczly5UV929tBmh/7g==\",\n- \"dev\": true,\n- \"requires\": {\n- \"import-fresh\": \"^2.0.0\",\n- \"is-directory\": \"^0.3.1\",\n- \"js-yaml\": \"^3.13.0\",\n- \"parse-json\": \"^4.0.0\"\n- }\n- },\n\"find-up\": {\n\"version\": \"3.0.0\",\n\"resolved\": \"https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz\",\n\"integrity\": \"sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==\",\n\"dev\": true\n},\n- \"import-fresh\": {\n- \"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz\",\n- \"integrity\": \"sha1-2BNVwVYS04bGH53dOSLUMEgipUY=\",\n- \"dev\": true,\n- \"requires\": {\n- \"caller-path\": \"^2.0.0\",\n- \"resolve-from\": \"^3.0.0\"\n- }\n- },\n\"locate-path\": {\n\"version\": \"3.0.0\",\n\"resolved\": \"https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz\",\n\"parse-json\": \"^4.0.0\",\n\"type-fest\": \"^0.4.1\"\n}\n- },\n- \"resolve-from\": {\n- \"version\": \"3.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz\",\n- \"integrity\": \"sha1-six699nWiBvItuZTM17rywoYh0g=\",\n- \"dev\": true\n}\n}\n},\n\"dev\": true\n},\n\"is-extendable\": {\n- \"version\": \"1.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz\",\n- \"integrity\": \"sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==\",\n- \"dev\": true,\n- \"requires\": {\n- \"is-plain-object\": \"^2.0.4\"\n- }\n+ \"version\": \"0.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n+ \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n+ \"dev\": true\n},\n\"is-extglob\": {\n\"version\": \"2.1.1\",\n\"symbol-observable\": \"^1.1.0\"\n}\n},\n- \"is-odd\": {\n- \"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz\",\n- \"integrity\": \"sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==\",\n- \"dev\": true,\n- \"requires\": {\n- \"is-number\": \"^4.0.0\"\n- },\n- \"dependencies\": {\n- \"is-number\": {\n- \"version\": \"4.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz\",\n- \"integrity\": \"sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==\",\n- \"dev\": true\n- }\n- }\n- },\n\"is-path-cwd\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz\",\n}\n},\n\"lint-staged\": {\n- \"version\": \"8.1.5\",\n- \"resolved\": \"https://registry.npmjs.org/lint-staged/-/lint-staged-8.1.5.tgz\",\n- \"integrity\": \"sha512-e5ZavfnSLcBJE1BTzRTqw6ly8OkqVyO3GL2M6teSmTBYQ/2BuueD5GIt2RPsP31u/vjKdexUyDCxSyK75q4BDA==\",\n+ \"version\": \"8.1.7\",\n+ \"resolved\": \"https://registry.npmjs.org/lint-staged/-/lint-staged-8.1.7.tgz\",\n+ \"integrity\": \"sha512-egT0goFhIFoOGk6rasPngTFh2qDqxZddM0PwI58oi66RxCDcn5uDwxmiasWIF0qGnchHSYVJ8HPRD5LrFo7TKA==\",\n\"dev\": true,\n\"requires\": {\n\"chalk\": \"^2.3.1\",\n\"commander\": \"^2.14.1\",\n- \"cosmiconfig\": \"^5.0.2\",\n+ \"cosmiconfig\": \"^5.2.0\",\n\"debug\": \"^3.1.0\",\n\"dedent\": \"^0.7.0\",\n\"del\": \"^3.0.0\",\n\"staged-git-files\": \"1.1.2\",\n\"string-argv\": \"^0.0.2\",\n\"stringify-object\": \"^3.2.2\",\n- \"yup\": \"^0.26.10\"\n+ \"yup\": \"^0.27.0\"\n},\n\"dependencies\": {\n\"debug\": {\n},\n\"dependencies\": {\n\"p-map\": {\n- \"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/p-map/-/p-map-2.0.0.tgz\",\n- \"integrity\": \"sha512-GO107XdrSUmtHxVoi60qc9tUl/KkNKm+X2CF4P9amalpGxv5YqVPJNfSb0wcA+syCopkZvYYIzW8OVTQW59x/w==\",\n+ \"version\": \"2.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz\",\n+ \"integrity\": \"sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==\",\n\"dev\": true\n}\n}\n\"requires\": {\n\"for-in\": \"^1.0.2\",\n\"is-extendable\": \"^1.0.1\"\n+ },\n+ \"dependencies\": {\n+ \"is-extendable\": {\n+ \"version\": \"1.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz\",\n+ \"integrity\": \"sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==\",\n+ \"dev\": true,\n+ \"requires\": {\n+ \"is-plain-object\": \"^2.0.4\"\n+ }\n+ }\n}\n},\n\"mkdirp\": {\n\"dev\": true\n},\n\"nan\": {\n- \"version\": \"2.13.2\",\n- \"resolved\": \"https://registry.npmjs.org/nan/-/nan-2.13.2.tgz\",\n- \"integrity\": \"sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==\",\n+ \"version\": \"2.14.0\",\n+ \"resolved\": \"https://registry.npmjs.org/nan/-/nan-2.14.0.tgz\",\n+ \"integrity\": \"sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==\",\n\"dev\": true,\n\"optional\": true\n},\n\"nanomatch\": {\n- \"version\": \"1.2.9\",\n- \"resolved\": \"https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz\",\n- \"integrity\": \"sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==\",\n+ \"version\": \"1.2.13\",\n+ \"resolved\": \"https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz\",\n+ \"integrity\": \"sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==\",\n\"dev\": true,\n\"requires\": {\n\"arr-diff\": \"^4.0.0\",\n\"define-property\": \"^2.0.2\",\n\"extend-shallow\": \"^3.0.2\",\n\"fragment-cache\": \"^0.2.1\",\n- \"is-odd\": \"^2.0.0\",\n\"is-windows\": \"^1.0.2\",\n\"kind-of\": \"^6.0.2\",\n\"object.pick\": \"^1.3.0\",\n\"dev\": true\n},\n\"nodemon\": {\n- \"version\": \"1.18.11\",\n- \"resolved\": \"https://registry.npmjs.org/nodemon/-/nodemon-1.18.11.tgz\",\n- \"integrity\": \"sha512-KdN3tm1zkarlqNo4+W9raU3ihM4H15MVMSE/f9rYDZmFgDHAfAJsomYrHhApAkuUemYjFyEeXlpCOQ2v5gtBEw==\",\n+ \"version\": \"1.19.0\",\n+ \"resolved\": \"https://registry.npmjs.org/nodemon/-/nodemon-1.19.0.tgz\",\n+ \"integrity\": \"sha512-NHKpb/Je0Urmwi3QPDHlYuFY9m1vaVfTsRZG5X73rY46xPj0JpNe8WhUGQdkDXQDOxrBNIU3JrcflE9Y44EcuA==\",\n\"dev\": true,\n\"requires\": {\n\"chokidar\": \"^2.1.5\",\n\"dev\": true\n},\n\"prettier\": {\n- \"version\": \"1.17.0\",\n- \"resolved\": \"https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz\",\n- \"integrity\": \"sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==\",\n+ \"version\": \"1.17.1\",\n+ \"resolved\": \"https://registry.npmjs.org/prettier/-/prettier-1.17.1.tgz\",\n+ \"integrity\": \"sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==\",\n\"dev\": true\n},\n\"prettier-linter-helpers\": {\n\"dev\": true\n},\n\"repeat-element\": {\n- \"version\": \"1.1.2\",\n- \"resolved\": \"https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz\",\n- \"integrity\": \"sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=\",\n+ \"version\": \"1.1.3\",\n+ \"resolved\": \"https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz\",\n+ \"integrity\": \"sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==\",\n\"dev\": true\n},\n\"repeat-string\": {\n\"requires\": {\n\"is-extendable\": \"^0.1.0\"\n}\n- },\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n}\n}\n},\n\"dev\": true\n},\n\"simple-git\": {\n- \"version\": \"1.110.0\",\n- \"resolved\": \"https://registry.npmjs.org/simple-git/-/simple-git-1.110.0.tgz\",\n- \"integrity\": \"sha512-UYY0rQkknk0P5eb+KW+03F4TevZ9ou0H+LoGaj7iiVgpnZH4wdj/HTViy/1tNNkmIPcmtxuBqXWiYt2YwlRKOQ==\",\n+ \"version\": \"1.113.0\",\n+ \"resolved\": \"https://registry.npmjs.org/simple-git/-/simple-git-1.113.0.tgz\",\n+ \"integrity\": \"sha512-i9WVsrK2u0G/cASI9nh7voxOk9mhanWY9eGtWBDSYql6m49Yk5/Fan6uZsDr/xmzv8n+eQ8ahKCoEr8cvU3h+g==\",\n\"dev\": true,\n\"requires\": {\n\"debug\": \"^4.0.1\"\n}\n},\n\"slash\": {\n- \"version\": \"2.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/slash/-/slash-2.0.0.tgz\",\n- \"integrity\": \"sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==\",\n+ \"version\": \"3.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/slash/-/slash-3.0.0.tgz\",\n+ \"integrity\": \"sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==\",\n\"dev\": true\n},\n\"slice-ansi\": {\n\"is-extendable\": \"^0.1.0\"\n}\n},\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n- },\n\"source-map\": {\n\"version\": \"0.5.7\",\n\"resolved\": \"https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz\",\n\"dev\": true\n},\n\"source-map-resolve\": {\n- \"version\": \"0.5.1\",\n- \"resolved\": \"https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz\",\n- \"integrity\": \"sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==\",\n+ \"version\": \"0.5.2\",\n+ \"resolved\": \"https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz\",\n+ \"integrity\": \"sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==\",\n\"dev\": true,\n\"requires\": {\n- \"atob\": \"^2.0.0\",\n+ \"atob\": \"^2.1.1\",\n\"decode-uri-component\": \"^0.2.0\",\n\"resolve-url\": \"^0.2.1\",\n\"source-map-url\": \"^0.4.0\",\n\"dev\": true\n},\n\"synchronous-promise\": {\n- \"version\": \"2.0.6\",\n- \"resolved\": \"https://registry.npmjs.org/synchronous-promise/-/synchronous-promise-2.0.6.tgz\",\n- \"integrity\": \"sha512-TyOuWLwkmtPL49LHCX1caIwHjRzcVd62+GF6h8W/jHOeZUFHpnd2XJDVuUlaTaLPH1nuu2M69mfHr5XbQJnf/g==\",\n+ \"version\": \"2.0.7\",\n+ \"resolved\": \"https://registry.npmjs.org/synchronous-promise/-/synchronous-promise-2.0.7.tgz\",\n+ \"integrity\": \"sha512-16GbgwTmFMYFyQMLvtQjvNWh30dsFe1cAW5Fg1wm5+dg84L9Pe36mftsIRU95/W2YsISxsz/xq4VB23sqpgb/A==\",\n\"dev\": true\n},\n\"table\": {\n\"dev\": true\n},\n\"timestring\": {\n- \"version\": \"5.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/timestring/-/timestring-5.0.1.tgz\",\n- \"integrity\": \"sha512-0VfOVpaTYqBMTEpjwcY5mB+72YYjFI44Z5F2q80ZiIyDn5pRJm+rEV1OEM8xfnf5/FdtckcrTERTp9TbrlMMHw==\"\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/timestring/-/timestring-6.0.0.tgz\",\n+ \"integrity\": \"sha512-wMctrWD2HZZLuIlchlkE2dfXJh7J2KDI9Dwl+2abPYg0mswQHfOAyQW3jJg1pY5VfttSINZuKcXoB3FGypVklA==\"\n},\n\"tmp\": {\n\"version\": \"0.0.33\",\n\"is-extendable\": \"^0.1.0\"\n}\n},\n- \"is-extendable\": {\n- \"version\": \"0.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz\",\n- \"integrity\": \"sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=\",\n- \"dev\": true\n- },\n\"set-value\": {\n\"version\": \"0.4.3\",\n\"resolved\": \"https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz\",\n}\n},\n\"use\": {\n- \"version\": \"3.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/use/-/use-3.1.0.tgz\",\n- \"integrity\": \"sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==\",\n- \"dev\": true,\n- \"requires\": {\n- \"kind-of\": \"^6.0.2\"\n- }\n+ \"version\": \"3.1.1\",\n+ \"resolved\": \"https://registry.npmjs.org/use/-/use-3.1.1.tgz\",\n+ \"integrity\": \"sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==\",\n+ \"dev\": true\n},\n\"utf7\": {\n\"version\": \"1.0.2\",\n}\n},\n\"ws\": {\n- \"version\": \"6.2.1\",\n- \"resolved\": \"https://registry.npmjs.org/ws/-/ws-6.2.1.tgz\",\n- \"integrity\": \"sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==\",\n+ \"version\": \"7.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/ws/-/ws-7.0.0.tgz\",\n+ \"integrity\": \"sha512-cknCal4k0EAOrh1SHHPPWWh4qm93g1IuGGGwBjWkXmCG7LsDtL8w9w+YVfaF+KSVwiHQKDIMsSLBVftKf9d1pg==\",\n\"requires\": {\n- \"async-limiter\": \"~1.0.0\"\n+ \"async-limiter\": \"^1.0.0\"\n}\n},\n\"xdg-basedir\": {\n}\n},\n\"yup\": {\n- \"version\": \"0.26.10\",\n- \"resolved\": \"https://registry.npmjs.org/yup/-/yup-0.26.10.tgz\",\n- \"integrity\": \"sha512-keuNEbNSnsOTOuGCt3UJW69jDE3O4P+UHAakO7vSeFMnjaitcmlbij/a3oNb9g1Y1KvSKH/7O1R2PQ4m4TRylw==\",\n+ \"version\": \"0.27.0\",\n+ \"resolved\": \"https://registry.npmjs.org/yup/-/yup-0.27.0.tgz\",\n+ \"integrity\": \"sha512-v1yFnE4+u9za42gG/b/081E7uNW9mUj3qtkmelLbW5YPROZzSH/KUUyJu9Wt8vxFJcT9otL/eZopS0YK1L5yPQ==\",\n\"dev\": true,\n\"requires\": {\n- \"@babel/runtime\": \"7.0.0\",\n+ \"@babel/runtime\": \"^7.0.0\",\n\"fn-name\": \"~2.0.1\",\n- \"lodash\": \"^4.17.10\",\n+ \"lodash\": \"^4.17.11\",\n\"property-expr\": \"^1.5.0\",\n- \"synchronous-promise\": \"^2.0.5\",\n+ \"synchronous-promise\": \"^2.0.6\",\n\"toposort\": \"^2.0.2\"\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "}\n},\n\"dependencies\": {\n- \"@hapi/joi\": \"15.0.0\",\n+ \"@hapi/joi\": \"15.0.3\",\n\"axios\": \"0.18.0\",\n\"date-fns\": \"1.30.1\",\n\"debug\": \"4.1.1\",\n\"p-iteration\": \"1.1.8\",\n\"selectn\": \"1.1.2\",\n\"time-ago\": \"0.2.1\",\n- \"timestring\": \"5.0.1\",\n- \"ws\": \"6.2.1\"\n+ \"timestring\": \"6.0.0\",\n+ \"ws\": \"7.0.0\"\n},\n\"devDependencies\": {\n\"coveralls\": \"^3.0.3\",\n\"eslint\": \"^5.16.0\",\n- \"eslint-config-prettier\": \"^4.2.0\",\n+ \"eslint-config-prettier\": \"^4.3.0\",\n\"eslint-config-standard\": \"^12.0.0\",\n\"eslint-plugin-import\": \"^2.17.2\",\n- \"eslint-plugin-node\": \"^8.0.1\",\n- \"eslint-plugin-prettier\": \"^3.0.1\",\n+ \"eslint-plugin-node\": \"^9.0.1\",\n+ \"eslint-plugin-prettier\": \"^3.1.0\",\n\"eslint-plugin-promise\": \"^4.1.1\",\n\"eslint-plugin-standard\": \"^4.0.0\",\n- \"husky\": \"^2.1.0\",\n+ \"husky\": \"^2.3.0\",\n\"istanbul\": \"^1.1.0-alpha.1\",\n- \"lint-staged\": \"^8.1.5\",\n+ \"lint-staged\": \"^8.1.7\",\n\"mocha\": \"^6.1.4\",\n\"nock\": \"^10.0.6\",\n\"node-red\": \"^0.20.5\",\n\"node-red-node-test-helper\": \"^0.2.2\",\n- \"nodemon\": \"^1.18.11\",\n- \"prettier\": \"^1.17.0\"\n+ \"nodemon\": \"^1.19.0\",\n+ \"prettier\": \"^1.17.1\"\n},\n\"husky\": {\n\"hooks\": {\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore(dep): Updated Dependencies |
748,234 | 21.05.2019 17:43:37 | 25,200 | 6a3376b3230a261595971918334bfef58bd28a8b | refactor(wait-until): entity id and property are now required fields | [
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "name: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\noutputs: { value: 1 },\n- entityId: { value: \"\" },\n- property: { value: \"\" },\n+ entityId: { value: \"\", required: true },\n+ property: { value: \"\", required: true },\ncomparator: { value: \"is\" },\nvalue: { value: \"\" },\nvalueType: { value: \"str\" },\ncheckCurrentState: { value: true }\n},\noneditprepare: function() {\n- const $entityIdField = $(\"#node-input-entityId\");\n-\nconst node = this;\nhaServer.init(node, \"#node-input-server\");\nlet availableProperties = [];\nhaServer.autocomplete(\"entities\", entities => {\navailableEntities = entities;\n-\n- $entityIdField.autocomplete({\n+ $(\"#node-input-entityId\").autocomplete({\nsource: availableEntities,\n- minLength: 0,\n- change: (evt, ui) => {\n- const validSelection =\n- availableEntities.indexOf($(evt.target).val()) > -1;\n- }\n+ minLength: 0\n});\n-\n- const validSelection = availableEntities.indexOf(this.entityId) > -1;\n});\n- haServer.autocomplete(\"properties\", entities => {\n- availableProperties = entities;\n+ haServer.autocomplete(\"properties\", properties => {\n+ availableProperties = properties;\n$(\"#node-input-property\").autocomplete({\nsource: availableProperties,\nminLength: 0\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(wait-until): entity id and property are now required fields |
748,234 | 22.05.2019 05:17:16 | 25,200 | 861c8e8e1558f1fc5b3aa6efdec633ec8f2ef9fc | fix: fixed error reporting so catch node could be used
Closes | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -84,7 +84,8 @@ module.exports = function(RED) {\nthis.error(\n`call service node is missing api \"${\n!apiDomain ? 'domain' : 'service'\n- }\" property, not found in config or payload`\n+ }\" property, not found in config or payload`,\n+ message\n);\nthis.setStatusFailed('Error');\nreturn;\n@@ -121,7 +122,8 @@ module.exports = function(RED) {\nthis.error(\n`Call-service API error.${\nerr.message ? ` Error Message: ${err.message}` : ''\n- }`\n+ }`,\n+ message\n);\nthis.setStatusFailed('API Error');\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -127,16 +127,11 @@ module.exports = function(RED) {\nmessage.enddate = enddate || null;\nmessage.entityid = entityid || null;\n} catch (err) {\n- let errorMessage =\n- 'Error get-history, home assistant api error.';\n- if (this.utils.selectn('response.data.message', err))\n- errorMessage = `${errorMessage} Error Message: ${\n- err.response.data.message\n- }`;\n- this.error(errorMessage);\n+ let errorMessage = `Error get-history: ${err.message}`;\n+ this.error(errorMessage, message);\nthis.setStatusFailed('Error');\n- return null;\n+ return;\n}\nif (this.nodeConfig.output_location === undefined) {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -100,13 +100,7 @@ module.exports = function(RED) {\nthis.setStatusSuccess();\n})\n.catch(err => {\n- this.error(\n- `Error get-template, home assistant api error. ${\n- this.utils.selectn('response.data.message', err)\n- ? `Error Message: ${err.response.data.message}`\n- : ''\n- }`\n- );\n+ this.error(`Error get-template: ${err.message}`, message);\nthis.setStatusFailed('Error');\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -78,7 +78,7 @@ module.exports = function(RED) {\nthis.send([this.savedMessage, null]);\n} catch (e) {\n- this.error(e);\n+ this.error(e, this.savedMessage);\n}\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: fixed error reporting so catch node could be used
Closes #119 |
748,234 | 22.05.2019 14:43:01 | 25,200 | 89346e2b31689c6d821e0c2ff17a7cad0685abbc | fix: more error reporting fixes | [
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -97,7 +97,10 @@ module.exports = function(RED) {\nconfig.server.websocket.CONNECTED\n) {\nthis.setStatusFailed('No Connection');\n- this.warn('API call attempted without connection to server.');\n+ this.error(\n+ 'API call attempted without connection to server.',\n+ message\n+ );\nreturn;\n}\n@@ -123,7 +126,7 @@ module.exports = function(RED) {\n).replace(/^\\/(?:api\\/)?/, '');\nif (!path) {\n- node.error('HTTP request requires a valid path.');\n+ node.error('HTTP request requires a valid path.', message);\nnode.setStatusFailed();\nreturn;\n}\n@@ -140,7 +143,8 @@ module.exports = function(RED) {\nif (!json.type) {\nnode.error(\n- `A WebSocket request requires a 'type' property in the data object.`\n+ `A WebSocket request requires a 'type' property in the data object.`,\n+ message\n);\nnode.setStatusFailed();\nreturn null;\n@@ -151,7 +155,7 @@ module.exports = function(RED) {\njson\n);\n} catch (e) {\n- node.error(e.message);\n+ node.error(e.message, message);\nnode.setStatusFailed();\nreturn;\n}\n@@ -178,7 +182,8 @@ module.exports = function(RED) {\nnode.error(\n'API Error. ' + err.message\n? `Error Message: ${err.message}`\n- : ''\n+ : '',\n+ message\n);\nnode.setStatusFailed('API Error');\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -42,8 +42,9 @@ module.exports = function(RED) {\nconfig.server.websocket.CONNECTED\n) {\nthis.setStatusFailed('No Connection');\n- this.warn(\n- 'Call-Service attempted without connection to server.'\n+ this.error(\n+ 'Call-Service attempted without connection to server.',\n+ message\n);\nreturn;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -42,7 +42,7 @@ module.exports = function(RED) {\nconst entityId = parsedMessage.entity_id.value;\nif (config.server === null) {\n- this.node.error('No valid server selected.');\n+ this.node.error('No valid server selected.', message);\nreturn;\n}\n@@ -53,7 +53,8 @@ module.exports = function(RED) {\nif (!entity.entity_id) {\nthis.node.error(\n- `Entity could not be found in cache for entity_id: ${entityId}`\n+ `Entity could not be found in cache for entity_id: ${entityId}`,\n+ message\n);\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.js",
"new_path": "nodes/get-entities/get-entities.js",
"diff": "@@ -28,8 +28,8 @@ module.exports = function(RED) {\nlet noPayload = false;\nif (config.server === null) {\n- this.node.error('No valid server selected.');\n- return null;\n+ this.node.error('No valid server selected.', message);\n+ return;\n}\nconst states = await config.server.homeAssistant.getStates();\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -86,8 +86,8 @@ module.exports = function(RED) {\nlet useRelativeTime = this.nodeConfig.useRelativeTime;\nif (this.nodeConfig.server === null) {\n- this.node.error('No valid server selected.');\n- return null;\n+ this.node.error('No valid server selected.', message);\n+ return;\n}\nif (\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.js",
"new_path": "nodes/poll-state/poll-state.js",
"diff": "@@ -87,10 +87,11 @@ module.exports = function(RED) {\n);\nif (!pollState.entity_id) {\n- this.warn(\n+ this.error(\n`could not find state with entity_id \"${\nthis.nodeConfig.entity_id\n- }\"`\n+ }\"`,\n+ {}\n);\nthis.status({\nfill: 'red',\n@@ -102,10 +103,11 @@ module.exports = function(RED) {\nconst dateChanged = this.calculateTimeSinceChanged(pollState);\nif (!dateChanged) {\n- this.warn(\n+ this.error(\n`could not calculate time since changed for entity_id \"${\nthis.nodeConfig.entity_id\n- }\"`\n+ }\"`,\n+ {}\n);\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -74,8 +74,8 @@ module.exports = function(RED) {\n} = parsedMessage;\nif (this.nodeConfig.server === null) {\n- this.node.error('No valid server selected.');\n- return null;\n+ this.node.error('No valid server selected.', message);\n+ return;\n}\nthis.setStatusSending('Requesting');\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: more error reporting fixes |
748,234 | 22.05.2019 20:40:39 | 25,200 | 06245702d9622e4e418d53e727d36ba78981dc3a | feat(call-service): Ability to use alt tags for mustache templates
Able to use alternative mustache tags for the data field.
Mustache Tags become <% %>
This allows the use of jinja2 templates within the data field property
to be passed onto HA.
Closes | [
{
"change_type": "MODIFY",
"old_path": "lib/mustache-context.js",
"new_path": "lib/mustache-context.js",
"diff": "@@ -79,13 +79,22 @@ NodeContext.prototype.push = function push(view) {\n);\n};\n-function RenderTemplate(data, message, context, serverName) {\n- return (data || '').indexOf('{{') !== -1\n- ? mustache.render(\n+function RenderTemplate(data, message, context, serverName, altTags = false) {\n+ const template = data || '';\n+\n+ if (\n+ (altTags !== true && template.indexOf('{{') !== -1) ||\n+ (altTags === true && template.indexOf('<%') !== -1)\n+ ) {\n+ return mustache.render(\ndata,\n- new NodeContext(message, null, context, serverName)\n- )\n- : data;\n+ new NodeContext(message, null, context, serverName),\n+ null,\n+ altTags === true ? ['<%', '%>'] : null\n+ );\n+ }\n+\n+ return data;\n}\nmodule.exports = RenderTemplate;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.css",
"new_path": "nodes/_static/common.css",
"diff": "padding: 5px;\nmargin-top: 5px;\n}\n+\n+.checkboxOption input {\n+ margin-left: 105px;\n+ display: inline-block;\n+ width: auto;\n+ vertical-align: baseline;\n+}\n+\n+.checkboxOption label {\n+ width: auto;\n+ margin-right: 20px;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "},\nmergecontext: { value: null },\noutput_location: { value: \"payload\" },\n- output_location_type: { value: \"none\" }\n+ output_location_type: { value: \"none\" },\n+ mustacheAltTags: { value: false }\n},\noneditprepare: function() {\nconst node = this;\n<input type=\"text\" id=\"node-input-output_location\" />\n</div>\n+ <div class=\"form-row checkboxOption\">\n+ <input type=\"checkbox\" id=\"node-input-mustacheAltTags\"> \n+ <label for=\"node-input-mustacheAltTags\">Use alternative Mustache tags for the Data field</label>\n+ </div>\n+\n<div id=\"service-data-desc\" class=\"form-row\">\n<h4>\nService: <span class=\"title\"></span>\n<dl class=\"message-properties\">\n<dt>Entity Id <span class=\"property-type\">string</span></dt>\n<dd>A comma delimited list of entity ids</dd>\n+\n<dt class=\"optional\">data <span class=\"property-type\">JSON</span></dt>\n<dd>JSON object to pass along.</dd>\n+\n+ <dt class=\"optional\">Merge Context <span class=\"property-type\">string</span></dt>\n+ <dd>If defined will attempt to merge the global and flow context variable into the config</dd>\n+\n+ <dt class=\"optional\">Alternative Mustache tags <span class=\"property-type\">boolean</span></dt>\n+ <dd>Will change the tags used for mustache template to <code><%</code> and <code>%></code></dd>\n</dl>\n<h3>Inputs</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "/* eslint-disable camelcase */\nconst BaseNode = require('../../lib/base-node');\n-// const mustache = require('mustache');\nconst RenderTemplate = require('../../lib/mustache-context');\nmodule.exports = function(RED) {\n@@ -14,7 +13,8 @@ module.exports = function(RED) {\nname: {},\nserver: { isNode: true },\noutput_location: {},\n- output_location_type: {}\n+ output_location_type: {},\n+ mustacheAltTags: {}\n}\n};\n@@ -77,7 +77,8 @@ module.exports = function(RED) {\nconfig.data,\nmessage,\ncontext,\n- serverName\n+ serverName,\n+ config.mustacheAltTags\n);\nconst apiData = this.getApiData(payload, configData);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(call-service): Ability to use alt tags for mustache templates
Able to use alternative mustache tags for the data field.
Mustache Tags become <% %>
This allows the use of jinja2 templates within the data field property
to be passed onto HA.
Closes #117 |
748,234 | 23.05.2019 05:24:09 | 25,200 | 44720726b67b247071aba1c69f8bd16a7b3781ee | fix(config-server): trying to get global namespace before it created | [
{
"change_type": "MODIFY",
"old_path": "nodes/config-server/config-server.js",
"new_path": "nodes/config-server/config-server.js",
"diff": "@@ -212,6 +212,7 @@ module.exports = function(RED) {\ngetFromContext(key) {\nlet haCtx = this.context().global.get('homeassistant');\n+ haCtx = haCtx || {};\nreturn haCtx[this.nameAsCamelcase]\n? haCtx[this.nameAsCamelcase][key]\n: null;\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix(config-server): trying to get global namespace before it created |
748,234 | 25.05.2019 05:32:03 | 25,200 | 390257b7c5424b14a55a90278024cb9d1878f011 | chore: Added Type: Feature to exempt stale labels | [
{
"change_type": "MODIFY",
"old_path": ".github/stale.yml",
"new_path": ".github/stale.yml",
"diff": "@@ -7,6 +7,7 @@ exemptLabels:\n- \"Type: Bug\"\n- \"Type: Refactoring\"\n- \"Type: Documentation\"\n+ - \"Type: Feature\"\n# Label to use when marking an issue as stale\nstaleLabel: stale\n# Comment to post when marking an issue as stale. Set to `false` to disable\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore: Added Type: Feature to exempt stale labels |
748,234 | 26.05.2019 11:29:45 | 25,200 | 6785542582fdaa79ee01f37ed080ab6a6148c434 | style(call-server): Moved alt tags div location | [
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "<input type=\"text\" id=\"node-input-data\" />\n</div>\n+ <div class=\"form-row checkboxOption\">\n+ <input type=\"checkbox\" id=\"node-input-mustacheAltTags\"> \n+ <label for=\"node-input-mustacheAltTags\">Use alternative Mustache tags for the Data field</label>\n+ </div>\n+\n<div class=\"form-row\">\n<label for=\"node-input-mergecontext\">Merge Context</label>\n<input type=\"text\" id=\"node-input-mergecontext\" placeholder=\"lightOptions\"/>\n<input type=\"text\" id=\"node-input-output_location\" />\n</div>\n- <div class=\"form-row checkboxOption\">\n- <input type=\"checkbox\" id=\"node-input-mustacheAltTags\"> \n- <label for=\"node-input-mustacheAltTags\">Use alternative Mustache tags for the Data field</label>\n- </div>\n-\n<div id=\"service-data-desc\" class=\"form-row\">\n<h4>\nService: <span class=\"title\"></span>\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | style(call-server): Moved alt tags div location |
748,234 | 27.05.2019 03:06:50 | 25,200 | 78a27074a7273add0d4bee901dc5843c00e3abfd | fix: css fixes for 'if state' text boxes | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/ifstate.js",
"new_path": "nodes/_static/ifstate.js",
"diff": "@@ -8,12 +8,11 @@ var ifState = (function($) {\nif (!$input.hasClass('red-ui-typedInput')) return;\nlet width =\n- $input.parent('div').width() -\n- $('#node-input-halt_if_compare').width() -\n- 20.5;\n+ $('#node-input-name').width() -\n+ $('#node-input-halt_if_compare').outerWidth();\nif ($clearIfState.is(':visible')) {\n- width = width - $clearIfState.outerWidth(true) - 4;\n+ width = width - $clearIfState.outerWidth(true);\n}\n$input.typedInput('width', width);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: css fixes for 'if state' text boxes |
748,234 | 27.05.2019 04:52:22 | 25,200 | f91f023e8b25c0bf8797aaadde7d86e91921c4f7 | refactor(fire-event): moved input validation to Joi | [
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "+const Joi = require('@hapi/joi');\nconst BaseNode = require('../../lib/base-node');\nconst RenderTemplate = require('../../lib/mustache-context');\nmodule.exports = function(RED) {\nconst nodeOptions = {\n- debug: true,\nconfig: {\n+ name: {},\n+ server: { isNode: true },\nevent: {},\ndata: {},\n- mergecontext: {},\n- name: {},\n- server: { isNode: true }\n+ mergecontext: {}\n+ },\n+ input: {\n+ event: {\n+ messageProp: 'payload.event',\n+ configProp: 'event',\n+ validation: {\n+ haltOnFail: true,\n+ schema: Joi.string().label('event')\n+ }\n+ },\n+ data: {\n+ messageProp: 'payload.data',\n+ configProp: 'data',\n+ validation: {\n+ haltOnFail: false,\n+ schema: Joi.string().label('data')\n+ }\n+ }\n}\n};\n@@ -29,28 +47,29 @@ module.exports = function(RED) {\n}\n}\n- onInput({ message }) {\n- let payload, payloadEvent;\n-\n- if (message && message.payload) {\n- payload = this.tryToObject(message.payload);\n- payloadEvent = this.utils.selectn('event', payload);\n- }\n-\n- const configEvent = this.nodeConfig.event;\n- const eventType = payloadEvent || configEvent;\n+ onInput({ message, parsedMessage }) {\n+ const eventType = RenderTemplate(\n+ parsedMessage.event.value,\n+ message,\n+ this.node.context(),\n+ this.utils.toCamelCase(this.nodeConfig.server.name)\n+ );\nconst configData = RenderTemplate(\n- this.nodeConfig.data,\n+ typeof parsedMessage.data.value === 'object'\n+ ? JSON.stringify(parsedMessage.data.value)\n+ : parsedMessage.data.value,\nmessage,\nthis.node.context(),\nthis.utils.toCamelCase(this.nodeConfig.server.name)\n);\n- const eventData = this.getEventData(payload, configData);\n+ const eventData = this.getEventData(message.payload, configData);\nif (!eventType) {\n- throw new Error(\n- 'fire event node is missing \"event\" property, not found in config or payload'\n+ this.node.error(\n+ 'Fire event node is missing \"event\" property, not found in config or payload',\n+ message\n);\n+ return;\n}\nthis.debug(`Fire Event: ${eventType} -- ${JSON.stringify({})}`);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor(fire-event): moved input validation to Joi |
748,234 | 29.05.2019 07:23:41 | 25,200 | 9cf6b78c7dea3da07fef6b66c9d40e36e979fc9b | refactor: Renaming weboscket and http client | [
{
"change_type": "MODIFY",
"old_path": "lib/base-node.js",
"new_path": "lib/base-node.js",
"diff": "@@ -174,14 +174,14 @@ class BaseNode {\nsetConnectionStatus(state, additionalText) {\nlet connectionStatus;\nswitch (state) {\n- case this.eventsClient.CONNECTING:\n+ case this.websocketClient.CONNECTING:\nconnectionStatus = {\nshape: 'ring',\nfill: 'yellow',\ntext: 'connecting'\n};\nbreak;\n- case this.eventsClient.CONNECTED:\n+ case this.websocketClient.CONNECTED:\nconnectionStatus = {\nshape: 'dot',\nfill: 'green',\n@@ -221,19 +221,20 @@ class BaseNode {\nsuper.debug(...arguments);\n}\n- get eventsClient() {\n+ get httpClient() {\n+ return selectn('nodeConfig.server.http', this);\n+ }\n+\n+ get websocketClient() {\nreturn selectn('nodeConfig.server.websocket', this);\n}\nget isConnected() {\n- return (\n- this.eventsClient &&\n- this.eventsClient.connectionState === this.eventsClient.CONNECTED\n- );\n+ return this.websocketClient && this.websocketClient.isConnected;\n}\nget connectionState() {\n- return this.eventsClient && this.eventsClient.connectionState;\n+ return this.websocketClient && this.websocketClient.connectionState;\n}\ngetPrettyDate() {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/events-node.js",
"new_path": "lib/events-node.js",
"diff": "@@ -37,13 +37,13 @@ class EventsNode extends BaseNode {\naddEventClientListener({ event, handler }) {\nthis.listeners[event] = handler;\n- this.eventsClient.addListener(event, handler);\n+ this.websocketClient.addListener(event, handler);\n}\nonClose(nodeRemoved) {\n- if (this.eventsClient) {\n+ if (this.websocketClient) {\nObject.entries(this.listeners).forEach(([event, handler]) => {\n- this.eventsClient.removeListener(event, handler);\n+ this.websocketClient.removeListener(event, handler);\n});\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/ha-websocket.js",
"new_path": "lib/ha-websocket.js",
"diff": "@@ -22,6 +22,10 @@ class HaWebsocket extends EventEmitter {\nthis.setMaxListeners(0);\n}\n+ get isConnected() {\n+ return this.connectionState === this.CONNECTED;\n+ }\n+\nget CONNECTING() {\nreturn HaWebsocket.CONNECTING;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.js",
"new_path": "nodes/api/api.js",
"diff": "@@ -92,10 +92,7 @@ module.exports = function(RED) {\nconst node = this;\nconst config = node.nodeConfig;\n- if (\n- config.server.websocket.connectionState !==\n- config.server.websocket.CONNECTED\n- ) {\n+ if (!this.isConnected) {\nthis.setStatusFailed('No Connection');\nthis.error(\n'API call attempted without connection to server.',\n@@ -131,8 +128,8 @@ module.exports = function(RED) {\nreturn;\n}\n- apiCall = config.server.http[`_${method}`].bind(\n- config.server.http,\n+ apiCall = this.httpClient[`_${method}`].bind(\n+ this.httpClient,\npath,\ndata,\nparsedMessage.responseType.value\n@@ -150,8 +147,8 @@ module.exports = function(RED) {\nreturn null;\n}\n- apiCall = config.server.websocket.send.bind(\n- config.server.websocket,\n+ apiCall = this.websocketClient.send.bind(\n+ this.websocketClient,\njson\n);\n} catch (e) {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.js",
"new_path": "nodes/call-service/call-service.js",
"diff": "@@ -37,10 +37,7 @@ module.exports = function(RED) {\n}\nonInput({ message }) {\nconst config = this.nodeConfig;\n- if (\n- config.server.websocket.connectionState !==\n- config.server.websocket.CONNECTED\n- ) {\n+ if (!this.isConnected) {\nthis.setStatusFailed('No Connection');\nthis.error(\n'Call-Service attempted without connection to server.',\n@@ -107,7 +104,7 @@ module.exports = function(RED) {\nthis.setStatusSending();\n- return config.server.websocket\n+ return this.websocketClient\n.callService(apiDomain, apiService, apiData)\n.then(() => {\nthis.setStatusSuccess(`${apiDomain}.${apiService} called`);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.js",
"new_path": "nodes/fire-event/fire-event.js",
"diff": "@@ -81,7 +81,7 @@ module.exports = function(RED) {\nthis.setStatusSending();\n- return this.nodeConfig.server.http\n+ return this.httpClient\n.fireEvent(eventType, eventData)\n.then(() => {\nthis.setStatusSuccess(eventType);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.js",
"new_path": "nodes/get-history/get-history.js",
"diff": "@@ -101,23 +101,13 @@ module.exports = function(RED) {\nlet apiRequest =\nentityidtype.value === 'includes' && entityid\n- ? this.nodeConfig.server.http.getHistory(\n- startdate,\n- null,\n- enddate,\n- {\n+ ? this.httpClient.getHistory(startdate, null, enddate, {\nflatten: flatten,\ninclude: new RegExp(entityid)\n- }\n- )\n- : this.nodeConfig.server.http.getHistory(\n- startdate,\n- entityid,\n- enddate,\n- {\n+ })\n+ : this.httpClient.getHistory(startdate, entityid, enddate, {\nflatten: flatten\n- }\n- );\n+ });\nthis.setStatusSending('Requesting');\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.js",
"new_path": "nodes/render-template/render-template.js",
"diff": "@@ -80,7 +80,7 @@ module.exports = function(RED) {\nthis.setStatusSending('Requesting');\n- return this.nodeConfig.server.http\n+ return this.httpClient\n.renderTemplate(template.value)\n.then(res => {\nthis.setContextValue(\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.js",
"new_path": "nodes/wait-until/wait-until.js",
"diff": "@@ -93,6 +93,11 @@ module.exports = function(RED) {\nreturn null;\n}\n+ if (this.websocketClient) {\n+ Object.entries(this.listeners).forEach(([event, handler]) => {\n+ this.websocketClient.removeListener(event, handler);\n+ });\n+ }\nnode.savedMessage = message;\nnode.active = true;\nlet statusText = 'waiting';\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Renaming weboscket and http client |
748,234 | 29.05.2019 17:02:36 | 25,200 | 4cabac0742df833848f58befaa5c2e7a31c10f97 | refactor: more version indicators
added version-aware output labels for event-state, poll-state and current-state nodes
added custom color text for nodes who's version is not current | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.css",
"new_path": "nodes/_static/common.css",
"diff": "width: auto;\nmargin-right: 20px;\n}\n+\n+.node_label_legacy {\n+ fill: #fdfd96;\n+ stroke-width: 0;\n+ font-size: 14px;\n+ pointer-events: none;\n+ -webkit-touch-callout: none;\n+ -webkit-user-select: none;\n+ user-select: none;\n+ khtml-user-select: none;\n+ -moz-user-select: none;\n+ -ms-user-select: none;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.js",
"new_path": "nodes/_static/common.js",
"diff": "@@ -36,8 +36,31 @@ var nodeVersion = (function($) {\n}\n}\n+ function ifStateLabels(index) {\n+ if (this.halt_if || this.haltifstate) {\n+ if (this.version === 0 || this.version === undefined) {\n+ if (index === 0) return \"'If State' is false\";\n+ if (index === 1) return \"'If State' is true\";\n+ }\n+\n+ if (index === 0) return \"'If State' is true\";\n+ if (index === 1) return \"'If State' is false\";\n+ }\n+ }\n+\n+ function labelStyle() {\n+ return `${\n+ this._def.defaults.version &&\n+ Number(this.version) !== this._def.defaults.version.value\n+ ? 'node_label_legacy '\n+ : ''\n+ }${this.name ? 'node_label_italic' : ''}`;\n+ }\n+\nreturn {\ncheck,\n+ ifStateLabels,\n+ labelStyle,\nupdate\n};\n// eslint-disable-next-line no-undef\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/api/api.html",
"new_path": "nodes/api/api.html",
"diff": "label: function() {\nreturn this.name || \"API\";\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/call-service/call-service.html",
"new_path": "nodes/call-service/call-service.html",
"diff": "label: function() {\nreturn this.name || `svc: ${this.service_domain}:${this.service}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n- outputLabels: function(index) {\n- if (this.halt_if) {\n- if (index === 0) return \"'If State' is true\";\n- if (index === 1) return \"'If State' is false\";\n- }\n- },\n+ outputLabels: nodeVersion.ifStateLabels,\nicon: \"code.png\",\npaletteLabel: \"current state\",\nlabel: function() {\nreturn this.name || `current_state: ${this.entity_id}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-all/events-all.html",
"new_path": "nodes/events-all/events-all.html",
"diff": "label: function() {\nreturn this.name || `events: ${this.event_type || \"all\"}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\noneditprepare: function() {\nconst NODE = this;\nconst $server = $(\"#node-input-server\");\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/events-state-changed/events-state-changed.html",
"new_path": "nodes/events-state-changed/events-state-changed.html",
"diff": "RED.nodes.registerType(\"server-state-changed\", {\ncategory: \"home_assistant\",\ncolor: \"#038FC7\",\n+ inputs: 0,\n+ outputs: 1,\n+ outputLabels: nodeVersion.ifStateLabels,\n+ icon: \"arrow-right-bold-hexagon-outline.png\",\n+ paletteLabel: \"events: state\",\n+ label: function() {\n+ return (\n+ this.name || `state_changed: ${this.entityidfilter || \"all entities\"}`\n+ );\n+ },\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\noutputs: { value: 1 },\noutput_only_on_state_change: { value: true }\n},\n- inputs: 0,\n- outputs: 1,\n- outputLabels: function(index) {\n- if (this.haltifstate) {\n- if (index === 0) return \"'If State' is true\";\n- if (index === 1) return \"'If State' is false\";\n- }\n- },\n- icon: \"arrow-right-bold-hexagon-outline.png\",\n- paletteLabel: \"events: state\",\n- label: function() {\n- return (\n- this.name || `state_changed: ${this.entityidfilter || \"all entities\"}`\n- );\n- },\noneditprepare: function() {\nnodeVersion.check(this);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/fire-event/fire-event.html",
"new_path": "nodes/fire-event/fire-event.html",
"diff": "label: function() {\nreturn this.name || `Event: ${this.event}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-entities/get-entities.html",
"new_path": "nodes/get-entities/get-entities.html",
"diff": "label: function() {\nreturn this.name || \"get entities\";\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nserver: { value: \"\", type: \"server\", required: true },\nname: { value: \"\" },\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/get-history/get-history.html",
"new_path": "nodes/get-history/get-history.html",
"diff": "RED.nodes.registerType(\"api-get-history\", {\ncategory: \"home_assistant\",\ncolor: \"#52C0F2\",\n- defaults: {\n- name: { value: \"\" },\n- server: { value: \"\", type: \"server\", required: true },\n- startdate: { value: \"\" },\n- enddate: { value: \"\" },\n- entityid: { value: \"\" },\n- entityidtype: { value: \"\" },\n- useRelativeTime: { value: false },\n- relativeTime: { value: \"\" },\n- flatten: { value: true },\n- output_type: { value: \"array\" },\n- output_location_type: { value: \"msg\" },\n- output_location: { value: \"payload\" }\n- },\ninputs: 1,\noutputs: 1,\nicon: \"history.png\",\n}\nreturn \"get history\";\n},\n+ labelStyle: nodeVersion.labelStyle,\n+ defaults: {\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ startdate: { value: \"\" },\n+ enddate: { value: \"\" },\n+ entityid: { value: \"\" },\n+ entityidtype: { value: \"\" },\n+ useRelativeTime: { value: false },\n+ relativeTime: { value: \"\" },\n+ flatten: { value: true },\n+ output_type: { value: \"array\" },\n+ output_location_type: { value: \"msg\" },\n+ output_location: { value: \"payload\" }\n+ },\noneditprepare: function() {\nconst NODE = this;\nconst $entityIdField = $(\"#entity_id\");\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/poll-state/poll-state.html",
"new_path": "nodes/poll-state/poll-state.html",
"diff": "color: \"#038FC7\",\ninputs: 0,\noutputs: 1,\n+ outputLabels: nodeVersion.ifStateLabels,\nicon: \"timer.png\",\npaletteLabel: \"poll state\",\nlabel: function() {\nreturn this.name || `poll state: ${this.entity_id}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\nhalt_if: { value: \"\" },\nhalt_if_type: { value: \"str\" },\nhalt_if_compare: { value: \"is\" },\n- outputs: { value: 1 },\n- outputLabels: function(index) {\n- if (this.halt_if) {\n- if (index === 0) return \"'If State' is true\";\n- if (index === 1) return \"'If State' is false\";\n- }\n- }\n+ outputs: { value: 1 }\n},\noneditprepare: function() {\nnodeVersion.check(this);\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/render-template/render-template.html",
"new_path": "nodes/render-template/render-template.html",
"diff": "RED.nodes.registerType(\"api-render-template\", {\ncategory: \"home_assistant\",\ncolor: \"#52C0F2\",\n+ inputs: 1,\n+ outputs: 1,\n+ icon: \"parser-json.png\",\n+ paletteLabel: \"get template\",\n+ label: function() {\n+ return this.name || `template: ${this.template || \"\"}`;\n+ },\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\ntemplateLocation: { value: \"template\" },\ntemplateLocationType: { value: \"msg\" }\n},\n- inputs: 1,\n- outputs: 1,\n- icon: \"parser-json.png\",\n- paletteLabel: \"get template\",\n- label: function() {\n- return this.name || `template: ${this.template || \"\"}`;\n- },\n-\noneditprepare: function() {\nconst $server = $(\"#node-input-server\");\nconst utils = {\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/trigger-state/trigger-state.html",
"new_path": "nodes/trigger-state/trigger-state.html",
"diff": "RED.nodes.registerType(\"trigger-state\", {\ncategory: \"home_assistant\",\ncolor: \"#038FC7\",\n- defaults: {\n- name: { value: \"\" },\n- server: { value: \"\", type: \"server\", required: true },\n- entityid: { value: \"\", required: true },\n- entityidfiltertype: { value: \"exact\" },\n- debugenabled: { value: false },\n- constraints: { value: [] },\n- constraintsmustmatch: { value: \"all\" },\n- outputs: { value: 2 },\n- customoutputs: { value: [] },\n- outputinitially: { value: false },\n- state_type: { value: \"str\" }\n- },\ninputs: 1,\noutputs: 2,\noutputLabels: function(index) {\nlabel: function() {\nreturn this.name || `trigger-state: ${this.entityid}`;\n},\n+ labelStyle: nodeVersion.labelStyle,\n+ defaults: {\n+ name: { value: \"\" },\n+ server: { value: \"\", type: \"server\", required: true },\n+ entityid: { value: \"\", required: true },\n+ entityidfiltertype: { value: \"exact\" },\n+ debugenabled: { value: false },\n+ constraints: { value: [] },\n+ constraintsmustmatch: { value: \"all\" },\n+ outputs: { value: 2 },\n+ customoutputs: { value: [] },\n+ outputinitially: { value: false },\n+ state_type: { value: \"str\" }\n+ },\noneditprepare: function() {\n// Outputs List\nlet node = this;\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/wait-until/wait-until.html",
"new_path": "nodes/wait-until/wait-until.html",
"diff": "color: \"#52C0F2\",\ninputs: 1,\noutputs: 1,\n+ outputLabels: [\"\", \"timed out\"],\nicon: \"wait-until.png\",\npaletteLabel: \"wait until\",\nlabel: function() {\nreturn this.name || `wait until`;\n},\n- outputLabels: [\"\", \"timed out\"],\n+ labelStyle: nodeVersion.labelStyle,\ndefaults: {\nname: { value: \"\" },\nserver: { value: \"\", type: \"server\", required: true },\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: more version indicators
- added version-aware output labels for event-state, poll-state and current-state nodes
- added custom color text for nodes who's version is not current |
748,234 | 30.05.2019 18:32:28 | 25,200 | 92b4ef8b49c9031c25d351f07f6071b78b0c5026 | chore: Added node.js version to bug report template | [
{
"change_type": "MODIFY",
"old_path": ".github/ISSUE_TEMPLATE/Bug_report.md",
"new_path": ".github/ISSUE_TEMPLATE/Bug_report.md",
"diff": "@@ -26,6 +26,7 @@ If applicable, add an example of exported json of a flow exhibiting the issue to\n**Environment (please complete the following information):**\n- Node Red Version: [e.g. 0.19.5]\n+- Node.js Version: [e.g. 8.12.0]\n- NR Home Assistant Plugin Version: [e.g. 0.5.0]\n- Is Node Red running in Docker: [e.g. yes/no/hassio]\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | chore: Added node.js version to bug report template |
748,234 | 30.05.2019 21:01:36 | 25,200 | d3751d664bbc033f5573c9d2ce32d2fc7874eca4 | refactor: Make sure node version is a number | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.js",
"new_path": "nodes/_static/common.js",
"diff": "@@ -38,7 +38,7 @@ var nodeVersion = (function($) {\nfunction ifStateLabels(index) {\nif (this.halt_if || this.haltifstate) {\n- if (this.version === 0 || this.version === undefined) {\n+ if (Number(this.version) === 0 || this.version === undefined) {\nif (index === 0) return \"'If State' is false\";\nif (index === 1) return \"'If State' is true\";\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | refactor: Make sure node version is a number |
748,234 | 31.05.2019 14:49:19 | 25,200 | 9d46441db938c636d2c929062d9f4c9dd70b74b2 | feat(current-state): Added ability to block input overrides to config | [
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.html",
"new_path": "nodes/current-state/current-state.html",
"diff": "state_location: { value: \"payload\" },\noverride_payload: { value: \"msg\" }, // state location type\nentity_location: { value: \"data\" },\n- override_data: { value: \"msg\" } // entity location types\n+ override_data: { value: \"msg\" }, // entity location types\n+ blockInputOverrides: { value: false }\n},\noneditprepare: function() {\nnodeVersion.check(this);\n<input type=\"text\" id=\"node-input-entity_location\" />\n</div>\n- <div class=\"form-row\">\n- <input type=\"checkbox\" id=\"node-input-override_topic\" checked style=\"margin-left:105px;display:inline-block; width:auto; vertical-align:baseline;\"> \n- <label for=\"node-input-override_topic\" style=\"width: auto;margin-right: 20px;\">Override Topic</label>\n+ <div class=\"form-row checkboxOption\">\n+ <input type=\"checkbox\" id=\"node-input-override_topic\"> \n+ <label for=\"node-input-override_topic\">Override Topic</label>\n+ </div>\n+\n+ <div class=\"form-row checkboxOption\">\n+ <input type=\"checkbox\" id=\"node-input-blockInputOverrides\"> \n+ <label for=\"node-input-blockInputOverrides\">Block Input Overrides</label>\n</div>\n</script>\n<dt>Override Topic<span class=\"property-type\">boolean</span></dt>\n<dd>Write entity id to <code>msg.topic</code></dd>\n+\n+ <dt>Block Input Overrides<span class=\"property-type\">boolean</span></dt>\n+ <dd>Stop <code>msg.payload</code> values from overriding local config</dd>\n</dl>\n<h3>Outputs</h3>\n"
},
{
"change_type": "MODIFY",
"old_path": "nodes/current-state/current-state.js",
"new_path": "nodes/current-state/current-state.js",
"diff": "@@ -17,7 +17,8 @@ module.exports = function(RED) {\nentity_location: nodeDef => nodeDef.entity_location || 'data',\n// entity location type\noverride_data: nodeDef =>\n- nodeDef.override_data !== false ? 'msg' : 'none'\n+ nodeDef.override_data !== false ? 'msg' : 'none',\n+ blockInputOverrides: {}\n},\ninput: {\nentity_id: {\n@@ -39,7 +40,10 @@ module.exports = function(RED) {\n/* eslint-disable camelcase */\nasync onInput({ parsedMessage, message }) {\nconst config = this.nodeConfig;\n- const entityId = parsedMessage.entity_id.value;\n+ const entityId =\n+ config.blockInputOverrides === true\n+ ? config.entity_id\n+ : parsedMessage.entity_id.value;\nif (config.server === null) {\nthis.node.error('No valid server selected.', message);\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | feat(current-state): Added ability to block input overrides to config |
748,234 | 31.05.2019 16:39:19 | 25,200 | 22c645f209c67b40be74464f35ccfb8492f2a376 | fix: css change for node label | [
{
"change_type": "MODIFY",
"old_path": "nodes/_static/common.css",
"new_path": "nodes/_static/common.css",
"diff": "pointer-events: none;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\n- user-select: none;\n- khtml-user-select: none;\n+ -khtml-user-select: none;\n-moz-user-select: none;\n-ms-user-select: none;\n+ user-select: none;\n}\n"
}
] | TypeScript | MIT License | zachowj/node-red-contrib-home-assistant-websocket | fix: css change for node label |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.