@ncd-io/node-red-enterprise-sensors 2.0.1 → 2.0.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.
@@ -4009,7 +4009,21 @@ function sensor_types(parent){
4009
4009
  var types = {
4010
4010
  '2': {
4011
4011
  name: '2 Channel Push Notification',
4012
- parse: (d) => {
4012
+ parse: (d, payload) => {
4013
+ let firmware = payload[1];
4014
+ if(firmware > 5){
4015
+ let report_type_byte = (payload[7] >> 5) & 1;
4016
+ let report_type = "";
4017
+ switch(report_type_byte){
4018
+ case 0: report_type = 'Regular'; break;
4019
+ case 1: report_type = 'Interrupt'; break;
4020
+ }
4021
+ return{
4022
+ report_type: report_type,
4023
+ input_1: d[0],
4024
+ input_2: d[1]
4025
+ }
4026
+ }
4013
4027
  return {
4014
4028
  input_1: d[0],
4015
4029
  input_2: d[1]
@@ -1483,8 +1483,10 @@ module.exports = (globalDevices, emitter) => {
1483
1483
  } else {
1484
1484
  probe = 1;
1485
1485
  }
1486
-
1487
- if (globalDevices.hasOwnProperty(deviceAddr) || expected_packets == 1) {
1486
+ if(!Object.hasOwn(globalDevices, deviceAddr)){
1487
+ globalDevices[deviceAddr] = {};
1488
+ }
1489
+ if (globalDevices[deviceAddr].hasOwnProperty(probe) || expected_packets == 1) {
1488
1490
  if (expected_packets != 1) {
1489
1491
  if (globalDevices[deviceAddr][probe].last_packet_counter == current_packet) {
1490
1492
  console.log('Duplicated message');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncd-io/node-red-enterprise-sensors",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {