node-red-contrib-homebridge-automation 0.1.12-beta.4 → 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 +1 -1
- package/package.json +1 -1
- package/src/HAP-NodeRed.js +32 -16
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: Sat Jul 6
|
|
63
|
+
<!-- Added by: runner, at: Sat Jul 6 02:02:55 UTC 2024 -->
|
|
64
64
|
|
|
65
65
|
<!--te-->
|
|
66
66
|
|
package/package.json
CHANGED
package/src/HAP-NodeRed.js
CHANGED
|
@@ -194,7 +194,7 @@ module.exports = function (RED) {
|
|
|
194
194
|
_rawEvent: event
|
|
195
195
|
};
|
|
196
196
|
node.status({
|
|
197
|
-
text: JSON.stringify(msg.payload).slice(0,
|
|
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).slice(0,
|
|
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).slice(0,
|
|
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).slice(0, 80)+'...');
|
|
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
|
-
//
|
|
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).slice(0, 80)+'...', 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).slice(0,
|
|
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,7 +935,7 @@ module.exports = function (RED) {
|
|
|
919
935
|
try {
|
|
920
936
|
if (device) {
|
|
921
937
|
var message;
|
|
922
|
-
console.log('device.type',device.type)
|
|
938
|
+
// console.log('device.type', device.type)
|
|
923
939
|
switch (device.type) {
|
|
924
940
|
case "00000110": // Camera RTPStream Management
|
|
925
941
|
case "00000111": // Camera Control
|
|
@@ -931,10 +947,10 @@ module.exports = function (RED) {
|
|
|
931
947
|
debug("Control %s ->", device.id, JSON.stringify(message));
|
|
932
948
|
homebridge.HAPresourceByDeviceID(device.id, JSON.stringify(message), function (err, status) {
|
|
933
949
|
if (!err) {
|
|
934
|
-
|
|
935
|
-
|
|
950
|
+
// debug("Controlled %s ->", device.id, JSON.stringify(payload));
|
|
951
|
+
// debug("Payload %s ->", device.id, status);
|
|
936
952
|
node.status({
|
|
937
|
-
text: JSON.stringify(payload).slice(0,
|
|
953
|
+
text: JSON.stringify(payload).slice(0, 30) + '...',
|
|
938
954
|
shape: 'dot',
|
|
939
955
|
fill: 'green'
|
|
940
956
|
});
|
|
@@ -964,7 +980,7 @@ module.exports = function (RED) {
|
|
|
964
980
|
if (!err && status && status.characteristics[0].status === 0) {
|
|
965
981
|
debug("Controlled %s ->", device.id, JSON.stringify(status));
|
|
966
982
|
node.status({
|
|
967
|
-
text: JSON.stringify(payload).slice(0,
|
|
983
|
+
text: JSON.stringify(payload).slice(0, 30) + '...',
|
|
968
984
|
shape: 'dot',
|
|
969
985
|
fill: 'green'
|
|
970
986
|
});
|
|
@@ -976,7 +992,7 @@ module.exports = function (RED) {
|
|
|
976
992
|
} else if (!err) {
|
|
977
993
|
debug("Controlled %s ->", device.id, payload);
|
|
978
994
|
node.status({
|
|
979
|
-
text: JSON.stringify(payload).slice(0,
|
|
995
|
+
text: JSON.stringify(payload).slice(0, 30) + '...',
|
|
980
996
|
shape: 'dot',
|
|
981
997
|
fill: 'green'
|
|
982
998
|
});
|