node-red-contrib-homebridge-automation 0.0.86-beta.2 → 0.0.86

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/HAP-NodeRed.js CHANGED
@@ -4,12 +4,12 @@ var Queue = require('better-queue');
4
4
  var Homebridges = require('./lib/Homebridges.js').Homebridges;
5
5
  var HAPNodeJSClient = require('hap-node-client').HAPNodeJSClient;
6
6
 
7
- module.exports = function(RED) {
7
+ module.exports = function (RED) {
8
8
  var evDevices = [];
9
9
  var ctDevices = [];
10
10
  var hbDevices;
11
11
  var homebridge;
12
- var reqisterQueue = new Queue(function(node, cb) {
12
+ var reqisterQueue = new Queue(function (node, cb) {
13
13
  _register.call(node.that, node, cb);
14
14
  }, {
15
15
  concurrent: 1,
@@ -43,12 +43,12 @@ module.exports = function(RED) {
43
43
  homebridge = new HAPNodeJSClient({
44
44
  "pin": n.username,
45
45
  "refresh": 900,
46
- "debug": true,
46
+ "debug": false,
47
47
  "timeout": 20,
48
48
  "reqTimeout": 7000
49
49
  });
50
50
  reqisterQueue.pause();
51
- homebridge.on('Ready', function(accessories) {
51
+ homebridge.on('Ready', function (accessories) {
52
52
  // evDevices = register.registerEv(homebridge, accessories);
53
53
  // ctDevices = register.registerCt(homebridge, accessories);
54
54
  hbDevices = new Homebridges(accessories);
@@ -105,11 +105,11 @@ module.exports = function(RED) {
105
105
 
106
106
  var node = this;
107
107
 
108
- this.connect = function(callback) {
108
+ this.connect = function (callback) {
109
109
  callback();
110
110
  };
111
111
 
112
- this.register = function(deviceNode, callback) {
112
+ this.register = function (deviceNode, callback) {
113
113
  debug("hbConf.register", deviceNode.fullName);
114
114
  node.users[deviceNode.id] = deviceNode;
115
115
  debug("Register %s -> %s", deviceNode.type, deviceNode.fullName);
@@ -124,7 +124,7 @@ module.exports = function(RED) {
124
124
  // debug("Register Queue - push", reqisterQueue.getStats());
125
125
  };
126
126
 
127
- this.deregister = function(deviceNode, callback) {
127
+ this.deregister = function (deviceNode, callback) {
128
128
  deviceNode.status({
129
129
  text: 'disconnected',
130
130
  shape: 'ring',
@@ -134,14 +134,14 @@ module.exports = function(RED) {
134
134
  //
135
135
  // debug("hbEvent deregistered:", deviceNode.name);
136
136
  // if (homebridge.listenerCount(deviceNode.eventName)) {
137
- deviceNode.eventName.forEach(function(event) {
137
+ deviceNode.eventName.forEach(function (event) {
138
138
  homebridge.removeListener(event, deviceNode.listener);
139
139
  });
140
140
  // }
141
141
  callback();
142
142
  };
143
143
 
144
- this.on('close', function() {
144
+ this.on('close', function () {
145
145
  if (node.client && node.client.connected) {
146
146
  node.client.end();
147
147
  }
@@ -177,7 +177,7 @@ module.exports = function(RED) {
177
177
 
178
178
  var node = this;
179
179
 
180
- node.command = function(event) {
180
+ node.command = function (event) {
181
181
  // False messages can be received from accessories with multiple services
182
182
  // if (Object.keys(_convertHBcharactericToNode(event, node)).length > 0) {
183
183
  debug("hbEvent", node.name, event);
@@ -199,7 +199,7 @@ module.exports = function(RED) {
199
199
  fill: 'green'
200
200
  });
201
201
  clearTimeout(node.timeout);
202
- node.timeout = setTimeout(function() {
202
+ node.timeout = setTimeout(function () {
203
203
  node.status({});
204
204
  }, 10 * 1000);
205
205
  node.send(msg);
@@ -219,7 +219,7 @@ module.exports = function(RED) {
219
219
  };
220
220
  // };
221
221
 
222
- node.conf.register(node, function() {
222
+ node.conf.register(node, function () {
223
223
  debug("hbEvent.register", node.fullName);
224
224
  this.hbDevice = hbDevices.findDevice(node.device, {
225
225
  perms: 'pr'
@@ -230,7 +230,7 @@ module.exports = function(RED) {
230
230
 
231
231
  _status(node.device, node, {
232
232
  perms: 'ev'
233
- }, function(err, message) {
233
+ }, function (err, message) {
234
234
  if (!err) {
235
235
  node.state = _convertHBcharactericToNode(message.characteristics, node);
236
236
  debug("hbEvent received: %s = %s", node.fullName, JSON.stringify(message.characteristics), node.state);
@@ -251,7 +251,7 @@ module.exports = function(RED) {
251
251
  fill: 'green'
252
252
  });
253
253
  clearTimeout(node.timeout);
254
- node.timeout = setTimeout(function() {
254
+ node.timeout = setTimeout(function () {
255
255
  node.status({});
256
256
  }, 10 * 1000);
257
257
  node.send(msg);
@@ -265,7 +265,7 @@ module.exports = function(RED) {
265
265
  node.eventName = [];
266
266
  // node.eventName = this.hbDevice.host + this.hbDevice.port + this.hbDevice.aid;
267
267
  // debug("DEVICE", this.hbDevice);
268
- this.hbDevice.eventRegisters.forEach(function(event) {
268
+ this.hbDevice.eventRegisters.forEach(function (event) {
269
269
  homebridge.on(node.hbDevice.id + event.aid + event.iid, node.command);
270
270
  node.eventName.push(node.hbDevice.id + event.aid + event.iid);
271
271
  });
@@ -280,7 +280,7 @@ module.exports = function(RED) {
280
280
  }
281
281
  }.bind(this));
282
282
 
283
- node.on('close', function(callback) {
283
+ node.on('close', function (callback) {
284
284
  node.conf.deregister(node, callback);
285
285
  });
286
286
  }
@@ -325,7 +325,8 @@ module.exports = function(RED) {
325
325
  On: false
326
326
  };
327
327
 
328
- node.on('input', function(msg) {
328
+ node.on('input', function (msg) {
329
+ this.msg = msg;
329
330
  debug("hbResume.input: %s input", node.fullName, JSON.stringify(msg));
330
331
  if (typeof msg.payload === "object") {
331
332
  // Using this to validate input message contains valid Accessory Characteristics
@@ -370,7 +371,7 @@ module.exports = function(RED) {
370
371
  fill: 'green'
371
372
  });
372
373
  clearTimeout(node.timeout);
373
- node.timeout = setTimeout(function() {
374
+ node.timeout = setTimeout(function () {
374
375
  node.status({});
375
376
  }, 10 * 1000);
376
377
  node.lastMessageValue = newMsg.payload;
@@ -379,7 +380,7 @@ module.exports = function(RED) {
379
380
  node.lastPayload = JSON.parse(JSON.stringify(msg.payload)); // store value not reference
380
381
  }
381
382
  } else {
382
- node.error("Homebridge not initialized");
383
+ node.error("Homebridge not initialized", this.msg);
383
384
  node.status({
384
385
  text: 'Homebridge not initialized',
385
386
  shape: 'ring',
@@ -387,7 +388,7 @@ module.exports = function(RED) {
387
388
  });
388
389
  }
389
390
  } else {
390
- node.error("Payload should be an JSON object containing device characteristics and values, ie {\"On\":false, \"Brightness\":0 }\nValid values include: " + node.hbDevice.descriptions);
391
+ node.error("Payload should be an JSON object containing device characteristics and values, ie {\"On\":false, \"Brightness\":0 }\nValid values include: " + node.hbDevice.descriptions, this.msg);
391
392
  node.status({
392
393
  text: 'Invalid payload',
393
394
  shape: 'ring',
@@ -396,7 +397,7 @@ module.exports = function(RED) {
396
397
  }
397
398
  });
398
399
 
399
- node.command = function(event) {
400
+ node.command = function (event) {
400
401
  // debug("hbResume received event: %s ->", node.fullName, event);
401
402
  // debug("hbResume - internals %s millis, old %s, event %s, previous %s", Date.now() - node.lastMessageTime, node.lastMessageValue, event.status, node.state);
402
403
  // Don't update for events originating from here
@@ -436,7 +437,7 @@ module.exports = function(RED) {
436
437
  }
437
438
  };
438
439
 
439
- node.conf.register(node, function() {
440
+ node.conf.register(node, function () {
440
441
  debug("hbResume.register:", node.fullName);
441
442
  this.hbDevice = hbDevices.findDevice(node.device, {
442
443
  perms: 'pw'
@@ -444,7 +445,7 @@ module.exports = function(RED) {
444
445
  if (this.hbDevice) {
445
446
  _status(node.device, node, {
446
447
  perms: 'pw'
447
- }, function(err, message) {
448
+ }, function (err, message) {
448
449
  if (!err) {
449
450
  node.state = _convertHBcharactericToNode(message.characteristics, node);
450
451
  debug("hbResume received: %s = %s", node.fullName, JSON.stringify(message.characteristics), node.state);
@@ -459,7 +460,7 @@ module.exports = function(RED) {
459
460
  node.eventName = [];
460
461
  // node.eventName = this.hbDevice.host + this.hbDevice.port + this.hbDevice.aid;
461
462
  // homebridge.on(this.hbDevice.host + this.hbDevice.port + this.hbDevice.aid, node.command);
462
- this.hbDevice.eventRegisters.forEach(function(event) {
463
+ this.hbDevice.eventRegisters.forEach(function (event) {
463
464
  homebridge.on(node.hbDevice.id + event.aid + event.iid, node.command);
464
465
  node.eventName.push(node.hbDevice.id + event.aid + event.iid);
465
466
  });
@@ -469,7 +470,7 @@ module.exports = function(RED) {
469
470
  fill: 'green'
470
471
  });
471
472
  clearTimeout(node.timeout);
472
- node.timeout = setTimeout(function() {
473
+ node.timeout = setTimeout(function () {
473
474
  node.status({});
474
475
  }, 30 * 1000);
475
476
  } else {
@@ -477,7 +478,7 @@ module.exports = function(RED) {
477
478
  }
478
479
  }.bind(this));
479
480
 
480
- node.on('close', function(callback) {
481
+ node.on('close', function (callback) {
481
482
  node.conf.deregister(node, callback);
482
483
  });
483
484
  }
@@ -502,26 +503,29 @@ module.exports = function(RED) {
502
503
 
503
504
  var node = this;
504
505
 
505
- node.on('input', function(msg) {
506
+ node.on('input', function (msg) {
506
507
  const payload = {};
507
- Object.keys(msg.payload).sort().forEach(function(key) {
508
+ this.msg = msg;
509
+ Object.keys(msg.payload).sort().forEach(function (key) {
508
510
  payload[key] = msg.payload[key];
509
511
  });
510
- _control.call(this, node, msg.payload, function(err, data) {
512
+ _control.call(this, node, msg.payload, function (err, data) {
511
513
  if (!err && data) {
512
514
  // debug('hbControl', err, data); // Images produce alot of noise
513
515
  const msg = {};
514
516
  msg.payload = data;
515
517
  node.send(msg);
518
+ } else {
519
+ node.error(err, this.msg);
516
520
  }
517
- });
521
+ }.bind(this));
518
522
  });
519
523
 
520
- node.on('close', function(callback) {
524
+ node.on('close', function (callback) {
521
525
  callback();
522
526
  });
523
527
 
524
- node.conf.register(node, function() {
528
+ node.conf.register(node, function () {
525
529
  // debug("hbControl.register:", node.fullName, node);
526
530
  switch (node.service) {
527
531
  case "Camera Control": // Camera Control
@@ -552,7 +556,7 @@ module.exports = function(RED) {
552
556
 
553
557
  var node = this;
554
558
 
555
- node.conf.register(node, function() {
559
+ node.conf.register(node, function () {
556
560
  debug("hbStatus Registered:", node.fullName);
557
561
  this.hbDevice = hbDevices.findDevice(node.device);
558
562
  if (this.hbDevice) {
@@ -567,10 +571,11 @@ module.exports = function(RED) {
567
571
  }
568
572
  });
569
573
 
570
- node.on('input', function(msg) {
574
+ node.on('input', function (msg) {
575
+ this.msg = msg;
571
576
  _status(this.device, node, {
572
577
  perms: 'pr'
573
- }, function(err, message) {
578
+ }, function (err, message) {
574
579
  if (!err) {
575
580
  debug("hbStatus received: %s = %s", JSON.stringify(node.fullName), JSON.stringify(message));
576
581
  var msg = {
@@ -592,19 +597,19 @@ module.exports = function(RED) {
592
597
  });
593
598
  node.send(msg);
594
599
  } else {
595
- node.error(err);
600
+ node.error(err, this.msg);
596
601
  }
597
- });
602
+ }.bind(this));
598
603
  });
599
604
 
600
- node.on('close', function(callback) {
605
+ node.on('close', function (callback) {
601
606
  callback();
602
607
  });
603
608
  }
604
609
 
605
610
  RED.nodes.registerType("hb-status", hbStatus);
606
611
 
607
- RED.httpAdmin.post('/hap-device/refresh/:id', RED.auth.needsPermission('hb-event.read'), function(req, res) {
612
+ RED.httpAdmin.post('/hap-device/refresh/:id', RED.auth.needsPermission('hb-event.read'), function (req, res) {
608
613
  var id = req.params.id;
609
614
  var conf = RED.nodes.getNode(id);
610
615
  if (conf) {
@@ -616,7 +621,7 @@ module.exports = function(RED) {
616
621
  }
617
622
  });
618
623
 
619
- RED.httpAdmin.get('/hap-device/evDevices/', RED.auth.needsPermission('hb-event.read'), function(req, res) {
624
+ RED.httpAdmin.get('/hap-device/evDevices/', RED.auth.needsPermission('hb-event.read'), function (req, res) {
620
625
  debug("evDevices", hbDevices.toList({
621
626
  perms: 'ev'
622
627
  }).length);
@@ -629,7 +634,7 @@ module.exports = function(RED) {
629
634
  }
630
635
  });
631
636
 
632
- RED.httpAdmin.get('/hap-device/evDevices/:id', RED.auth.needsPermission('hb-event.read'), function(req, res) {
637
+ RED.httpAdmin.get('/hap-device/evDevices/:id', RED.auth.needsPermission('hb-event.read'), function (req, res) {
633
638
  debug("evDevices", hbDevices.toList({
634
639
  perms: 'ev'
635
640
  }).length);
@@ -642,7 +647,7 @@ module.exports = function(RED) {
642
647
  }
643
648
  });
644
649
 
645
- RED.httpAdmin.post('/hap-device/refresh/:id', RED.auth.needsPermission('hb-resume.read'), function(req, res) {
650
+ RED.httpAdmin.post('/hap-device/refresh/:id', RED.auth.needsPermission('hb-resume.read'), function (req, res) {
646
651
  var id = req.params.id;
647
652
  var conf = RED.nodes.getNode(id);
648
653
  if (conf) {
@@ -654,7 +659,7 @@ module.exports = function(RED) {
654
659
  }
655
660
  });
656
661
 
657
- RED.httpAdmin.get('/hap-device/evDevices/', RED.auth.needsPermission('hb-resume.read'), function(req, res) {
662
+ RED.httpAdmin.get('/hap-device/evDevices/', RED.auth.needsPermission('hb-resume.read'), function (req, res) {
658
663
  debug("evDevices", hbDevices.toList({
659
664
  perms: 'ev'
660
665
  }).length);
@@ -667,7 +672,7 @@ module.exports = function(RED) {
667
672
  }
668
673
  });
669
674
 
670
- RED.httpAdmin.get('/hap-device/evDevices/:id', RED.auth.needsPermission('hb-resume.read'), function(req, res) {
675
+ RED.httpAdmin.get('/hap-device/evDevices/:id', RED.auth.needsPermission('hb-resume.read'), function (req, res) {
671
676
  debug("evDevices", hbDevices.toList({
672
677
  perms: 'ev'
673
678
  }).length);
@@ -680,7 +685,7 @@ module.exports = function(RED) {
680
685
  }
681
686
  });
682
687
 
683
- RED.httpAdmin.get('/hap-device/ctDevices/', RED.auth.needsPermission('hb-control.read'), function(req, res) {
688
+ RED.httpAdmin.get('/hap-device/ctDevices/', RED.auth.needsPermission('hb-control.read'), function (req, res) {
684
689
  debug("ctDevices", hbDevices.toList({
685
690
  perms: 'pw'
686
691
  }).length);
@@ -693,7 +698,7 @@ module.exports = function(RED) {
693
698
  }
694
699
  });
695
700
 
696
- RED.httpAdmin.get('/hap-device/ctDevices/:id', RED.auth.needsPermission('hb-control.read'), function(req, res) {
701
+ RED.httpAdmin.get('/hap-device/ctDevices/:id', RED.auth.needsPermission('hb-control.read'), function (req, res) {
697
702
  debug("ctDevices", hbDevices.toList({
698
703
  perms: 'pw'
699
704
  }).length);
@@ -721,7 +726,7 @@ module.exports = function(RED) {
721
726
  var payload = {};
722
727
  // characteristics = Object.assign(characteristics, characteristic.characteristic);
723
728
  if (device) {
724
- hbMessage.forEach(function(characteristic) {
729
+ hbMessage.forEach(function (characteristic) {
725
730
  // debug("Exists", (device.characteristics[characteristic.aid + '.' + characteristic.iid]));
726
731
  if (device.characteristics[characteristic.aid + '.' + characteristic.iid]) {
727
732
  payload = Object.assign(payload, {
@@ -791,7 +796,7 @@ module.exports = function(RED) {
791
796
  default:
792
797
  var message = '?id=' + device.getCharacteristics;
793
798
  debug("_status request: %s -> %s:%s ->", node.fullName, device.id, message);
794
- homebridge.HAPstatusByDeviceID(device.id, message, function(err, status) {
799
+ homebridge.HAPstatusByDeviceID(device.id, message, function (err, status) {
795
800
  if (!err) {
796
801
  // debug("Status %s:%s ->", device.host, device.port, status);
797
802
  node.status({
@@ -800,7 +805,7 @@ module.exports = function(RED) {
800
805
  fill: 'green'
801
806
  });
802
807
  clearTimeout(node.timeout);
803
- node.timeout = setTimeout(function() {
808
+ node.timeout = setTimeout(function () {
804
809
  node.status({});
805
810
  }, 30 * 1000);
806
811
  callback(null, status);
@@ -846,7 +851,6 @@ module.exports = function(RED) {
846
851
  */
847
852
 
848
853
  function _control(node, payload, callback) {
849
- // debug("_control", node.device);
850
854
  try {
851
855
  var device = hbDevices.findDevice(node.device, {
852
856
  perms: 'pw'
@@ -862,7 +866,7 @@ module.exports = function(RED) {
862
866
  "image-height": 1080
863
867
  };
864
868
  debug("Control %s ->", device.id, JSON.stringify(message));
865
- homebridge.HAPresourceByDeviceID(device.id, JSON.stringify(message), function(err, status) {
869
+ homebridge.HAPresourceByDeviceID(device.id, JSON.stringify(message), function (err, status) {
866
870
  if (!err) {
867
871
  debug("Controlled %s ->", device.id, JSON.stringify(payload));
868
872
  node.status({
@@ -871,7 +875,7 @@ module.exports = function(RED) {
871
875
  fill: 'green'
872
876
  });
873
877
  clearTimeout(node.timeout);
874
- node.timeout = setTimeout(function() {
878
+ node.timeout = setTimeout(function () {
875
879
  node.status({});
876
880
  }, 30 * 1000);
877
881
  callback(null, status);
@@ -892,7 +896,7 @@ module.exports = function(RED) {
892
896
  message = _createControlMessage.call(this, payload, node, device);
893
897
  debug("Control %s ->", device.id, JSON.stringify(message));
894
898
  if (message.characteristics.length > 0) {
895
- homebridge.HAPcontrolByDeviceID(device.id, JSON.stringify(message), function(err, status) {
899
+ homebridge.HAPcontrolByDeviceID(device.id, JSON.stringify(message), function (err, status) {
896
900
  if (!err && status && status.characteristics[0].status === 0) {
897
901
  debug("Controlled %s ->", device.id, JSON.stringify(status));
898
902
  node.status({
@@ -901,7 +905,7 @@ module.exports = function(RED) {
901
905
  fill: 'green'
902
906
  });
903
907
  clearTimeout(node.timeout);
904
- node.timeout = setTimeout(function() {
908
+ node.timeout = setTimeout(function () {
905
909
  node.status({});
906
910
  }, 10 * 1000);
907
911
  callback(null);
@@ -913,7 +917,7 @@ module.exports = function(RED) {
913
917
  fill: 'green'
914
918
  });
915
919
  clearTimeout(node.timeout);
916
- node.timeout = setTimeout(function() {
920
+ node.timeout = setTimeout(function () {
917
921
  node.status({});
918
922
  }, 10 * 1000);
919
923
  callback(null);
@@ -963,7 +967,6 @@ module.exports = function(RED) {
963
967
  }
964
968
  } catch (err) {
965
969
  var error = "Homebridge not initialized";
966
- node.error(error);
967
970
  node.status({
968
971
  text: error,
969
972
  shape: 'ring',
@@ -991,7 +994,7 @@ module.exports = function(RED) {
991
994
  "characteristics": device.eventRegisters
992
995
  };
993
996
  debug("_register", node.fullName, device.id, message);
994
- homebridge.HAPeventByDeviceID(device.id, JSON.stringify(message), function(err, status) {
997
+ homebridge.HAPeventByDeviceID(device.id, JSON.stringify(message), function (err, status) {
995
998
  if (!err && status === null) {
996
999
  debug("%s registered: %s -> %s", node.type, node.fullName, device.id);
997
1000
  callback(null);
package/README.md CHANGED
@@ -9,51 +9,50 @@ The above Node-RED Flow, turns on my 'Outside Office' light when the powder room
9
9
  # Table of Contents
10
10
 
11
11
  <!--ts-->
12
- * [Homebridge Automation powered by Node-RED](#homebridge-automation-powered-by-node-red)
13
- * [Table of Contents](#table-of-contents)
14
- * [Introduction](#introduction)
15
- * [Caveats](#caveats)
16
- * [Changes](#changes)
17
- * [Mar 18, 2019 - Version 0.0.39](#mar-18-2019---version-0039)
18
- * [Mar 19, 2019 - Version 0.0.42](#mar-19-2019---version-0042)
19
- * [Mar 31, 2019 - Version 0.0.](#mar-31-2019---version-00)
20
- * [May 9, 2019 - Version 0.0.43](#may-9-2019---version-0043)
21
- * [May 15, 2019 - Version 0.0.44](#may-15-2019---version-0044)
22
- * [May 29, 2019 - Version 0.0.45](#may-29-2019---version-0045)
23
- * [July 27, 2019 - Version 0.0.50](#july-27-2019---version-0050)
24
- * [Feb 24, 2020 - Version 0.0.56](#feb-24-2020---version-0056)
25
- * [Mar 18, 2020 - Version 0.0.59](#mar-18-2020---version-0059)
26
- * [Oct 13, 2020 - Version 0.0.71](#oct-13-2020---version-0071)
27
- * [Oct 24, 2020 - Version 0.0.71](#oct-24-2020---version-0071)
28
- * [Nov 1, 2020 - Version 0.0.73](#nov-1-2020---version-0073)
29
- * [Nov 13, 2020 - Version 0.0.76](#nov-13-2020---version-0076)
30
- * [Feb 2, 2021 - Version 0.0.78](#feb-2-2021---version-0078)
31
- * [Mar 9, 2021 - Version 0.0.80](#mar-9-2021---version-0080)
32
- * [April 23, 2021 - Version 0.0.82](#april-23-2021---version-0082)
33
- * [April 23, 2022 - Version 0.0.86](#april-23-2022---version-0086)
34
- * [Backlog / Roadmap](#backlog--roadmap)
35
- * [Dropped items](#dropped-items)
36
- * [Installation Steps](#installation-steps)
37
- * [1 - Install Node-RED and Homebridge](#1---install-node-red-and-homebridge)
38
- * [2 - Prepare Homebridge for integration with Homebridge-Automation](#2---prepare-homebridge-for-integration-with-homebridge-automation)
39
- * [3 - Install Homebridge-Automation into Node-Red](#3---install-homebridge-automation-into-node-red)
40
- * [4 - Start Node-Red](#4---start-node-red)
41
- * [5 - Initial setup and configuration inside Node-Red](#5---initial-setup-and-configuration-inside-node-red)
42
- * [6 - Configure 'hb event' to receive updates from your Accessories](#6---configure-hb-event-to-receive-updates-from-your-accessories)
43
- * [Node-RED Homebridge-Automation Message Structure](#node-red-homebridge-automation-message-structure)
44
- * [hb event](#hb-event)
45
- * [Output](#output)
46
- * [hb resume](#hb-resume)
47
- * [input](#input)
48
- * [output](#output-1)
49
- * [hb status](#hb-status)
50
- * [input](#input-1)
51
- * [output](#output-2)
52
- * [hb control](#hb-control)
53
- * [Input](#input-2)
54
- * [Flows Shared from Community](#flows-shared-from-community)
55
- * [Troubleshooting / DEBUG MODE](#troubleshooting--debug-mode)
56
- * [To start Node-RED in DEBUG mode, and output Homebridge-Automation debug logs start Node-RED like this.](#to-start-node-red-in-debug-mode-and-output-homebridge-automation-debug-logs-start-node-red-like-this)
12
+ * [Homebridge Automation powered by Node-RED]()
13
+ * [Table of Contents]()
14
+ * [Introduction]()
15
+ * [Caveats]()
16
+ * [Changes]()
17
+ * [Mar 18, 2019 - Version 0.0.39]()
18
+ * [Mar 19, 2019 - Version 0.0.42]()
19
+ * [Mar 31, 2019 - Version 0.0.]()
20
+ * [May 9, 2019 - Version 0.0.43]()
21
+ * [May 15, 2019 - Version 0.0.44]()
22
+ * [May 29, 2019 - Version 0.0.45]()
23
+ * [July 27, 2019 - Version 0.0.50]()
24
+ * [Feb 24, 2020 - Version 0.0.56]()
25
+ * [Mar 18, 2020 - Version 0.0.59]()
26
+ * [Oct 13, 2020 - Version 0.0.71]()
27
+ * [Oct 24, 2020 - Version 0.0.71]()
28
+ * [Nov 1, 2020 - Version 0.0.73]()
29
+ * [Nov 13, 2020 - Version 0.0.76]()
30
+ * [Feb 2, 2021 - Version 0.0.78]()
31
+ * [Mar 9, 2021 - Version 0.0.80]()
32
+ * [April 23, 2021 - Version 0.0.82]()
33
+ * [Backlog / Roadmap]()
34
+ * [Dropped items]()
35
+ * [Installation Steps]()
36
+ * [1 - Install Node-RED and Homebridge]()
37
+ * [2 - Prepare Homebridge for integration with Homebridge-Automation]()
38
+ * [3 - Install Homebridge-Automation into Node-Red]()
39
+ * [4 - Start Node-Red]()
40
+ * [5 - Initial setup and configuration inside Node-Red]()
41
+ * [6 - Configure 'hb event' to receive updates from your Accessories]()
42
+ * [Node-RED Homebridge-Automation Message Structure]()
43
+ * [hb event]()
44
+ * [Output]()
45
+ * [hb resume]()
46
+ * [input]()
47
+ * [output]()
48
+ * [hb status]()
49
+ * [input]()
50
+ * [output]()
51
+ * [hb control]()
52
+ * [Input]()
53
+ * [Flows Shared from Community]()
54
+ * [Troubleshooting / DEBUG MODE]()
55
+ * [To start Node-RED in DEBUG mode, and output Homebridge-Automation debug logs start Node-RED like this.]()
57
56
 
58
57
  <!-- Added by: sgracey, at: -->
59
58
 
@@ -162,10 +161,6 @@ With a plugin, you can see if it supports Real Time events, by opening the Home
162
161
 
163
162
  - Support for homebridge instances with different PINS. Tks @dxdc
164
163
 
165
- ### April 23, 2022 - Version 0.0.86
166
-
167
- - Removal of request dependency from hap-node-client
168
-
169
164
  # Backlog / Roadmap
170
165
 
171
166
  * [x] - Update Node Information with Homebridge Accessory Details ( hapEndpoint, deviceType, description )
@@ -0,0 +1,346 @@
1
+ # Homebridge Automation powered by Node-RED
2
+
3
+ <p align="center">
4
+ <img src="docs/Homebridge and Node Red.png"/>
5
+ </p>
6
+
7
+ The above Node-RED Flow, turns on my 'Outside Office' light when the powder room is turned on, and turns them both off after 10 seconds. Not practical but a good sample of the power behind Node-RED. [Link](docs/sample.json) to exported flow for above.
8
+
9
+ # Table of Contents
10
+
11
+ <!--ts-->
12
+ * [Homebridge Automation powered by Node-RED](#homebridge-automation-powered-by-node-red)
13
+ * [Table of Contents](#table-of-contents)
14
+ * [Introduction](#introduction)
15
+ * [Caveats](#caveats)
16
+ * [Changes](#changes)
17
+ * [Mar 18, 2019 - Version 0.0.39](#mar-18-2019---version-0039)
18
+ * [Mar 19, 2019 - Version 0.0.42](#mar-19-2019---version-0042)
19
+ * [Mar 31, 2019 - Version 0.0.](#mar-31-2019---version-00)
20
+ * [May 9, 2019 - Version 0.0.43](#may-9-2019---version-0043)
21
+ * [May 15, 2019 - Version 0.0.44](#may-15-2019---version-0044)
22
+ * [May 29, 2019 - Version 0.0.45](#may-29-2019---version-0045)
23
+ * [July 27, 2019 - Version 0.0.50](#july-27-2019---version-0050)
24
+ * [Feb 24, 2020 - Version 0.0.56](#feb-24-2020---version-0056)
25
+ * [Mar 18, 2020 - Version 0.0.59](#mar-18-2020---version-0059)
26
+ * [Oct 13, 2020 - Version 0.0.71](#oct-13-2020---version-0071)
27
+ * [Oct 24, 2020 - Version 0.0.71](#oct-24-2020---version-0071)
28
+ * [Nov 1, 2020 - Version 0.0.73](#nov-1-2020---version-0073)
29
+ * [Nov 13, 2020 - Version 0.0.76](#nov-13-2020---version-0076)
30
+ * [Feb 2, 2021 - Version 0.0.78](#feb-2-2021---version-0078)
31
+ * [Mar 9, 2021 - Version 0.0.80](#mar-9-2021---version-0080)
32
+ * [April 23, 2021 - Version 0.0.82](#april-23-2021---version-0082)
33
+ * [Backlog / Roadmap](#backlog--roadmap)
34
+ * [Dropped items](#dropped-items)
35
+ * [Installation Steps](#installation-steps)
36
+ * [1 - Install Node-RED and Homebridge](#1---install-node-red-and-homebridge)
37
+ * [2 - Prepare Homebridge for integration with Homebridge-Automation](#2---prepare-homebridge-for-integration-with-homebridge-automation)
38
+ * [3 - Install Homebridge-Automation into Node-Red](#3---install-homebridge-automation-into-node-red)
39
+ * [4 - Start Node-Red](#4---start-node-red)
40
+ * [5 - Initial setup and configuration inside Node-Red](#5---initial-setup-and-configuration-inside-node-red)
41
+ * [6 - Configure 'hb event' to receive updates from your Accessories](#6---configure-hb-event-to-receive-updates-from-your-accessories)
42
+ * [Node-RED Homebridge-Automation Message Structure](#node-red-homebridge-automation-message-structure)
43
+ * [hb event](#hb-event)
44
+ * [Output](#output)
45
+ * [hb resume](#hb-resume)
46
+ * [input](#input)
47
+ * [output](#output-1)
48
+ * [hb status](#hb-status)
49
+ * [input](#input-1)
50
+ * [output](#output-2)
51
+ * [hb control](#hb-control)
52
+ * [Input](#input-2)
53
+ * [Flows Shared from Community](#flows-shared-from-community)
54
+ * [Troubleshooting / DEBUG MODE](#troubleshooting--debug-mode)
55
+ * [To start Node-RED in DEBUG mode, and output Homebridge-Automation debug logs start Node-RED like this.](#to-start-node-red-in-debug-mode-and-output-homebridge-automation-debug-logs-start-node-red-like-this)
56
+
57
+ <!-- Added by: sgracey, at: -->
58
+
59
+ <!--te-->
60
+
61
+ # Introduction
62
+
63
+ This is a release of the ability to integrate Homebridge Accessories into [Node-RED](https://nodered.org) so that you can start flows from Homebridge accessory events and control your existing homebridge accessories. ( To create accessories in HomeKit, please use node-red-contrib-homekit-bridged. )
64
+
65
+ ![Homebridge Nodes](docs/Homebridge%20Nodes.png)
66
+
67
+ Four different node types are available, the first node `hb event` listens for changes to an accessory (ie on/off) and sends a message into Node-Red containing the updated accessory status. The second node `hb resume` holds the state of an accessory and supports creating a state resume function. The third node `hb status` allows you to poll an accessory for status. The forth node `hb control` allows you to control a homebridge accessory. Each node is tied to an individual Home App Tile/Service of an accessory (ie on/off and brightness).
68
+
69
+ Payload from a dimmable lightbulb.
70
+
71
+ ```
72
+ { "On":true, "Brightness":100 }
73
+ ```
74
+
75
+ ![Homebridge Nodes](docs/HAP%20Event%20Nodes.png)
76
+
77
+ ## Caveats
78
+
79
+ * Please keep in mind that this integration only works with devices supported/exposed with HomeBridge Plugins. This does not have visibility to Native HomeKit devices. ( Similar to my homebridge-alexa plugin. )
80
+
81
+ * For the `hb event` node, the ability of a Accessory to generate events in Real Time is dependent on how the plugin was architected and the actual device. Some are very good at generating events in real time, and others only generate events when the Home App is opened to the accessory. YMMV.
82
+
83
+ With a plugin, you can see if it supports Real Time events, by opening the Home App, and looking at an accessory. Then trigger a local event outside of homebridge/homekit. If the accessory updates in real time, then it support Real Events. ( An example of a local event can be turning on a Smart Light Switch, by the local switch. Another example would be using the vendor app to control an accessory.)
84
+
85
+ ## Changes
86
+
87
+ ### Mar 18, 2019 - Version 0.0.39
88
+
89
+ - Changed `hb state` to `hb resume` to make the use case for the node more self-explanatory. If you had used the `hb state` node in your existing flow, nodeRed will not start unless you manually change the node type in the flow file. To fix the issue, manually edit the flow file in your .node-red directory, and change the type reference `hb-state` to `hb resume`
90
+ - Changed individual nodes from being characteristic based to device/service based. When updating from previous versions, you will need to select your devices again.
91
+ - With the change in nodes to be device/service based, the payload message structure changed from being individual characteristic based to a JSON object containing all the characteristics you want to update on the device. ie in the previous version a device control message payload of `true` going to the On characteristic would turn on a light, with this version it would be be represented with a message payload of `{ "On":true, "Brightness":100 }`. This particular payload would turn on a light and set the brightness to 100. I made this change to enable easier intergradation with node-red-contrib-homekit-bridged.
92
+ - If you send an incorrect message payload to the `hb resume` or `hb control` nodes it would output a debug message containing the valid/supported characteristics for use in the payload object.
93
+ - Updated the Homebridge accessory parser, so more diverse devices will now be exposed.
94
+
95
+ ### Mar 19, 2019 - Version 0.0.42
96
+
97
+ - Fix for events being missed after homebridge restarts
98
+
99
+ ### Mar 31, 2019 - Version 0.0.
100
+
101
+ - Fix for a crash when events are received by an accessory with multiple services.
102
+
103
+ ### May 9, 2019 - Version 0.0.43
104
+
105
+ - Added retries for registering of events during startup. ( 1000 retries, retry delay of 30 seconds )
106
+
107
+ ### May 15, 2019 - Version 0.0.44
108
+
109
+ - Added reqTimeout and set default timeout on homebridge requests to 14 seconds
110
+
111
+ ### May 29, 2019 - Version 0.0.45
112
+
113
+ - Name Change to Homebridge-Automation
114
+
115
+ ### July 27, 2019 - Version 0.0.50
116
+
117
+ - Publish as a NPM package to resolve #17
118
+
119
+ ### Feb 24, 2020 - Version 0.0.56
120
+
121
+ - Fix for device naming for Nest FAN and ECO Mode
122
+
123
+ ### Mar 18, 2020 - Version 0.0.59
124
+
125
+ - Support for the new version of HAP-NodeJS
126
+
127
+ ### Oct 13, 2020 - Version 0.0.71
128
+
129
+ - Realize that I have not updated the change log for a while, so this is a laundry list of changes since 0.0.59
130
+ - Additional error logging
131
+ - Fix for issue #47 and #48
132
+ - Support camera devices - tks dxdc
133
+ - Improved timeout support
134
+ - Support for the latest version of homebridge
135
+
136
+ ### Oct 24, 2020 - Version 0.0.71
137
+
138
+ - Added support for plugins that allow device name editing within the Home app.
139
+
140
+ ### Nov 1, 2020 - Version 0.0.73
141
+
142
+ - Added support for Air Pressure and Power devices
143
+ - Fixed issue #69 TV accessory events not firing since update of homebridge-broadlink-rm plugin
144
+
145
+ ### Nov 13, 2020 - Version 0.0.76
146
+
147
+ - Update HB Control Node to output snapshot images from camera's. Payload output format is a buffer object containing image.
148
+
149
+ ### Feb 2, 2021 - Version 0.0.78
150
+
151
+ - Change hb-control to display control message payload rather than 'Ok'
152
+ - Tweak device parser to remove these duplicates
153
+ - Camera RTPStream Management
154
+ - Input Source with a name of 'dummy'
155
+
156
+ ### Mar 9, 2021 - Version 0.0.80
157
+
158
+ - hbEvent: add option to send initial state
159
+
160
+ ### April 23, 2021 - Version 0.0.82
161
+
162
+ - Support for homebridge instances with different PINS. Tks @dxdc
163
+
164
+ # Backlog / Roadmap
165
+
166
+ * [x] - Update Node Information with Homebridge Accessory Details ( hapEndpoint, deviceType, description )
167
+ * [x] - Sort device drop down listing
168
+ * [x] - Trim Node name to just accessory Name
169
+ * [x] - Documentation - Fix README with latest options
170
+ * [x] - Documentation/Naming - Normalize on Accessory, Service, Event and Characteristic
171
+ * [x] - Hap-Node-Client is not reentrant, and multiple requests get lost. Needs queuing at an instance level.
172
+ * [x] - Refactor interface with Hap-Node-Client, and split events into a dedicated evented socket connection and use the regular request module for everything else.
173
+ * [x] - Create a service/characteristic based node approach mimicking homekit icons
174
+ * [x] - Adjust msg.payload to match other homekit / NodeRED integrations
175
+ * [ ] - Further stability testing
176
+ * [ ] - With hb-event add a delay function of about 30ms to put back together device level events
177
+
178
+ ## Dropped items
179
+
180
+ * [ ] - Add timestamp to Node msg object
181
+ * [ ] - Do I need a node that emits events for all homebridge devices?
182
+
183
+ # Installation Steps
184
+
185
+ ## 1 - Install Node-RED and Homebridge
186
+
187
+ This is covered in alot of other places, so I won't cover it here.
188
+
189
+ ## 2 - Prepare Homebridge for integration with Homebridge-Automation
190
+
191
+ Place your homebridge instances into "INSECURE MODE". This is same as my [Homebridge Alexa](https://github.com/NorthernMan54/homebridge-alexa) plugin, and you just need to follow the [Prepare homebridge for plugin](https://github.com/NorthernMan54/homebridge-alexa#prepare-homebridge-for-plugin-installation) instructions there.
192
+
193
+ ## 3 - Install Homebridge-Automation into Node-Red
194
+
195
+ cd ~/.node-red
196
+ npm install node-red-contrib-homebridge-automation
197
+
198
+ ## 4 - Start Node-Red
199
+
200
+ ## 5 - Initial setup and configuration inside Node-Red
201
+
202
+ * 5.1 Select 'hb event' node and place onto flow.
203
+ * 5.2 Double click on hb event node ( now called 'Choose accessory/event')
204
+
205
+ ![Choose](docs/Choose.png)
206
+
207
+ * 5.3 Please select the **pencil** to the right of the PIN Field.
208
+
209
+ ![Pencil](docs/Pencil.png)
210
+
211
+ * 5.4 Please enter your PIN, and select **Add**.
212
+
213
+ ![Pin Entered](docs/Pin%20Entered.png)
214
+
215
+ * 5.5 Now select **Done**.
216
+
217
+ ![Done](docs/HAP%20Event%20Done.png)
218
+
219
+ * 5.6 Now select **Deploy**
220
+ * 5.7 Please wait about 30 seconds. ( Node-RED is busy discovering all your accessories.)
221
+ * 5.8 Initial setup and config is complete.
222
+
223
+ ## 6 - Configure 'hb event' to receive updates from your Accessories
224
+
225
+ * 6.1 Double click on hb event node ( now called 'Choose accessory/service')
226
+
227
+ ![Populated](docs/HAP%20Event%20Populated.png)
228
+
229
+ * 6.2 The device drop down should now be populated with all your Homebridge accessories.
230
+
231
+ ![Populated](docs/HAP%20Event%20Drop%20Down.png)
232
+
233
+ The accessory naming convention is:
234
+
235
+ Accessory Name and Accessory Service Type
236
+
237
+ # Node-RED Homebridge-Automation Message Structure
238
+
239
+ ## hb event
240
+
241
+ This node generates a message every time an Accessory changes status, and generates a message containing the updated status of all the characteristics.
242
+
243
+ ### Output
244
+
245
+ Message is structured like this
246
+
247
+ ```
248
+ msg = {
249
+ name: Accessory Name,
250
+ payload: { "On":true, "Brightness":100 }
251
+ Homebridge: Homebridge instance name,
252
+ Manufacturer: Plugin Manufacturer,
253
+ Type: Homebridge device type,
254
+ _device: Unique device identifier,
255
+ _confId: node.confId,
256
+ _rawEvent: Raw event message
257
+ };
258
+ ```
259
+
260
+ Message payload will vary depending on characteristics support by the device, this example is from a dimmable light.
261
+
262
+ Please note that multiple event messages may be received from a single device event, this is due to how homebridge controls devices and emits events.
263
+
264
+ ## hb resume
265
+
266
+ This node can be used to create a resume previous state flow. Where you change the state of an accessory, and have it resume the previous state afterwards. I'm using this, in conjunction with Alexa to give the ability to turn on and off the lights in a room, but not turn any lights that were already on. I'm also using it with the HomeKit "I'm home" automation, to turn a group of lights for a few minutes then turn off. But at the same time have any lights you already had on, stay on.
267
+
268
+ ### input
269
+
270
+ Based on the message input payload and state of the accessory the output changes.
271
+
272
+ For `{"On":true}`, the node just passes the message to output. For the first `{"On":false}`, the output is the state of the accessory from prior to the last turn on. For the second `{"On":false}`, the out is `{"On":false}`.
273
+
274
+ ```
275
+ msg = {
276
+ payload: { "On":true, "Brightness":100 }
277
+ };
278
+ ```
279
+
280
+ ### output
281
+
282
+ ```
283
+ msg = {
284
+ payload: { "On":true, "Brightness":100 }
285
+ };
286
+ ```
287
+ Message payload will vary depending on characteristics support by the device, this sample is from a dimmable light.
288
+
289
+ To find supported characteristics for a device, please send an invalid message payload to the node, and it will output the supported characteristics in the debug log.
290
+
291
+ ## hb status
292
+
293
+ This node allows you to poll a Homebridge accessory and collect the current status of all the characteristics.
294
+
295
+ ### input
296
+
297
+ Anything
298
+
299
+ ### output
300
+
301
+ Message is structured like this
302
+
303
+ ```
304
+ msg = {
305
+ name: Accessory Name,
306
+ payload: { "On":true, "Brightness":100 }
307
+ Homebridge: Homebridge instance name,
308
+ Manufacturer: Plugin Manufacturer,
309
+ Type: Homebridge device type,
310
+ _device: Unique device identifier,
311
+ _confId: node.confId,
312
+ _rawEvent: Raw event message
313
+ };
314
+ ```
315
+ Message payload will vary depending on characteristics support by the device, this sample is from a dimmable light.
316
+
317
+ ## hb control
318
+
319
+ This node allows you to control all the characteristics of a Homebridge accessory. The message payload needs to be a JSON object containing the values of all the characteristics you want to change. If you send the node an invalid payload, it will output all the available characteristics of the accessory in the debug tab.
320
+
321
+ ### Input
322
+
323
+ The hb control node only looks at msg.payload value, and ignore's all others.
324
+
325
+ ```
326
+ msg = {
327
+ payload: { "On":true, "Brightness":100 }
328
+ }
329
+ ```
330
+ Message payload will vary depending on characteristics support by the device, this sample is from a dimmable light.
331
+
332
+ To find supported characteristics for a device, please send an invalid message payload to the node, and it will output the supported characteristics in the debug log.
333
+
334
+ # Flows Shared from Community
335
+
336
+ I have started collecting flows for useful functions on the wiki.
337
+
338
+ https://github.com/NorthernMan54/node-red-contrib-homebridge-automation/wiki
339
+
340
+ # Troubleshooting / DEBUG MODE
341
+
342
+ ## To start Node-RED in DEBUG mode, and output Homebridge-Automation debug logs start Node-RED like this.
343
+
344
+ ```
345
+ DEBUG=-express*,-send*,-body-parser*,* node-red
346
+ ```
@@ -0,0 +1,47 @@
1
+ * [Homebridge Automation powered by Node-RED]()
2
+ * [Table of Contents]()
3
+ * [Introduction]()
4
+ * [Caveats]()
5
+ * [Changes]()
6
+ * [Mar 18, 2019 - Version 0.0.39]()
7
+ * [Mar 19, 2019 - Version 0.0.42]()
8
+ * [Mar 31, 2019 - Version 0.0.]()
9
+ * [May 9, 2019 - Version 0.0.43]()
10
+ * [May 15, 2019 - Version 0.0.44]()
11
+ * [May 29, 2019 - Version 0.0.45]()
12
+ * [July 27, 2019 - Version 0.0.50]()
13
+ * [Feb 24, 2020 - Version 0.0.56]()
14
+ * [Mar 18, 2020 - Version 0.0.59]()
15
+ * [Oct 13, 2020 - Version 0.0.71]()
16
+ * [Oct 24, 2020 - Version 0.0.71]()
17
+ * [Nov 1, 2020 - Version 0.0.73]()
18
+ * [Nov 13, 2020 - Version 0.0.76]()
19
+ * [Feb 2, 2021 - Version 0.0.78]()
20
+ * [Mar 9, 2021 - Version 0.0.80]()
21
+ * [April 23, 2021 - Version 0.0.82]()
22
+ * [Backlog / Roadmap]()
23
+ * [Dropped items]()
24
+ * [Installation Steps]()
25
+ * [1 - Install Node-RED and Homebridge]()
26
+ * [2 - Prepare Homebridge for integration with Homebridge-Automation]()
27
+ * [3 - Install Homebridge-Automation into Node-Red]()
28
+ * [4 - Start Node-Red]()
29
+ * [5 - Initial setup and configuration inside Node-Red]()
30
+ * [6 - Configure 'hb event' to receive updates from your Accessories]()
31
+ * [Node-RED Homebridge-Automation Message Structure]()
32
+ * [hb event]()
33
+ * [Output]()
34
+ * [hb resume]()
35
+ * [input]()
36
+ * [output]()
37
+ * [hb status]()
38
+ * [input]()
39
+ * [output]()
40
+ * [hb control]()
41
+ * [Input]()
42
+ * [Flows Shared from Community]()
43
+ * [Troubleshooting / DEBUG MODE]()
44
+ * [To start Node-RED in DEBUG mode, and output Homebridge-Automation debug logs start Node-RED like this.]()
45
+
46
+ <!-- Added by: sgracey, at: -->
47
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.0.86-beta.2",
3
+ "version": "0.0.86",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "HAP-NodeRed.js",
6
6
  "scripts": {
@@ -22,12 +22,12 @@
22
22
  "url": "git+https://github.com/NorthernMan54/node-red-contrib-homebridge-automation.git"
23
23
  },
24
24
  "devDependencies": {
25
- "documentation": "^13.2.5"
25
+ "documentation": "13.2.4"
26
26
  },
27
27
  "dependencies": {
28
- "better-queue": ">=3.8.10",
29
28
  "debug": ">2.6.9",
30
- "hap-node-client": ">=0.1.22-beta.2"
29
+ "hap-node-client": ">=0.1.14",
30
+ "better-queue": ">=3.8.10"
31
31
  },
32
32
  "author": "NorthernMan54",
33
33
  "license": "ISC",
package/beta.sh DELETED
@@ -1,16 +0,0 @@
1
- #! /bin/sh
2
-
3
- npm audit
4
- npm audit fix
5
- #if npm audit; then
6
- npm run-script document
7
- rm *orig* *toc\.*
8
- git add .
9
- # npm version patch -m "$1" --force
10
- npm version prerelease --preid beta -m "$1" --force
11
- npm publish --tag beta
12
- git commit -m "$1"
13
- git push origin beta --tags
14
- #else
15
- # echo "Not publishing due to security vulnerabilites"
16
- #fi