node-red-contrib-zwave-js 6.2.0-beta.3 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # node-red-contrib-zwave-js Change Log
2
2
 
3
+ - 6.3.0
4
+
5
+ **Fixes**
6
+ - Fixed duplicated event handlers, after a new interview.
7
+
8
+ **New Features**
9
+ - Lock User Codes can now be optionally interviewed.
10
+ Note: This will cause an increase in traffic - especially if your lock has many codes to query.
11
+ - Opt-in to Soft Reset USB device.
12
+ This is needed for certain commands, like changing the RF.
13
+ - A new "UI Monitor", allowing you to capture/use the commands that are sent to the controller
14
+
15
+ **Changes**
16
+ - Changes to package content to reduce size (~9.0MB -> ~1.3MB)
17
+ - The node list is now sorted by Node ID
18
+ - Bump ZWJS to 8.5.1
19
+
3
20
  - 6.2.0
4
21
 
5
22
  **New Features**
@@ -10,13 +27,16 @@
10
27
 
11
28
  **Changes**
12
29
  - Bump serialport package.
30
+ - Bump zwave-js.
13
31
  - The node status on the UI, has been updated to make use of icons, as opposed to text
32
+ - A Complete overhaul on Help/guide material for each node
33
+ - **Data Mode** has been renamed to **Network Mode** on the device node
14
34
 
15
35
  **Internal Changes**
16
36
  - Improvements to driver event sanitization routines
17
37
  - Security enhancements to the HTTP API
18
38
  - Moved all HTTP API endpoints to the ui/server.js module
19
- - The **serialport** package is no longer forcibly compiled, and is left for serialport to decide
39
+ - The **serialport** package is no longer forcibly compiled, and is now left for serialport to decide
20
40
  if compilation is necessary.
21
41
 
22
42
  **Fixes**
