node-red-contrib-homebridge-automation 0.1.12-beta.3 → 0.1.12-beta.5

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
@@ -60,7 +60,7 @@ The above Node-RED Flow, turns on my 'Outside Office' light when the powder room
60
60
  * [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)
61
61
 
62
62
  <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
63
- <!-- Added by: runner, at: Fri Jul 5 23:39:42 UTC 2024 -->
63
+ <!-- Added by: runner, at: Sat Jul 6 02:02:55 UTC 2024 -->
64
64
 
65
65
  <!--te-->
66
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.1.12-beta.3",
3
+ "version": "0.1.12-beta.5",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -194,7 +194,7 @@ module.exports = function (RED) {
194
194
  _rawEvent: event
195
195
  };
196
196
  node.status({
197
- text: JSON.stringify(msg.payload),
197
+ text: JSON.stringify(msg.payload).slice(0, 30) + '...',
198
198
  shape: 'dot',
199
199
  fill: 'green'
200
200
  });
@@ -233,7 +233,7 @@ module.exports = function (RED) {
233
233
  }, function (err, message) {
234
234
  if (!err) {
235
235
  node.state = _convertHBcharactericToNode(message.characteristics, node);
236
- debug("hbEvent received: %s = %s", node.fullName, JSON.stringify(message.characteristics).slice(0, 80)+'...');
236
+ debug("hbEvent received: %s = %s", node.fullName, JSON.stringify(message.characteristics).slice(0, 80) + '...');
237
237
  if (node.sendInitialState) {
238
238
  var msg = {
239
239
  name: node.name,
@@ -246,7 +246,7 @@ module.exports = function (RED) {
246
246
  _rawMessage: message,
247
247
  };
248
248
  node.status({
249
- text: JSON.stringify(msg.payload),
249
+ text: JSON.stringify(msg.payload).slice(0, 30) + '...',
250
250
  shape: 'dot',
251
251
  fill: 'green'
252
252
  });
@@ -366,7 +366,7 @@ module.exports = function (RED) {
366
366
  }, newMsg));
367
367
  debug("hbResume.input: %s output", node.fullName, JSON.stringify(newMsg));
368
368
  node.status({
369
- text: JSON.stringify(newMsg.payload),
369
+ text: JSON.stringify(newMsg.payload).slice(0, 30) + '...',
370
370
  shape: 'dot',
371
371
  fill: 'green'
372
372
  });
@@ -448,7 +448,7 @@ module.exports = function (RED) {
448
448
  }, function (err, message) {
449
449
  if (!err) {
450
450
  node.state = _convertHBcharactericToNode(message.characteristics, node);
451
- debug("hbResume received: %s = %s", node.fullName, JSON.stringify(message.characteristics), node.state);
451
+ debug("hbResume received: %s = %s", node.fullName, JSON.stringify(message.characteristics).slice(0, 80) + '...');
452
452
  } else {
453
453
  node.error(err);
454
454
  }
@@ -527,12 +527,28 @@ module.exports = function (RED) {
527
527
  node.error(error, this.msg);
528
528
  return;
529
529
  }
530
+ device
531
+ // name: 'Cottage Porch',
532
+ // service: 'Camera Control',
533
+ // fullName: 'Cottage Porch - Camera Control',
534
+ // sortName: 'Cottage Porch:Camera Control',
535
+
530
536
 
531
537
  _control.call(this, node, device, msg.payload, function (err, data) {
532
538
  // debug('hbControl [%s] - [%s]', err, data); // Images produce alot of noise
533
539
  if (!err && data && (device.type == '00000110' || device.type == '00000111')) {
534
- // debug('hbControl', err, data); // Images produce alot of noise
535
- const msg = {};
540
+ // console.log('device', device, node);
541
+ const msg = {
542
+ name: node.name,
543
+ payload: node.state,
544
+ _device: node.device,
545
+ _confId: node.confId
546
+ };
547
+ if (node.hbDevice) {
548
+ msg.Homebridge = node.hbDevice.homebridge;
549
+ msg.Manufacturer = node.hbDevice.manufacturer;
550
+ msg.Service = node.hbDevice.deviceType;
551
+ }
536
552
  msg.payload = data;
537
553
  node.send(msg);
538
554
  } else {
@@ -599,7 +615,7 @@ module.exports = function (RED) {
599
615
  perms: 'pr'
600
616
  }, function (err, message) {
601
617
  if (!err) {
602
- debug("hbStatus received: %s = %s", JSON.stringify(node.fullName), JSON.stringify(message), JSON.stringify(node.hbDevice));
618
+ debug("hbStatus received: %s = %s", JSON.stringify(node.fullName), JSON.stringify(message).slice(0, 80) + '...', JSON.stringify(node.hbDevice));
603
619
  this.msg.name = node.name;
604
620
  this.msg._rawMessage = message;
605
621
  this.msg.payload = _convertHBcharactericToNode(message.characteristics, node);
@@ -612,7 +628,7 @@ module.exports = function (RED) {
612
628
  this.msg._confId = node.confId;
613
629
  }
614
630
  node.status({
615
- text: JSON.stringify(this.msg.payload),
631
+ text: JSON.stringify(this.msg.payload).slice(0, 30) + '...',
616
632
  shape: 'dot',
617
633
  fill: 'green'
618
634
  });
@@ -828,7 +844,7 @@ module.exports = function (RED) {
828
844
  };
829
845
  debug("_status Control %s -> %s", device.id, JSON.stringify(message));
830
846
  homebridge.HAPresourceByDeviceID(device.id, JSON.stringify(message), function (err, status) {
831
- debug("status", err);
847
+ // debug("status", err);
832
848
  if (!err) {
833
849
  debug("_status Controlled %s:%s ->", device.host, device.port);
834
850
  node.status({
@@ -919,6 +935,7 @@ module.exports = function (RED) {
919
935
  try {
920
936
  if (device) {
921
937
  var message;
938
+ // console.log('device.type', device.type)
922
939
  switch (device.type) {
923
940
  case "00000110": // Camera RTPStream Management
924
941
  case "00000111": // Camera Control
@@ -930,10 +947,10 @@ module.exports = function (RED) {
930
947
  debug("Control %s ->", device.id, JSON.stringify(message));
931
948
  homebridge.HAPresourceByDeviceID(device.id, JSON.stringify(message), function (err, status) {
932
949
  if (!err) {
933
- debug("Controlled %s ->", device.id, JSON.stringify(payload));
934
- debug("Payload %s ->", device.id, status);
950
+ // debug("Controlled %s ->", device.id, JSON.stringify(payload));
951
+ // debug("Payload %s ->", device.id, status);
935
952
  node.status({
936
- text: JSON.stringify(payload),
953
+ text: JSON.stringify(payload).slice(0, 30) + '...',
937
954
  shape: 'dot',
938
955
  fill: 'green'
939
956
  });
@@ -963,7 +980,7 @@ module.exports = function (RED) {
963
980
  if (!err && status && status.characteristics[0].status === 0) {
964
981
  debug("Controlled %s ->", device.id, JSON.stringify(status));
965
982
  node.status({
966
- text: JSON.stringify(payload),
983
+ text: JSON.stringify(payload).slice(0, 30) + '...',
967
984
  shape: 'dot',
968
985
  fill: 'green'
969
986
  });
@@ -975,7 +992,7 @@ module.exports = function (RED) {
975
992
  } else if (!err) {
976
993
  debug("Controlled %s ->", device.id, payload);
977
994
  node.status({
978
- text: JSON.stringify(payload),
995
+ text: JSON.stringify(payload).slice(0, 30) + '...',
979
996
  shape: 'dot',
980
997
  fill: 'green'
981
998
  });