node-red-contrib-homebridge-automation 0.3.0-beta.9 → 0.3.0
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 -0
- package/package.json +8 -8
- package/src/hbConfigNode.js +7 -4
- package/src/hbControlNode.js +16 -4
- package/test/node-red/flows.json +333 -127
- package/.github/npm-version-script.js +0 -97
package/README.md
CHANGED
|
@@ -200,6 +200,7 @@ With a plugin, you can see if it supports Real Time events, by opening the Home
|
|
|
200
200
|
- Add common supported types Window, Window Covering, Light Sensor #151, tks @HDeKnop
|
|
201
201
|
- HB-Control Node Turns Off then On when this message is received #152
|
|
202
202
|
- Added `Debug logging` configuration option that creates a file `homebridge-automation-endpoints.json`, which contains all the homebridge devices discovered. It can be used as part of troubleshooting device issues.
|
|
203
|
+
- Fix for some camara devices not outputing events
|
|
203
204
|
|
|
204
205
|
# Backlog / Roadmap
|
|
205
206
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-homebridge-automation",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "NodeRED Automation for HomeBridge",
|
|
5
5
|
"main": "src/HAP-NodeRed.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@types/node-red": "^1.3.5",
|
|
29
29
|
"@types/jest": "^29.5.14",
|
|
30
30
|
"@eslint/js": "^9.16.0",
|
|
31
|
-
"eslint": "^
|
|
32
|
-
"eslint-plugin-format": "^0.
|
|
33
|
-
"eslint-plugin-jest": "^
|
|
34
|
-
"globals": "^
|
|
31
|
+
"eslint": "^9.36.0",
|
|
32
|
+
"eslint-plugin-format": "^1.0.2",
|
|
33
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
34
|
+
"globals": "^16.4.0",
|
|
35
35
|
"jest": "^29.7.0",
|
|
36
36
|
"node-red": "^4.0.2",
|
|
37
37
|
"node-red-node-test-helper": "^0.3.4",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"better-queue": ">=3.8.12",
|
|
44
|
-
"debug": "^4.
|
|
45
|
-
"@homebridge/hap-client": "^
|
|
44
|
+
"debug": "^4.4.1",
|
|
45
|
+
"@homebridge/hap-client": "^3.1.1"
|
|
46
46
|
},
|
|
47
47
|
"author": "NorthernMan54",
|
|
48
48
|
"license": "ISC",
|
|
@@ -76,4 +76,4 @@
|
|
|
76
76
|
"!src/test-utils"
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
package/src/hbConfigNode.js
CHANGED
|
@@ -88,9 +88,9 @@ class HBConfigNode {
|
|
|
88
88
|
|
|
89
89
|
toList(perms) {
|
|
90
90
|
const supportedTypes = new Set([
|
|
91
|
-
'Battery', 'Carbon Dioxide Sensor', 'Carbon Monoxide Sensor', 'Camera Rtp Stream Management',
|
|
91
|
+
'Air Purifier', 'Air Quality Sensor', 'Battery', 'Carbon Dioxide Sensor', 'Carbon Monoxide Sensor', 'Camera Rtp Stream Management',
|
|
92
92
|
'Doorbell', 'Fan', 'Fanv2', 'Garage Door Opener', 'Humidity Sensor', 'Input Source',
|
|
93
|
-
'Leak Sensor', 'Lightbulb', 'Lock Mechanism', 'Motion Sensor', 'Occupancy Sensor',
|
|
93
|
+
'Leak Sensor', 'Light Sensor', 'Lightbulb', 'Lock Mechanism', 'Motion Sensor', 'Occupancy Sensor',
|
|
94
94
|
'Outlet', 'Smoke Sensor', 'Speaker', 'Stateless Programmable Switch', 'Switch',
|
|
95
95
|
'Television', 'Temperature Sensor', 'Thermostat', 'Contact Sensor',
|
|
96
96
|
'Window', 'Window Covering', 'Light Sensor'
|
|
@@ -174,8 +174,11 @@ class HBConfigNode {
|
|
|
174
174
|
this.monitor = await this.hapClient.monitorCharacteristics(monitorNodes);
|
|
175
175
|
this.monitor.on('service-update', (services) => {
|
|
176
176
|
services.forEach(service => {
|
|
177
|
-
const eventNodes = Object.values(this.clientNodes).filter(clientNode =>
|
|
178
|
-
|
|
177
|
+
const eventNodes = Object.values(this.clientNodes).filter(clientNode => {
|
|
178
|
+
const deviceIdentifier = `${service.instance.name}${service.instance.username}${service.accessoryInformation.Manufacturer}${(service.accessoryInformation.Name ? service.accessoryInformation.Name : service.serviceName)}${service.uuid.slice(0, 8)}`;
|
|
179
|
+
// debug('service-update: compare', clientNode.config.device, deviceIdentifier);
|
|
180
|
+
return clientNode.config.device === deviceIdentifier;
|
|
181
|
+
}
|
|
179
182
|
);
|
|
180
183
|
// debug('service-update', service.serviceName, eventNodes);
|
|
181
184
|
eventNodes.forEach(eventNode => eventNode.emit('hbEvent', service));
|
package/src/hbControlNode.js
CHANGED
|
@@ -17,12 +17,12 @@ class HbControlNode extends hbBaseNode {
|
|
|
17
17
|
const isCamera = this.hbDevice.type === 'CameraRTPStreamManagement';
|
|
18
18
|
const payloadType = typeof message.payload;
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// Is the payload a valid JSON object?
|
|
21
|
+
|
|
21
22
|
if (!isCamera && payloadType !== 'object') {
|
|
22
23
|
const validNames = Object.keys(this.hbDevice.values)
|
|
23
24
|
.filter(key => key !== 'ConfiguredName')
|
|
24
25
|
.join(', ');
|
|
25
|
-
|
|
26
26
|
this.error(
|
|
27
27
|
`Invalid payload. Expected JSON object, e.g., {"On":false, "Brightness":0}. Valid values: ${validNames}`
|
|
28
28
|
);
|
|
@@ -30,6 +30,16 @@ class HbControlNode extends hbBaseNode {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// Validate payload
|
|
34
|
+
let keysToKeep = Object.keys(this.hbDevice.values);
|
|
35
|
+
|
|
36
|
+
Object.keys(message.payload).forEach(key => {
|
|
37
|
+
if (!keysToKeep.includes(key)) {
|
|
38
|
+
this.handleWarning(`Unhandled Characteristic '${key}'`);
|
|
39
|
+
delete message.payload[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
33
43
|
const results = [];
|
|
34
44
|
let fill = 'green';
|
|
35
45
|
|
|
@@ -50,11 +60,13 @@ class HbControlNode extends hbBaseNode {
|
|
|
50
60
|
} else {
|
|
51
61
|
// Handle other characteristics
|
|
52
62
|
try {
|
|
63
|
+
// debug('Setting value for', message.payload);
|
|
53
64
|
const result = await this.hbDevice.setCharacteristicsByTypes(filterIfOff(message.payload));
|
|
65
|
+
// debug('Result', result.values);
|
|
54
66
|
results.push(result.values);
|
|
55
67
|
} catch (error) {
|
|
56
|
-
this.error(
|
|
57
|
-
results.push({
|
|
68
|
+
this.error(`${error.message} for ${JSON.stringify(message.payload)}`);
|
|
69
|
+
results.push({ Error: `${error.message} for ${JSON.stringify(message.payload)}` });
|
|
58
70
|
fill = 'red';
|
|
59
71
|
this.hbConfigNode.disconnectClientNodes(this.hbDevice.instance);
|
|
60
72
|
}
|
package/test/node-red/flows.json
CHANGED
|
@@ -54,37 +54,6 @@
|
|
|
54
54
|
"macAddress": "",
|
|
55
55
|
"debug": true
|
|
56
56
|
},
|
|
57
|
-
{
|
|
58
|
-
"id": "df5dd49178c517fa",
|
|
59
|
-
"type": "mqtt-broker",
|
|
60
|
-
"name": "",
|
|
61
|
-
"broker": "mqtt.local",
|
|
62
|
-
"port": "1883",
|
|
63
|
-
"clientid": "",
|
|
64
|
-
"autoConnect": true,
|
|
65
|
-
"usetls": false,
|
|
66
|
-
"protocolVersion": "4",
|
|
67
|
-
"keepalive": "60",
|
|
68
|
-
"cleansession": true,
|
|
69
|
-
"autoUnsubscribe": true,
|
|
70
|
-
"birthTopic": "",
|
|
71
|
-
"birthQos": "0",
|
|
72
|
-
"birthRetain": "false",
|
|
73
|
-
"birthPayload": "",
|
|
74
|
-
"birthMsg": {},
|
|
75
|
-
"closeTopic": "",
|
|
76
|
-
"closeQos": "0",
|
|
77
|
-
"closeRetain": "false",
|
|
78
|
-
"closePayload": "",
|
|
79
|
-
"closeMsg": {},
|
|
80
|
-
"willTopic": "",
|
|
81
|
-
"willQos": "0",
|
|
82
|
-
"willRetain": "false",
|
|
83
|
-
"willPayload": "",
|
|
84
|
-
"willMsg": {},
|
|
85
|
-
"userProps": "",
|
|
86
|
-
"sessionExpiry": ""
|
|
87
|
-
},
|
|
88
57
|
{
|
|
89
58
|
"id": "902c5887b6877df6",
|
|
90
59
|
"type": "debug",
|
|
@@ -2629,28 +2598,41 @@
|
|
|
2629
2598
|
]
|
|
2630
2599
|
},
|
|
2631
2600
|
{
|
|
2632
|
-
"id": "
|
|
2633
|
-
"type": "
|
|
2601
|
+
"id": "50af5bb963e4a186",
|
|
2602
|
+
"type": "hb-resume",
|
|
2634
2603
|
"z": "4138921fd7b9a926",
|
|
2635
|
-
"name": "",
|
|
2636
|
-
"
|
|
2637
|
-
"
|
|
2638
|
-
"
|
|
2639
|
-
"
|
|
2640
|
-
"
|
|
2641
|
-
"
|
|
2642
|
-
"
|
|
2643
|
-
"inputs": 0,
|
|
2644
|
-
"x": 130,
|
|
2645
|
-
"y": 180,
|
|
2604
|
+
"name": "Floor Lamp One",
|
|
2605
|
+
"Homebridge": "homebridge",
|
|
2606
|
+
"Manufacturer": "Signify Netherlands B.V.",
|
|
2607
|
+
"Service": "Lightbulb",
|
|
2608
|
+
"device": "homebridgeCC:22:3D:E3:CF:33Signify Netherlands B.V.Floor Lamp One00000043",
|
|
2609
|
+
"conf": "7e647d67.f33acc",
|
|
2610
|
+
"x": 500,
|
|
2611
|
+
"y": 80,
|
|
2646
2612
|
"wires": [
|
|
2647
2613
|
[
|
|
2648
|
-
"
|
|
2614
|
+
"8ba7a5a4aa28dc2f",
|
|
2615
|
+
"29580d01ef2e651d"
|
|
2649
2616
|
]
|
|
2650
2617
|
]
|
|
2651
2618
|
},
|
|
2652
2619
|
{
|
|
2653
|
-
"id": "
|
|
2620
|
+
"id": "8ba7a5a4aa28dc2f",
|
|
2621
|
+
"type": "hb-control",
|
|
2622
|
+
"z": "4138921fd7b9a926",
|
|
2623
|
+
"name": "Floor Lamp One",
|
|
2624
|
+
"Homebridge": "homebridge",
|
|
2625
|
+
"Manufacturer": "Signify Netherlands B.V.",
|
|
2626
|
+
"Service": "Lightbulb",
|
|
2627
|
+
"device": "homebridgeCC:22:3D:E3:CF:33Signify Netherlands B.V.Floor Lamp One00000043",
|
|
2628
|
+
"conf": "7e647d67.f33acc",
|
|
2629
|
+
"outputs": 0,
|
|
2630
|
+
"x": 720,
|
|
2631
|
+
"y": 80,
|
|
2632
|
+
"wires": []
|
|
2633
|
+
},
|
|
2634
|
+
{
|
|
2635
|
+
"id": "29580d01ef2e651d",
|
|
2654
2636
|
"type": "debug",
|
|
2655
2637
|
"z": "4138921fd7b9a926",
|
|
2656
2638
|
"name": "debug 17",
|
|
@@ -2660,141 +2642,255 @@
|
|
|
2660
2642
|
"tostatus": true,
|
|
2661
2643
|
"complete": "payload",
|
|
2662
2644
|
"targetType": "msg",
|
|
2663
|
-
"statusVal": "
|
|
2664
|
-
"statusType": "
|
|
2645
|
+
"statusVal": "payload",
|
|
2646
|
+
"statusType": "auto",
|
|
2665
2647
|
"x": 720,
|
|
2666
2648
|
"y": 140,
|
|
2667
2649
|
"wires": []
|
|
2668
2650
|
},
|
|
2669
2651
|
{
|
|
2670
|
-
"id": "
|
|
2671
|
-
"type": "
|
|
2652
|
+
"id": "b3c8e4dcd5b62de4",
|
|
2653
|
+
"type": "inject",
|
|
2672
2654
|
"z": "4138921fd7b9a926",
|
|
2673
2655
|
"name": "",
|
|
2674
|
-
"
|
|
2675
|
-
"propertyType": "msg",
|
|
2676
|
-
"rules": [
|
|
2656
|
+
"props": [
|
|
2677
2657
|
{
|
|
2678
|
-
"
|
|
2679
|
-
"v": "SYStoMQTT",
|
|
2680
|
-
"vt": "str"
|
|
2658
|
+
"p": "payload"
|
|
2681
2659
|
},
|
|
2682
2660
|
{
|
|
2683
|
-
"
|
|
2684
|
-
"v": "version",
|
|
2661
|
+
"p": "topic",
|
|
2685
2662
|
"vt": "str"
|
|
2663
|
+
}
|
|
2664
|
+
],
|
|
2665
|
+
"repeat": "",
|
|
2666
|
+
"crontab": "",
|
|
2667
|
+
"once": false,
|
|
2668
|
+
"onceDelay": 0.1,
|
|
2669
|
+
"topic": "",
|
|
2670
|
+
"payload": "{\"On\": true}",
|
|
2671
|
+
"payloadType": "json",
|
|
2672
|
+
"x": 170,
|
|
2673
|
+
"y": 80,
|
|
2674
|
+
"wires": [
|
|
2675
|
+
[
|
|
2676
|
+
"50af5bb963e4a186"
|
|
2677
|
+
]
|
|
2678
|
+
]
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
"id": "a74ef133a980c5f3",
|
|
2682
|
+
"type": "inject",
|
|
2683
|
+
"z": "4138921fd7b9a926",
|
|
2684
|
+
"name": "",
|
|
2685
|
+
"props": [
|
|
2686
|
+
{
|
|
2687
|
+
"p": "payload"
|
|
2686
2688
|
},
|
|
2687
2689
|
{
|
|
2688
|
-
"
|
|
2689
|
-
"v": "LWT",
|
|
2690
|
+
"p": "topic",
|
|
2690
2691
|
"vt": "str"
|
|
2692
|
+
}
|
|
2693
|
+
],
|
|
2694
|
+
"repeat": "",
|
|
2695
|
+
"crontab": "",
|
|
2696
|
+
"once": false,
|
|
2697
|
+
"onceDelay": 0.1,
|
|
2698
|
+
"topic": "",
|
|
2699
|
+
"payload": "{\"On\": false}",
|
|
2700
|
+
"payloadType": "json",
|
|
2701
|
+
"x": 170,
|
|
2702
|
+
"y": 140,
|
|
2703
|
+
"wires": [
|
|
2704
|
+
[
|
|
2705
|
+
"50af5bb963e4a186"
|
|
2706
|
+
]
|
|
2707
|
+
]
|
|
2708
|
+
},
|
|
2709
|
+
{
|
|
2710
|
+
"id": "1e6b8797f5279a1f",
|
|
2711
|
+
"type": "inject",
|
|
2712
|
+
"z": "4138921fd7b9a926",
|
|
2713
|
+
"name": "{\"Brightness\":40,\"On\":true,\"ColorTemperature\":242}",
|
|
2714
|
+
"props": [
|
|
2715
|
+
{
|
|
2716
|
+
"p": "payload"
|
|
2691
2717
|
},
|
|
2692
2718
|
{
|
|
2693
|
-
"
|
|
2719
|
+
"p": "topic",
|
|
2720
|
+
"vt": "str"
|
|
2694
2721
|
}
|
|
2695
2722
|
],
|
|
2696
|
-
"
|
|
2697
|
-
"
|
|
2698
|
-
"
|
|
2699
|
-
"
|
|
2700
|
-
"
|
|
2723
|
+
"repeat": "",
|
|
2724
|
+
"crontab": "",
|
|
2725
|
+
"once": false,
|
|
2726
|
+
"onceDelay": 0.1,
|
|
2727
|
+
"topic": "",
|
|
2728
|
+
"payload": "{\"Brightness\":40,\"On\":true,\"ColorTemperature\":242}",
|
|
2729
|
+
"payloadType": "json",
|
|
2730
|
+
"x": 290,
|
|
2731
|
+
"y": 260,
|
|
2701
2732
|
"wires": [
|
|
2702
2733
|
[
|
|
2703
|
-
"
|
|
2704
|
-
]
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2734
|
+
"50af5bb963e4a186"
|
|
2735
|
+
]
|
|
2736
|
+
]
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
"id": "4bb2bae9fe4ffbbb",
|
|
2740
|
+
"type": "hb-status",
|
|
2741
|
+
"z": "4138921fd7b9a926",
|
|
2742
|
+
"name": "Floor Lamp One",
|
|
2743
|
+
"Homebridge": "homebridge",
|
|
2744
|
+
"Manufacturer": "Signify Netherlands B.V.",
|
|
2745
|
+
"Service": "Lightbulb",
|
|
2746
|
+
"device": "homebridgeCC:22:3D:E3:CF:33Signify Netherlands B.V.Floor Lamp One00000043",
|
|
2747
|
+
"conf": "7e647d67.f33acc",
|
|
2748
|
+
"x": 300,
|
|
2749
|
+
"y": 440,
|
|
2750
|
+
"wires": [
|
|
2709
2751
|
[
|
|
2710
|
-
"
|
|
2752
|
+
"96ad615138d1254e"
|
|
2711
2753
|
]
|
|
2712
2754
|
]
|
|
2713
2755
|
},
|
|
2714
2756
|
{
|
|
2715
|
-
"id": "
|
|
2757
|
+
"id": "96ad615138d1254e",
|
|
2716
2758
|
"type": "debug",
|
|
2717
2759
|
"z": "4138921fd7b9a926",
|
|
2718
2760
|
"name": "debug 18",
|
|
2719
|
-
"active":
|
|
2761
|
+
"active": true,
|
|
2720
2762
|
"tosidebar": true,
|
|
2721
2763
|
"console": false,
|
|
2722
2764
|
"tostatus": true,
|
|
2723
|
-
"complete": "
|
|
2724
|
-
"targetType": "
|
|
2725
|
-
"statusVal": "
|
|
2765
|
+
"complete": "payload",
|
|
2766
|
+
"targetType": "msg",
|
|
2767
|
+
"statusVal": "payload",
|
|
2726
2768
|
"statusType": "auto",
|
|
2727
|
-
"x":
|
|
2728
|
-
"y":
|
|
2769
|
+
"x": 520,
|
|
2770
|
+
"y": 400,
|
|
2729
2771
|
"wires": []
|
|
2730
2772
|
},
|
|
2731
2773
|
{
|
|
2732
|
-
"id": "
|
|
2733
|
-
"type": "
|
|
2774
|
+
"id": "7b085aa32101811e",
|
|
2775
|
+
"type": "hb-event",
|
|
2734
2776
|
"z": "4138921fd7b9a926",
|
|
2735
|
-
"name": "
|
|
2736
|
-
"
|
|
2737
|
-
"
|
|
2738
|
-
"
|
|
2739
|
-
"
|
|
2740
|
-
"
|
|
2741
|
-
"
|
|
2742
|
-
"
|
|
2743
|
-
"
|
|
2744
|
-
"
|
|
2777
|
+
"name": "Floor Lamp One",
|
|
2778
|
+
"Homebridge": "homebridge",
|
|
2779
|
+
"Manufacturer": "Signify Netherlands B.V.",
|
|
2780
|
+
"Service": "Lightbulb",
|
|
2781
|
+
"device": "homebridgeCC:22:3D:E3:CF:33Signify Netherlands B.V.Floor Lamp One00000043",
|
|
2782
|
+
"conf": "7e647d67.f33acc",
|
|
2783
|
+
"sendInitialState": true,
|
|
2784
|
+
"x": 300,
|
|
2785
|
+
"y": 360,
|
|
2786
|
+
"wires": [
|
|
2787
|
+
[
|
|
2788
|
+
"96ad615138d1254e"
|
|
2789
|
+
]
|
|
2790
|
+
]
|
|
2791
|
+
},
|
|
2792
|
+
{
|
|
2793
|
+
"id": "247bb4b9017d5ed3",
|
|
2794
|
+
"type": "catch",
|
|
2795
|
+
"z": "4138921fd7b9a926",
|
|
2796
|
+
"name": "",
|
|
2797
|
+
"scope": null,
|
|
2798
|
+
"uncaught": false,
|
|
2799
|
+
"x": 280,
|
|
2800
|
+
"y": 520,
|
|
2745
2801
|
"wires": [
|
|
2746
2802
|
[
|
|
2747
|
-
"
|
|
2748
|
-
"45cb1d621afc9b52"
|
|
2803
|
+
"ecfe37f30b4b452f"
|
|
2749
2804
|
]
|
|
2750
2805
|
]
|
|
2751
2806
|
},
|
|
2752
2807
|
{
|
|
2753
|
-
"id": "
|
|
2808
|
+
"id": "ecfe37f30b4b452f",
|
|
2754
2809
|
"type": "debug",
|
|
2755
2810
|
"z": "4138921fd7b9a926",
|
|
2756
2811
|
"name": "debug 19",
|
|
2757
|
-
"active":
|
|
2812
|
+
"active": true,
|
|
2758
2813
|
"tosidebar": true,
|
|
2759
2814
|
"console": false,
|
|
2760
2815
|
"tostatus": true,
|
|
2761
2816
|
"complete": "payload",
|
|
2762
2817
|
"targetType": "msg",
|
|
2763
|
-
"statusVal": "
|
|
2764
|
-
"statusType": "
|
|
2765
|
-
"x":
|
|
2766
|
-
"y":
|
|
2818
|
+
"statusVal": "payload",
|
|
2819
|
+
"statusType": "auto",
|
|
2820
|
+
"x": 540,
|
|
2821
|
+
"y": 520,
|
|
2767
2822
|
"wires": []
|
|
2768
2823
|
},
|
|
2769
2824
|
{
|
|
2770
|
-
"id": "
|
|
2825
|
+
"id": "f775ab948cea1532",
|
|
2826
|
+
"type": "status",
|
|
2827
|
+
"z": "4138921fd7b9a926",
|
|
2828
|
+
"name": "",
|
|
2829
|
+
"scope": null,
|
|
2830
|
+
"x": 280,
|
|
2831
|
+
"y": 580,
|
|
2832
|
+
"wires": [
|
|
2833
|
+
[]
|
|
2834
|
+
]
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
"id": "dd3e9950ef4f1482",
|
|
2771
2838
|
"type": "debug",
|
|
2772
2839
|
"z": "4138921fd7b9a926",
|
|
2773
2840
|
"name": "debug 20",
|
|
2774
|
-
"active":
|
|
2841
|
+
"active": true,
|
|
2775
2842
|
"tosidebar": true,
|
|
2776
2843
|
"console": false,
|
|
2777
2844
|
"tostatus": true,
|
|
2778
|
-
"complete": "
|
|
2779
|
-
"targetType": "
|
|
2780
|
-
"statusVal": "
|
|
2781
|
-
"statusType": "
|
|
2782
|
-
"x":
|
|
2783
|
-
"y":
|
|
2845
|
+
"complete": "true",
|
|
2846
|
+
"targetType": "full",
|
|
2847
|
+
"statusVal": "payload",
|
|
2848
|
+
"statusType": "auto",
|
|
2849
|
+
"x": 540,
|
|
2850
|
+
"y": 580,
|
|
2784
2851
|
"wires": []
|
|
2785
2852
|
},
|
|
2853
|
+
{
|
|
2854
|
+
"id": "64d1e3d573689b65",
|
|
2855
|
+
"type": "inject",
|
|
2856
|
+
"z": "4138921fd7b9a926",
|
|
2857
|
+
"name": "",
|
|
2858
|
+
"props": [
|
|
2859
|
+
{
|
|
2860
|
+
"p": "payload"
|
|
2861
|
+
},
|
|
2862
|
+
{
|
|
2863
|
+
"p": "topic",
|
|
2864
|
+
"vt": "str"
|
|
2865
|
+
}
|
|
2866
|
+
],
|
|
2867
|
+
"repeat": "",
|
|
2868
|
+
"crontab": "",
|
|
2869
|
+
"once": false,
|
|
2870
|
+
"onceDelay": 0.1,
|
|
2871
|
+
"topic": "",
|
|
2872
|
+
"payload": "{\"ColorTemperature\": false}",
|
|
2873
|
+
"payloadType": "json",
|
|
2874
|
+
"x": 150,
|
|
2875
|
+
"y": 200,
|
|
2876
|
+
"wires": [
|
|
2877
|
+
[
|
|
2878
|
+
"8ba7a5a4aa28dc2f"
|
|
2879
|
+
]
|
|
2880
|
+
]
|
|
2881
|
+
},
|
|
2786
2882
|
{
|
|
2787
2883
|
"id": "6df154716efd4949",
|
|
2788
2884
|
"type": "hb-event",
|
|
2789
2885
|
"z": "92f59d974b9c8a86",
|
|
2790
|
-
"name": "
|
|
2791
|
-
"Homebridge": "
|
|
2792
|
-
"Manufacturer": "
|
|
2886
|
+
"name": "North Sidewalk 6EED",
|
|
2887
|
+
"Homebridge": "ECI-T24F2",
|
|
2888
|
+
"Manufacturer": "HikVision",
|
|
2793
2889
|
"Service": "MotionSensor",
|
|
2794
|
-
"device": "
|
|
2890
|
+
"device": "ECI-T24F28E:88:AB:7A:D0:54HikVisionNorth Sidewalk 6EED00000085",
|
|
2795
2891
|
"conf": "7e647d67.f33acc",
|
|
2796
2892
|
"sendInitialState": true,
|
|
2797
|
-
"x":
|
|
2893
|
+
"x": 140,
|
|
2798
2894
|
"y": 220,
|
|
2799
2895
|
"wires": [
|
|
2800
2896
|
[
|
|
@@ -2820,7 +2916,7 @@
|
|
|
2820
2916
|
"checkall": "true",
|
|
2821
2917
|
"repair": false,
|
|
2822
2918
|
"outputs": 1,
|
|
2823
|
-
"x":
|
|
2919
|
+
"x": 370,
|
|
2824
2920
|
"y": 220,
|
|
2825
2921
|
"wires": [
|
|
2826
2922
|
[
|
|
@@ -2847,7 +2943,7 @@
|
|
|
2847
2943
|
"from": "",
|
|
2848
2944
|
"to": "",
|
|
2849
2945
|
"reg": false,
|
|
2850
|
-
"x":
|
|
2946
|
+
"x": 540,
|
|
2851
2947
|
"y": 220,
|
|
2852
2948
|
"wires": [
|
|
2853
2949
|
[
|
|
@@ -2859,14 +2955,14 @@
|
|
|
2859
2955
|
"id": "769d2de2c6bd3544",
|
|
2860
2956
|
"type": "hb-control",
|
|
2861
2957
|
"z": "92f59d974b9c8a86",
|
|
2862
|
-
"name": "
|
|
2863
|
-
"Homebridge": "
|
|
2864
|
-
"Manufacturer": "
|
|
2958
|
+
"name": "North Sidewalk 6EED",
|
|
2959
|
+
"Homebridge": "ECI-T24F2",
|
|
2960
|
+
"Manufacturer": "HikVision",
|
|
2865
2961
|
"Service": "CameraRTPStreamManagement",
|
|
2866
|
-
"device": "
|
|
2962
|
+
"device": "ECI-T24F28E:88:AB:7A:D0:54HikVisionNorth Sidewalk 6EED00000110",
|
|
2867
2963
|
"conf": "7e647d67.f33acc",
|
|
2868
2964
|
"outputs": 1,
|
|
2869
|
-
"x":
|
|
2965
|
+
"x": 760,
|
|
2870
2966
|
"y": 220,
|
|
2871
2967
|
"wires": [
|
|
2872
2968
|
[
|
|
@@ -2881,13 +2977,13 @@
|
|
|
2881
2977
|
"name": "debug 21",
|
|
2882
2978
|
"active": true,
|
|
2883
2979
|
"tosidebar": true,
|
|
2884
|
-
"console":
|
|
2980
|
+
"console": true,
|
|
2885
2981
|
"tostatus": true,
|
|
2886
2982
|
"complete": "payload",
|
|
2887
2983
|
"targetType": "msg",
|
|
2888
2984
|
"statusVal": "payload",
|
|
2889
2985
|
"statusType": "auto",
|
|
2890
|
-
"x":
|
|
2986
|
+
"x": 850,
|
|
2891
2987
|
"y": 280,
|
|
2892
2988
|
"wires": []
|
|
2893
2989
|
},
|
|
@@ -2928,7 +3024,7 @@
|
|
|
2928
3024
|
"checkall": "true",
|
|
2929
3025
|
"repair": false,
|
|
2930
3026
|
"outputs": 1,
|
|
2931
|
-
"x":
|
|
3027
|
+
"x": 330,
|
|
2932
3028
|
"y": 340,
|
|
2933
3029
|
"wires": [
|
|
2934
3030
|
[
|
|
@@ -2955,7 +3051,7 @@
|
|
|
2955
3051
|
"from": "",
|
|
2956
3052
|
"to": "",
|
|
2957
3053
|
"reg": false,
|
|
2958
|
-
"x":
|
|
3054
|
+
"x": 540,
|
|
2959
3055
|
"y": 340,
|
|
2960
3056
|
"wires": [
|
|
2961
3057
|
[
|
|
@@ -2974,7 +3070,7 @@
|
|
|
2974
3070
|
"device": "ECI-T24F2CB:6F:94:DD:43:77HikVisionDriveway 8E5200000110",
|
|
2975
3071
|
"conf": "7e647d67.f33acc",
|
|
2976
3072
|
"outputs": 1,
|
|
2977
|
-
"x":
|
|
3073
|
+
"x": 740,
|
|
2978
3074
|
"y": 340,
|
|
2979
3075
|
"wires": [
|
|
2980
3076
|
[
|
|
@@ -3018,13 +3114,13 @@
|
|
|
3018
3114
|
"name": "debug 22",
|
|
3019
3115
|
"active": true,
|
|
3020
3116
|
"tosidebar": true,
|
|
3021
|
-
"console":
|
|
3117
|
+
"console": true,
|
|
3022
3118
|
"tostatus": true,
|
|
3023
3119
|
"complete": "payload",
|
|
3024
3120
|
"targetType": "msg",
|
|
3025
3121
|
"statusVal": "payload",
|
|
3026
3122
|
"statusType": "auto",
|
|
3027
|
-
"x":
|
|
3123
|
+
"x": 710,
|
|
3028
3124
|
"y": 500,
|
|
3029
3125
|
"wires": []
|
|
3030
3126
|
},
|
|
@@ -3056,5 +3152,115 @@
|
|
|
3056
3152
|
"d376945f7d6314f9"
|
|
3057
3153
|
]
|
|
3058
3154
|
]
|
|
3155
|
+
},
|
|
3156
|
+
{
|
|
3157
|
+
"id": "448a23fd99b4e52a",
|
|
3158
|
+
"type": "hb-event",
|
|
3159
|
+
"z": "92f59d974b9c8a86",
|
|
3160
|
+
"name": "Side door",
|
|
3161
|
+
"Homebridge": "homebridge",
|
|
3162
|
+
"Manufacturer": "Eufy",
|
|
3163
|
+
"Service": "MotionSensor",
|
|
3164
|
+
"device": "homebridge0E:89:A7:DA:D3:21EufySide door00000085",
|
|
3165
|
+
"conf": "7e647d67.f33acc",
|
|
3166
|
+
"sendInitialState": true,
|
|
3167
|
+
"x": 100,
|
|
3168
|
+
"y": 420,
|
|
3169
|
+
"wires": [
|
|
3170
|
+
[
|
|
3171
|
+
"943911317b27b4bc",
|
|
3172
|
+
"5b0570544efae122"
|
|
3173
|
+
]
|
|
3174
|
+
]
|
|
3175
|
+
},
|
|
3176
|
+
{
|
|
3177
|
+
"id": "5b0570544efae122",
|
|
3178
|
+
"type": "switch",
|
|
3179
|
+
"z": "92f59d974b9c8a86",
|
|
3180
|
+
"name": "",
|
|
3181
|
+
"property": "payload.MotionDetected",
|
|
3182
|
+
"propertyType": "msg",
|
|
3183
|
+
"rules": [
|
|
3184
|
+
{
|
|
3185
|
+
"t": "eq",
|
|
3186
|
+
"v": "1",
|
|
3187
|
+
"vt": "num"
|
|
3188
|
+
}
|
|
3189
|
+
],
|
|
3190
|
+
"checkall": "true",
|
|
3191
|
+
"repair": false,
|
|
3192
|
+
"outputs": 1,
|
|
3193
|
+
"x": 330,
|
|
3194
|
+
"y": 420,
|
|
3195
|
+
"wires": [
|
|
3196
|
+
[
|
|
3197
|
+
"7840c24c88d831cc"
|
|
3198
|
+
]
|
|
3199
|
+
]
|
|
3200
|
+
},
|
|
3201
|
+
{
|
|
3202
|
+
"id": "7840c24c88d831cc",
|
|
3203
|
+
"type": "change",
|
|
3204
|
+
"z": "92f59d974b9c8a86",
|
|
3205
|
+
"name": "",
|
|
3206
|
+
"rules": [
|
|
3207
|
+
{
|
|
3208
|
+
"t": "set",
|
|
3209
|
+
"p": "payload",
|
|
3210
|
+
"pt": "msg",
|
|
3211
|
+
"to": "",
|
|
3212
|
+
"tot": "date"
|
|
3213
|
+
}
|
|
3214
|
+
],
|
|
3215
|
+
"action": "",
|
|
3216
|
+
"property": "",
|
|
3217
|
+
"from": "",
|
|
3218
|
+
"to": "",
|
|
3219
|
+
"reg": false,
|
|
3220
|
+
"x": 540,
|
|
3221
|
+
"y": 420,
|
|
3222
|
+
"wires": [
|
|
3223
|
+
[
|
|
3224
|
+
"389516e4379cfcc8"
|
|
3225
|
+
]
|
|
3226
|
+
]
|
|
3227
|
+
},
|
|
3228
|
+
{
|
|
3229
|
+
"id": "389516e4379cfcc8",
|
|
3230
|
+
"type": "hb-control",
|
|
3231
|
+
"z": "92f59d974b9c8a86",
|
|
3232
|
+
"name": "Side door",
|
|
3233
|
+
"Homebridge": "homebridge",
|
|
3234
|
+
"Manufacturer": "Eufy",
|
|
3235
|
+
"Service": "CameraRTPStreamManagement",
|
|
3236
|
+
"device": "homebridge0E:89:A7:DA:D3:21EufySide door00000110",
|
|
3237
|
+
"conf": "7e647d67.f33acc",
|
|
3238
|
+
"outputs": 1,
|
|
3239
|
+
"x": 720,
|
|
3240
|
+
"y": 420,
|
|
3241
|
+
"wires": [
|
|
3242
|
+
[
|
|
3243
|
+
"1c18c4d5c4cd94db"
|
|
3244
|
+
]
|
|
3245
|
+
]
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
"id": "2802a70d3cd5570b",
|
|
3249
|
+
"type": "hb-event",
|
|
3250
|
+
"z": "92f59d974b9c8a86",
|
|
3251
|
+
"name": "Canoe 5036",
|
|
3252
|
+
"Homebridge": "ECI-T24F2",
|
|
3253
|
+
"Manufacturer": "HikVision",
|
|
3254
|
+
"Service": "MotionSensor",
|
|
3255
|
+
"device": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe 503600000085",
|
|
3256
|
+
"conf": "7e647d67.f33acc",
|
|
3257
|
+
"sendInitialState": true,
|
|
3258
|
+
"x": 130,
|
|
3259
|
+
"y": 600,
|
|
3260
|
+
"wires": [
|
|
3261
|
+
[
|
|
3262
|
+
"943911317b27b4bc"
|
|
3263
|
+
]
|
|
3264
|
+
]
|
|
3059
3265
|
}
|
|
3060
3266
|
]
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This scripts queries the npm registry to pull out the latest version for a given tag.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const assert = require('node:assert')
|
|
8
|
-
const child_process = require('node:child_process')
|
|
9
|
-
const fs = require('node:fs')
|
|
10
|
-
const process = require('node:process')
|
|
11
|
-
|
|
12
|
-
const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
|
|
13
|
-
|
|
14
|
-
// Load the contents of the package.json file
|
|
15
|
-
const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
|
|
16
|
-
|
|
17
|
-
const refArgument = process.argv[2]
|
|
18
|
-
const tagArgument = process.argv[3] || 'latest'
|
|
19
|
-
|
|
20
|
-
if (!refArgument) {
|
|
21
|
-
console.error('ref argument is missing')
|
|
22
|
-
console.error('Usage: npm-version-script.js <ref> [tag]')
|
|
23
|
-
process.exit(1)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Queries the NPM registry for the latest version for the provided base version and tag.
|
|
28
|
-
* If the tag is latest, then the base version is returned if it exists. For other tags, the latest
|
|
29
|
-
* version found for that base version and tag is returned.
|
|
30
|
-
* @param baseVersion The base version to query for, e.g. 2.0.0
|
|
31
|
-
* @param tag The tag to query for, e.g. beta or latest
|
|
32
|
-
* @returns {string} Returns the version, or '' if not found
|
|
33
|
-
*/
|
|
34
|
-
function getTagVersionFromNpm(baseVersion, tag) {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(child_process.execSync(`npm info ${packageJSON.name} versions --json`).toString('utf8').trim())
|
|
37
|
-
.filter(v => tag === 'latest' ? v === baseVersion : v.startsWith(`${baseVersion}-${tag}.`)) // find all published versions for this base version and tag
|
|
38
|
-
.reduce((_, current) => current, '') // choose the last as they're sorted in ascending order, or '' if there are none
|
|
39
|
-
} catch (e) {
|
|
40
|
-
console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`, e)
|
|
41
|
-
// throw e;
|
|
42
|
-
return ''
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function desiredTargetVersion(ref) {
|
|
47
|
-
// ref is a GitHub action ref string
|
|
48
|
-
if (ref.startsWith('refs/pull/')) {
|
|
49
|
-
throw new Error('The version script was executed inside a PR!')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
assert(ref.startsWith('refs/heads/'))
|
|
53
|
-
const branchName = ref.slice('refs/heads/'.length)
|
|
54
|
-
|
|
55
|
-
const results = branchName.match(BRANCH_VERSION_PATTERN)
|
|
56
|
-
if (results !== null) {
|
|
57
|
-
if (results[1] !== tagArgument) {
|
|
58
|
-
console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return results[2]
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// derive the base version from the branch ref
|
|
68
|
-
const baseVersion = desiredTargetVersion(refArgument)
|
|
69
|
-
|
|
70
|
-
// query the npm registry for the latest version of the provided tag name
|
|
71
|
-
const latestReleasedVersion = getTagVersionFromNpm(baseVersion, tagArgument) // e.g. 0.7.0-beta.12
|
|
72
|
-
|
|
73
|
-
let publishTag
|
|
74
|
-
|
|
75
|
-
if (latestReleasedVersion) {
|
|
76
|
-
console.warn(`Latest published version for ${baseVersion} with tag ${tagArgument} is ${latestReleasedVersion}`)
|
|
77
|
-
publishTag = latestReleasedVersion // set this released beta or alpha to be incremented
|
|
78
|
-
} else {
|
|
79
|
-
console.warn(`No published versions for ${baseVersion} with tag ${tagArgument}`)
|
|
80
|
-
publishTag = baseVersion // start off with a new beta or alpha version
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (packageJSON.version !== publishTag) {
|
|
84
|
-
// report the change for CI
|
|
85
|
-
console.warn(`Changing version in package.json from ${packageJSON.version} to ${publishTag}`)
|
|
86
|
-
|
|
87
|
-
// save the package.json
|
|
88
|
-
packageJSON.version = publishTag
|
|
89
|
-
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
|
|
90
|
-
|
|
91
|
-
// perform the same change to the package-lock.json
|
|
92
|
-
const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
|
|
93
|
-
packageLockJSON.version = publishTag
|
|
94
|
-
fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))
|
|
95
|
-
} else {
|
|
96
|
-
console.warn(`Leaving version in package.json at ${packageJSON.version}`)
|
|
97
|
-
}
|