package/README.md CHANGED
@@ -7,45 +7,59 @@
7
7
  [![Node Version](https://img.shields.io/node/v/node-red-contrib-zwave-js)](https://www.npmjs.com/package/node-red-contrib-zwave-js)
8
8
  [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/zwave-js/node-red-contrib-zwave-js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/zwave-js/node-red-contrib-zwave-js/context:javascript)
9
9
  [![Maintenance](https://img.shields.io/npms-io/maintenance-score/node-red-contrib-zwave-js)](https://www.npmjs.com/package/node-red-contrib-zwave-js)
10
- [![Dependencies](https://img.shields.io/david/marcus-j-davies/node-red-contrib-zwave-js)](https://www.npmjs.com/package/node-red-contrib-zwave-js)
10
+ [![Dependencies](https://img.shields.io/librariesio/release/npm/node-red-contrib-zwave-js/latest)](https://www.npmjs.com/package/node-red-contrib-zwave-js)
11
11
 
12
+ The most powerful/fully integrated Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, look no further.
12
13
 
13
- THE most powerful Z-Wave node for node-red based on Z-Wave JS.
14
- If you want a fully featured Z-Wave runtime in your node-red instance, look no further.
15
- <br />
16
- > ### ...node-red-contrib-zwave-js is _hands down the best zwave to node red option on the planet._
14
+ > ### ...node-red-contrib-zwave-js is _hands down the best Z-Wave to Node-RED option on the planet._
17
15
  > [@CRXPorter](https://github.com/crxporter), July 2021.
18
- <br />
19
16
 
20
- - 100% Javascript, so it's blazing fast and runs in the same memory space as your flows.
21
- - Does not require a build of any static library
22
- - Stable
23
- - Supports ZWave S0 and S2 Security
24
- - A Built in Node-Red User Interface tab:
25
- - Device Configuration
26
- - CC Value Updating
27
- - Association Management
28
- - Firmware Updating
29
- - Network Map
30
- - Network Actions (Include, Exclude, Heal etc etc)
31
- - 2 Different API models, catering for both experienced and inexperienced users.
32
- - Use one node for your entire network, or a node per Z-Wave device.
33
- - An extremely advanced filter node, to route zwave messages around your flow(s).
34
- - An extremely helpful command factory node, removing the need to learn the message format.
35
- - Supports multicast to send commands to mulltiple nodes at the same time.
36
- - Access to all supported CC's provided by Z-Wave JS.
17
+ ### What is it?
37
18
 
38
- **node-red-contrib-zwave-js** is based on [&#x1F517;Z-Wave JS](https://zwave-js.github.io/node-zwave-js/#/).
39
- Z-Wave JS is actively maintained, fast and supports S0 and S2 secure devices.
19
+ - Part of the awesome [Z-Wave JS](https://github.com/zwave-js) org
20
+ - 100% Javascript, so its blazing fast!
21
+ - Does not require a build of any static library
22
+ - Stable
23
+ - The Ability to capture commands for later use.
24
+ - A deep integrated UI within in node red
25
+ - Full Z-Wave control inside Node-RED including:
26
+ - Device inclusion/exclusion wizard
27
+ - S0 and S2 security support
28
+ - Network mesh graph
29
+ - Firmware updates
30
+ - Associations management
31
+ - Filter node for handling incoming messages from your devices
32
+ - Factory node for simplifying the formatting of outgoing messages
33
+ - Multicast command support
40
34
 
41
- It offers a massive amount of flexibility and is packed full of features.
42
- The node is straightforward to use, and removes all the complexities that you would otherwise need to deal with.
35
+ Since `node-red-contrib-zwave-js` is based on [Z-Wave JS](https://zwave-js.github.io/node-zwave-js/#/), we have the support and active maintenance from the amazing group of developers who have built the libraries, APIs, and config files which run this contrib.
43
36
 
44
- ![Image](./resources/Demo.png)
37
+ ### The User Interface
45
38
 
46
- - [Wiki](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/getting-started)
47
- - [Change Log](./CHANGELOG.md)
39
+ ![Image](./resources/ZWUI.gif)
48
40
 
41
+ Included with the contrib is a [user interface](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/User-Interface) where Z-Wave network management is handled. The controller side of the UI is used to include/exclude devices, heal the network, update firmware, and view the network map for diagnosing problems. The device side of the UI is used to configure devices, manage associations, and provide setup help for the nodes which will be used in your flows.
49
42
 
43
+ ### The Nodes
50
44
 
45
+ ![Image](./resources/Demo.png)
51
46
 
47
+ There are 4 node types included with this contrib ([click here](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/node-types) for full details about these nodes)
48
+ - `zwave-js`: this node is used to set up a connection to your USB Z-Wave controller, set security keys, and manage various advanced controller options
49
+ - `zwave-device`: this node is used to send and receive messages to one or more of the Z-Wave devices on your network
50
+ - `event-filter`: this node is used to filter and sort messages from your Z-Wave devices
51
+ - `cmd-factory`: this node simplifies creation of messages being sent to your Z-Wave devices
52
+
53
+ ### Getting Started Links
54
+ - [Installing](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/getting-started): system requirements and install instructions
55
+ - [Just Show Me How](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/First-Z-Wave-Flow-Setup): first day walkthrough
56
+ - [Wiki](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/getting-started): just about everything
57
+ - [Change Log](./CHANGELOG.md): whats changed?
58
+
59
+ ### Awesome People - Thanks!
60
+
61
+ - [marcus-j-davies](https://github.com/marcus-j-davies) our main developer who claims "*my software doesn't have bugs*"
62
+ - [AlCalzone](https://github.com/AlCalzone) for creating [ZWave-JS](https://github.com/zwave-js/node-zwave-js) that makes this possible
63
+ - [hufftheweevil](https://github.com/hufftheweevil) for creating the User Interface tab
64
+ - [CRXPorter](https://github.com/crxporter) for creating all the help material/finding this project
65
+ - [thk](https://github.com/thk-socal) for the relentless beta testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-zwave-js",
3
- "version": "6.2.0-beta.3",
3
+ "version": "6.3.0",
4
4
  "license": "MIT",
5
5
  "description": "An extremely powerful, easy to use, and feature rich Z-Wave node for Node Red, based on Z-Wave JS.",
6
6
  "dependencies": {
@@ -10,10 +10,10 @@
10
10
  "serialport": "9.2.4",
11
11
  "winston": "^3.3.3",
12
12
  "winston-transport": "^4.4.0",
13
- "zwave-js": "^8.4.1"
13
+ "zwave-js": "^8.5.1"
14
14
  },
15
15
  "devDependencies": {
16
- "eslint": "^7.32.0",
16
+ "eslint": "^8.0.1",
17
17
  "prettier": "^2.4.1"
18
18
  },
19
19
  "engines": {
@@ -31,9 +31,9 @@
31
31
 
32
32
  const URL =
33
33
  'https://zwave-js.github.io/node-zwave-js/#/api/CCs/' +
34
- $('#node-input-cc').find(':selected').text().trim().replace(/ /g, '') +
34
+ $('#node-input-cc').val().replace(/ /g, '') +
35
35
  '?id=' +
36
- $('#node-input-method').find(':selected').text().trim().toLowerCase();
36
+ $('#node-input-method').val().toLowerCase();
37
37
  var link = document.createElement('a');
38
38
  link.href = URL;
39
39
  link.setAttribute('target', '_blank');
@@ -91,23 +91,25 @@
91
91
  }
92
92
 
93
93
  function GetMethods(cb) {
94
- const CC = $('#node-input-cc').find(':selected').text().trim();
95
- $.getJSON('zwave-js/cfg-cclist/' + CC.replace(/ /g, '-'), (data) => {
96
- $('#node-input-method').empty();
97
- $('#node-input-method').append(
98
- new Option('Select Method', 'Select Method')
99
- );
100
- data.forEach((M) => {
101
- $('#node-input-method').append(new Option(M, M));
94
+ const CC = $('#node-input-cc').val();
95
+ if (CC) {
96
+ $.getJSON('zwave-js/cfg-cclist/' + CC.replace(/ /g, '-'), (data) => {
97
+ $('#node-input-method').empty();
98
+ $('#node-input-method').append(
99
+ new Option('Select Method', 'Select Method')
100
+ );
101
+ data.forEach((M) => {
102
+ $('#node-input-method').append(new Option(M, M));
103
+ });
104
+ if (typeof cb === 'function') {
105
+ cb();
106
+ }
102
107
  });
103
- if (typeof cb === 'function') {
104
- cb();
105
- }
106
- });
108
+ }
107
109
  }
108
110
 
109
111
  function SortAPI(Value) {
110
- const API = Value || $('#node-input-api').find(':selected').text().trim();
112
+ const API = Value || $('#node-input-api').val();
111
113
  switch (API) {
112
114
  case 'CCAPI':
113
115
  $("[forapi='ValueAPI']").css({ display: 'none' });
@@ -124,13 +126,6 @@
124
126
 
125
127
  <script type="text/x-red" data-template-name="cmd-factory">
126
128
 
127
- <p>
128
- All JSONata expressions are based on the root path of <strong>msg</strong>,
129
- <br />i.e specifying <strong>payload</strong> will yield the object stored at <strong>msg.payload</strong><br /
130
- </p>
131
- <p>
132
- <strong>Basic Settings.</strong>
133
- </p>
134
129
  <div class="form-row">
135
130
  <label for="node-input-name" style="width:130px"><i class="fa fa-pencil"></i> Name</label>
136
131
  <input type="text" id="node-input-name" placeholder="ZWave CMD Factory">
@@ -143,10 +138,10 @@
143
138
  </select>
144
139
  </div>
145
140
  <p forapi="ValueAPI">
146
- <strong>ValueAPI Command Settings.</strong>
141
+ <strong>ValueAPI Command Settings</strong>
147
142
  </p>
148
143
  <div class="form-row" forapi="ValueAPI">
149
- <label for="node-input-vapiMode" style="width:130px"><i class="fa fa-pencil"></i> Mode</label>
144
+ <label for="node-input-vapiMode" style="width:130px"><i class="fa fa-pencil"></i> Method</label>
150
145
  <select id="node-input-vapiMode">
151
146
  <option value="setValue">Set</option>
152
147
  <option value="getValue">Get</option>
@@ -157,7 +152,7 @@
157
152
  <input style="width:50px" type="text" id="node-input-vapiValueId" placeholder="valueId">
158
153
  </div>
159
154
  <p forapi="CCAPI">
160
- <strong>Command Class.</strong>
155
+ <strong>Command Class</strong>
161
156
  </p>
162
157
  <div class="form-row" forapi="CCAPI">
163
158
  <label for="node-input-cc" style="width:130px"><i class="fa fa-pencil"></i> CC</label>
@@ -170,7 +165,7 @@
170
165
  <select style="margin-bottom:5px" id="node-input-method">
171
166
  <option value="Select Method">Select Method</option>
172
167
  </select><br />
173
- <a style="margin-left:135px" onclick="GoToInfo()" href="#">View Parameter Definition</a>
168
+ <a style="margin-left:135px; color: blue;text-decoration: underline;" onclick="GoToInfo()" href="#">View Parameter Definition</a>
174
169
  </div>
175
170
  <div class="form-row" forapi="CCAPI">
176
171
  <label for="node-input-noEvent" style="width:130px"><i class="fa fa-pencil"></i> Await Result (Get)</label>
@@ -181,7 +176,7 @@
181
176
  <input style="width:50px" type="text" id="node-input-forceUpdate" placeholder="forceUpdate">
182
177
  </div>
183
178
  <p>
184
- <strong>Command Parameters.</strong>
179
+ <strong>Command Parameters</strong>
185
180
  </p>
186
181
  <div class="form-row">
187
182
  <label for="node-input-node" style="width:130px"><i class="fa fa-pencil"></i> Node</label>
@@ -203,20 +198,51 @@
203
198
  <label for="node-input-vapiValue" style="width:130px"><i class="fa fa-pencil"></i> Value</label>
204
199
  <input style="width:50px" type="text" id="node-input-vapiValue" placeholder="payload">
205
200
  </div>
201
+ <div class="form-tips" id="node-tip">
202
+ All JSONata expressions are based on the root path of <code>msg</code>, i.e specifying <code>payload</code> will yield the object stored at <code>msg.payload</code>.
203
+ </div>
206
204
  </script>
207
205
 
208
- <script type="text/x-red" data-help-name="cmd-factory">
209
- <p>A Command generator node.</p>
206
+ <!-- prettier-ignore -->
207
+ <script type="text/markdown" data-help-name="cmd-factory">
208
+ <p>A Z-Wave command generator node.</p>
209
+
210
+ The `cmd-factory` node is used to formulate messages which are ready to be sent to your Z-Wave device nodes. Messages output from this node should be passed directly to the Input of a `zwave-device` or `zwave-js` node. Details and examples are available on [this](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Command-Factory) wiki page.
210
211
 
211
- <p>
212
- <code>Input:</code><br />
213
- A <strong>msg</strong> object that is to be used as inputs to the command.
212
+ <div class="form-tips" id="node-tip">
213
+ Fields labeled with the symbol <img src="red/images/typedInput/expr.svg" style="margin-right: 4px;height: 18px;"> must be either valid <a href="http://jsonata.org/" target="_blank">JSONata</a> expressions or left empty if not used.
214
+ </div>
214
215
 
215
- </p>
216
+ ### Setup
216
217
 
217
- <p>
218
- <code>Output:</code><br />
219
- A <strong>payload</strong> containing a valid zwave command.
218
+ The node can formulate messages to a Z-Wave device using either [Value API](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Value-API) or [CC API](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/CC-API). Little to no knowledge of the inner workings of Z-Wave JS are needed in order to use this node.
220
219
 
221
- </p>
220
+ Generally it is recommended to use the `CCAPI` option, as it is simpler to put together the commands.
221
+
222
+
223
+ ### Command Class (CCAPI)
224
+
225
+ Please choose the `CC` which you would like to control (see the UI on your device to learn which it supports). Choose the `Method` which corresponds to the message you are wanting to send.
226
+
227
+ `Await Result (Get)` Some CC **Get** type methods do not return a value via the event mechanism. Therefore, we need to wait for the value as part of the command instead of depending on an event.
228
+
229
+ `Force Update` causes a poll on the property contained in this object (it must evaluate to a partial ValueID). This is needed if your target device does not acknowledge a recently updated value.
230
+
231
+ ### ValueAPI Command Settings (ValueAPI)
232
+
233
+ Please choose the `Method` which you would like to use, either setting a value or retrieving a value.
234
+
235
+ `ValueID` should evaluate to a valid Value ID. Value ID's can be viewed by double clicking a value title in the UI.
236
+
237
+ ### Command Parameters
238
+
239
+ `Node` - this field should evaluate to an integer which will determine to which node the output message is sent. This may evaluate to `undefined` if you are sending to a device node set to `Specific Node`, `Multicast`, or `Multiple Nodes`.
240
+
241
+ `Endpoint` - this field should evaluate to an integer which matches your device endpoint.
242
+
243
+ `Params` (CCAPI) - this field should evaluate to an array containing the parameters for your selected `Method` under **Command Class**. Click the link "View Parameter Definition" for details on how the specific Params array should be formatted for this message.
244
+
245
+ `Set Options` (ValueAPI) - this value should evaluate to an object specifying parameters around your **Set** operation, i.e setting a duration for a brightness change being one example.
246
+
247
+ `Value` (ValueAPI) - this field should evaluate to the value you are providing. It is only required for the **Set** method
222
248
  </script>
@@ -70,23 +70,22 @@ module.exports = function (RED) {
70
70
  Value = RED.util.evaluateJSONataExpression(EXP, msg);
71
71
  }
72
72
 
73
- if (typeof ValueID !== 'object') {
74
- throw new Error(
75
- '[ValueID] does not evaluate to an object. Evaluated type: ' +
76
- typeof ValueID
77
- );
73
+ if (ValueID === undefined) {
74
+ throw new Error('[ValueID] is missing.');
75
+ } else if (typeof ValueID !== 'object' || Array.isArray(ValueID)) {
76
+ throw new Error('[ValueID] does not evaluate to an object.');
78
77
  }
78
+
79
79
  if (Endpoint !== undefined) {
80
80
  ValueID.endpoint = Endpoint;
81
81
  }
82
82
  if (config.vapiMode === 'setValue' && Value === undefined) {
83
83
  throw new Error('[Value] is missing');
84
84
  }
85
- if (Options !== undefined && typeof Options !== 'object') {
86
- throw new Error(
87
- '[Set Options] do not evaluate to an object. Evaluated type: ' +
88
- typeof Options
89
- );
85
+ if (Options !== undefined) {
86
+ if (typeof Options !== 'object' || Array.isArray(Options)) {
87
+ throw new Error('[Set Options] do not evaluate to an object.');
88
+ }
90
89
  }
91
90
 
92
91
  const RM = {};
@@ -149,17 +148,16 @@ module.exports = function (RED) {
149
148
  ForceUpdate = RED.util.evaluateJSONataExpression(EXP, msg);
150
149
  }
151
150
 
152
- if (Params !== undefined && !Array.isArray(Params)) {
153
- throw new Error(
154
- '[Params] do not evaluate to an array. Evaluated type: ' +
155
- typeof Params
156
- );
151
+ if (Params !== undefined) {
152
+ if (!Array.isArray(Params)) {
153
+ throw new Error('[Params] do not evaluate to an array.');
154
+ }
157
155
  }
158
- if (ForceUpdate !== undefined && typeof ForceUpdate !== 'object') {
159
- throw new Error(
160
- '[Force Update] does not evaluate to an object. Evaluated type: ' +
161
- typeof ForceUpdate
162
- );
156
+
157
+ if (ForceUpdate !== undefined) {
158
+ if (typeof ForceUpdate !== 'object' || Array.isArray(ForceUpdate)) {
159
+ throw new Error('[Force Update] does not evaluate to an object.');
160
+ }
163
161
  }
164
162
 
165
163
  const RM = {};
@@ -258,30 +258,32 @@
258
258
  <input type="text" id="node-input-name" placeholder="Filter Name">
259
259
  </div>
260
260
 
261
- <p>
262
- Add your filter sets below.<br />
263
- each set of filters, becomes an output pin.<br /><br />
264
- A filter set can include the event(s) to be filtered, and optionally ValueID(s)
265
- </p>
266
-
267
261
  <div>
268
262
  <ol id="filtersets" style="min-height:450px;min-width:400px"> </ol>
269
263
  </div>
270
264
  </script>
271
265
 
272
- <script type="text/x-red" data-help-name="event-filter">
273
- <p>A Z-Wave event filter.</p>
266
+ <!-- prettier-ignore -->
267
+ <script type="text/markdown" data-help-name="event-filter">
268
+ <p>A Z-Wave event filter.</p>
269
+
270
+ This node allows advanced filtration of the various value events that a node may send. It further allows filtering the type of data that was updated i.e. a Motion Event, Air Temp changes, Door Sensors, etc.
271
+
272
+ The UI panel on the right can be used to provide the filter values, removing the need to write them yourself, but of course you can use manual entries if you prefer. Please visit our [event filter](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Event-Filter-Node) wiki page for a detailed walkthrough on how to set up your filters.
273
+
274
+ Essentially this node is a `switch` node with specific sorting for the values found in Z-Wave messages. The Input of this node should be from a `zwave-js` node or a `zwave-device` node.
275
+
276
+ ### Message Handling
277
+
278
+ Inputs are unfiltered Z-Wave messages. The filter settings are used to decide if the message will be output from the node. The message will be output on the pin corresponding to the matched filter set. If there is a match, the node will stop searching for additional matches. If there is no match, the input message will stop with this node and nothing will be output.
279
+
280
+ ### Filter Options
274
281
 
275
- <p>
276
- <code>Input:</code><br />
277
- A <strong>payload</strong> object from the controller or device-node to be processed.<br />
282
+ **Name** - is a name for your filter. The output pin will match this name, and will be included in the output as `msg.filter.name`.
278
283
 
279
- </p>
284
+ **ValueIDs** - can include zero or more Value IDs for this filter set. Value IDs may be added using the UI or manually. See our [event filter](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Event-Filter-Node) wiki page for more details.
280
285
 
281
- <p>
282
- <code>Output:</code><br />
283
- A <strong>payload</strong> containing the event if it had a matching rule.<br />
284
- A <strong>filter</strong> object will also be provided, that denotes the matched rule.
286
+ **Strict** - if checked it will require the `Endpoint` property of the Input message to match the selected ValueIDs.
285
287
 
286
- </p>
288
+ **Events** - the four event types which may be output from a Z-Wave Device. At least one must be selected for any message to be output. See details about these events on [this](https://github.com/zwave-js/node-red-contrib-zwave-js/wiki/Payload-Messaging-Format) wiki page.
287
289
  </script>