@ncd-io/node-red-enterprise-sensors 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,13 +1,15 @@
1
- # NCD-RED-Enterprise
1
+ # @ncd-io/node-red-enterprise-sensors
2
2
 
3
- To install navigate inside .node-red directory on a computer with Node-Red already installed. Then run command npm install ncd-red-enerprise-sensors. To update run command npm update ncd-red-enerprise-sensors.
3
+ You can install this library through the Palette Manager in Node-Red's UI.
4
+
5
+ To install through the command line navigate inside .node-red directory on a computer with Node-Red already installed. Then run command npm install ncd-red-enerprise-sensors. To update run command npm update ncd-red-enerprise-sensors.
4
6
 
5
7
  Standard install commands:
6
8
  * cd ~/.node-red
7
- * npm install ncd-red-enterprise-sensors
9
+ * npm install @ncd-io/node-red-enterprise-sensors
8
10
 
9
11
  Standard update commands:
10
12
  * cd ~/.node-red
11
- * npm update ncd-red-enterprise-sensors
13
+ * npm update @ncd-io/node-red-enterprise-sensors
12
14
 
13
15
  This library handles communication to, and configuration of, the [NCD Wireless Sensor Line](https://ncd.io/wireless-enterprise-line/). It can be used in [conjunction with Node-RED](https://ncd.io/node-red-wireless-sensors/) to create and manage a Wireless Sensor Network using the Node-RED flow-based development tool on any platform. For specific examples of different sensor types using this package, check out the resources tab of the [appropriate product page](https://store.ncd.io/?fwp_main_facet=enterprise-solutions). If you cannot find an example, or need further assistance, check out the [Node-RED section of our forum](https://community.ncd.io/c/node-red).
@@ -741,6 +741,14 @@ module.exports = class WirelessSensor{
741
741
  var packet = [244, 4, 0, 0, 0, reading_type];
742
742
  return this.config_send(sensor_mac, packet);
743
743
  }
744
+ config_set_motion_threshold_46(sensor_mac, value){
745
+ console.log('config_set_motion_threshold_46');
746
+ let packet = [244, 1, 0, 0, 0];
747
+ let threshold = int2Bytes((value), 4);
748
+ packet.push(...threshold);
749
+ console.log(packet);
750
+ return this.config_send(sensor_mac, packet);
751
+ }
744
752
 
745
753
  config_set_sensor_forced_calibration(sensor_mac, value){
746
754
  var packet = [244, 31, 0, 0, 0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncd-io/node-red-enterprise-sensors",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wireless.html CHANGED
@@ -320,6 +320,9 @@
320
320
 
321
321
  payload_length_80_active:{value:""},
322
322
  payload_length_80:{value:3, validate: NCD_validators.number_range(0, 3)},
323
+
324
+ motion_threshold_46_active:{value:""},
325
+ motion_threshold_46:{value: 100, validate: NCD_validators.number_range(0, 4294967295)},
323
326
  },
324
327
  inputs: 0,
325
328
  outputs: 1,
@@ -1574,6 +1577,20 @@
1574
1577
  </div>
1575
1578
  </div>
1576
1579
  </div>
1580
+ <div class="ncd-dependent" data-sensor-46>
1581
+ <hr>
1582
+ <div class="form-row ncd-active-check">
1583
+ <strong>Motion Threshold</strong>
1584
+ <div>
1585
+ <label for="node-input-motion_threshold_46_active">Active:</label>
1586
+ <input type="checkbox" id="node-input-motion_threshold_46_active" class="ncd-config-toggle" data-target-id="node-input-motion_threshold_46" value="1">
1587
+ </div>
1588
+ <div>
1589
+ <label for="node-input-motion_threshold_46"><i class="icon-tag"></i>Value:</label>
1590
+ <input type="text" id="node-input-motion_threshold_46" placeholder="0-4294967295" value="100">
1591
+ </div>
1592
+ </div>
1593
+ </div>
1577
1594
  <div class="ncd-dependent" data-sensor-10000 data-sensor-10012>
1578
1595
  <div class="form-row">
1579
1596
  <button id="config_sensor">Configure Now</button>
package/wireless.js CHANGED
@@ -430,6 +430,11 @@ module.exports = function(RED) {
430
430
  promises.sensor_boot_time_420ma = node.config_gateway.config_set_sensor_boot_time_420ma(mac, parseInt(config.sensor_boot_time_420ma));
431
431
  }
432
432
  break;
433
+ case 46:
434
+ if(config.motion_threshold_46_active){
435
+ promises.motion_threshold_46 = node.config_gateway.config_set_motion_threshold_46(mac, parseInt(config.motion_threshold_46));
436
+ }
437
+ break;
433
438
  case 47:
434
439
  if(config.roll_angle_threshold_47_active){
435
440
  promises.roll_angle_threshold_47 = node.config_gateway.config_set_roll_threshold_47(mac, parseInt(config.roll_angle_threshold_47));
@@ -1164,7 +1169,8 @@ module.exports = function(RED) {
1164
1169
  RED.httpAdmin.get("/ncd/wireless/needs_input/:id", RED.auth.needsPermission('tcp.read'), function(req,res) {
1165
1170
  var node = RED.nodes.getNode(req.params.id);
1166
1171
  if (node != null) {
1167
- return {needs_input: node.raw_input};
1172
+ res.json({needs_input: node.raw_input});
1173
+ // return {needs_input: node.raw_input};
1168
1174
  } else {
1169
1175
  res.json({needs_input: false});
1170
1176
  }