node-red-contrib-homebridge-automation 0.3.0-beta.0 → 0.3.0-beta.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.
package/README.md
CHANGED
|
@@ -35,7 +35,9 @@ The above Node-RED Flow, turns on my 'Outside Office' light when the powder room
|
|
|
35
35
|
* [Jan 11, 2023 - Version 0.1.7](#jan-11-2023---version-017)
|
|
36
36
|
* [Jan 15, 2023 - Version 0.1.8](#jan-15-2023---version-018)
|
|
37
37
|
* [Dec 15, 2024 - Version 0.2.0](#dec-15-2024---version-020)
|
|
38
|
-
* [April 15, 2025 - Version 0.
|
|
38
|
+
* [April 15, 2025 - Version 0.3.0](#april-15-2025---version-030)
|
|
39
|
+
* [Breaking Change](#breaking-change)
|
|
40
|
+
* [Fixes](#fixes)
|
|
39
41
|
* [Backlog / Roadmap](#backlog--roadmap)
|
|
40
42
|
* [Dropped items](#dropped-items)
|
|
41
43
|
* [Installation Steps](#installation-steps)
|
|
@@ -187,7 +189,13 @@ With a plugin, you can see if it supports Real Time events, by opening the Home
|
|
|
187
189
|
- With the change in connectivity to homebridge, please validate all your nodes are connected after the update. And pay particular attention to `Camera` nodes, as for some devices the name has changed.
|
|
188
190
|
- Testing and Development was completed on Node-RED version: v4.0.2 and Node.js version: v20.18.1
|
|
189
191
|
|
|
190
|
-
### April 15, 2025 - Version 0.
|
|
192
|
+
### April 15, 2025 - Version 0.3.0
|
|
193
|
+
|
|
194
|
+
#### Breaking Change
|
|
195
|
+
|
|
196
|
+
- Problem when choosing between multiple accessories with the same name #142. This fix has a breaking change for the name structure for Fans, Input Sources from TV's, and Camera's. And these devices will need to be configured again.
|
|
197
|
+
|
|
198
|
+
#### Fixes
|
|
191
199
|
|
|
192
200
|
- Add common supported types Window, Window Covering, Light Sensor #151, tks @HDeKnop
|
|
193
201
|
- HB-Control Node Turns Off then On when this message is received #152
|
package/package.json
CHANGED
package/src/hbConfigNode.test.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
const { HapClient } = require('@homebridge/hap-client');
|
|
3
3
|
const HBConfigNode = require('./hbConfigNode'); // Update the path as necessary
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
|
|
5
7
|
jest.mock('@homebridge/hap-client', () => {
|
|
6
8
|
return {
|
|
@@ -14,7 +16,7 @@ jest.mock('@homebridge/hap-client', () => {
|
|
|
14
16
|
};
|
|
15
17
|
});
|
|
16
18
|
|
|
17
|
-
describe
|
|
19
|
+
describe('Issue 142', () => {
|
|
18
20
|
let mockConfig;
|
|
19
21
|
let RED;
|
|
20
22
|
let node;
|
|
@@ -77,23 +79,85 @@ describe('HBConfigNode', () => {
|
|
|
77
79
|
|
|
78
80
|
test('Retrieve devices', async () => {
|
|
79
81
|
node.hapClient.getAllServices.mockResolvedValue(testhbDevices);
|
|
80
|
-
console.log('testhbDevices', testhbDevices);
|
|
81
82
|
await node.handleReady();
|
|
82
83
|
const result = node.toList({ perms: 'ev' });
|
|
83
84
|
expect(result).toEqual(testhbDevicesResult);
|
|
84
85
|
|
|
85
86
|
// Ensure the unsupported type was filtered out
|
|
86
87
|
expect(result.find(device => device.name === 'Garage Sensor')).toBeUndefined();
|
|
87
|
-
expect(result.find(device => device.name === 'Kitchen Curtain')).toBeDefined();
|
|
88
|
-
expect(result.find(device => device.name === 'Livingroom Curtain')).toBeDefined();
|
|
88
|
+
// expect(result.find(device => device.name === 'Kitchen Curtain')).toBeDefined();
|
|
89
|
+
// expect(result.find(device => device.name === 'Livingroom Curtain')).toBeDefined();
|
|
89
90
|
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('from files', () => {
|
|
94
|
+
let mockConfig;
|
|
95
|
+
let RED;
|
|
96
|
+
let node;
|
|
97
|
+
let mockHapClient;
|
|
98
|
+
|
|
99
|
+
beforeEach(() => {
|
|
100
|
+
mockConfig = {
|
|
101
|
+
username: '123-45-678',
|
|
102
|
+
macAddress: '00:11:22:33:44:55',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
RED = {
|
|
106
|
+
nodes: {
|
|
107
|
+
createNode: jest.fn(),
|
|
108
|
+
},
|
|
109
|
+
};
|
|
90
110
|
|
|
91
|
-
|
|
111
|
+
node = new HBConfigNode(mockConfig, RED);
|
|
112
|
+
// node.debug = true;
|
|
113
|
+
node.warn = console.log;
|
|
114
|
+
node.log = console.log;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test.skip('Retrieve devices, and compare with current (v2)', async () => {
|
|
118
|
+
// console.log('Reading Homebridge endpoints from file', process.cwd());
|
|
119
|
+
var storagePath = path.join(process.cwd(), 'test/homebridge-automation-endpoints.json');
|
|
120
|
+
// console.log(`Reading Homebridge endpoints from ${storagePath}`);
|
|
121
|
+
const fileHbDevices = JSON.parse(fs.readFileSync(storagePath, 'utf8'));
|
|
122
|
+
|
|
123
|
+
node.hapClient.getAllServices.mockResolvedValue(fileHbDevices);
|
|
124
|
+
// console.log('testhbDevices', fileHbDevices);
|
|
125
|
+
await node.handleReady();
|
|
92
126
|
const result = node.toList({ perms: 'ev' });
|
|
93
|
-
|
|
127
|
+
|
|
128
|
+
storagePath = path.join(process.cwd(), 'test/homebridge-automation-hbDevices-v2.json');
|
|
129
|
+
// console.log(`Reading Homebridge results from ${storagePath}`);
|
|
130
|
+
const fileResult = JSON.parse(fs.readFileSync(storagePath, 'utf8'));
|
|
131
|
+
expect(result.length).toBe(107);
|
|
132
|
+
expect(result).toEqual(fileResult);
|
|
94
133
|
|
|
95
134
|
// Ensure the unsupported type was filtered out
|
|
96
135
|
expect(result.find(device => device.name === 'Garage Sensor')).toBeUndefined();
|
|
136
|
+
// expect(result.find(device => device.name === 'Kitchen Curtain')).toBeDefined();
|
|
137
|
+
// expect(result.find(device => device.name === 'Livingroom Curtain')).toBeDefined();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('Retrieve devices, and compare with future (v3)', async () => {
|
|
141
|
+
// console.log('Reading Homebridge endpoints from file', process.cwd());
|
|
142
|
+
var storagePath = path.join(process.cwd(), 'test/homebridge-automation-endpoints.json');
|
|
143
|
+
// console.log(`Reading Homebridge endpoints from ${storagePath}`);
|
|
144
|
+
const fileHbDevices = JSON.parse(fs.readFileSync(storagePath, 'utf8'));
|
|
145
|
+
|
|
146
|
+
node.hapClient.getAllServices.mockResolvedValue(fileHbDevices);
|
|
147
|
+
// console.log('testhbDevices', fileHbDevices);
|
|
148
|
+
await node.handleReady();
|
|
149
|
+
const result = node.toList({ perms: 'ev' });
|
|
150
|
+
|
|
151
|
+
storagePath = path.join(process.cwd(), 'test/homebridge-automation-hbDevices-v3.json');
|
|
152
|
+
// console.log(`Reading Homebridge results from ${storagePath}`);
|
|
153
|
+
const fileResult = JSON.parse(fs.readFileSync(storagePath, 'utf8'));
|
|
154
|
+
expect(result.length).toBe(107);
|
|
155
|
+
expect(result).toEqual(fileResult);
|
|
156
|
+
|
|
157
|
+
// Ensure the unsupported type was filtered out
|
|
158
|
+
expect(result.find(device => device.name === 'Garage Sensor')).toBeUndefined();
|
|
159
|
+
// expect(result.find(device => device.name === 'Kitchen Curtain')).toBeDefined();
|
|
160
|
+
// expect(result.find(device => device.name === 'Livingroom Curtain')).toBeDefined();
|
|
97
161
|
});
|
|
98
162
|
});
|
|
99
163
|
|
|
@@ -2148,7 +2212,7 @@ const testhbDevicesResult = [
|
|
|
2148
2212
|
name: 'Backyard',
|
|
2149
2213
|
fullName: 'Backyard - Camera Rtp Stream Management',
|
|
2150
2214
|
sortName: 'Backyard:CameraRTPStreamManagement',
|
|
2151
|
-
uniqueId: '
|
|
2215
|
+
uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000110',
|
|
2152
2216
|
homebridge: 'homebridge',
|
|
2153
2217
|
service: 'CameraRTPStreamManagement',
|
|
2154
2218
|
manufacturer: 'Eufy'
|
|
@@ -2157,7 +2221,7 @@ const testhbDevicesResult = [
|
|
|
2157
2221
|
name: 'Backyard',
|
|
2158
2222
|
fullName: 'Backyard - Motion Sensor',
|
|
2159
2223
|
sortName: 'Backyard:MotionSensor',
|
|
2160
|
-
uniqueId: '
|
|
2224
|
+
uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000085',
|
|
2161
2225
|
homebridge: 'homebridge',
|
|
2162
2226
|
service: 'MotionSensor',
|
|
2163
2227
|
manufacturer: 'Eufy'
|
|
@@ -2169,22 +2233,22 @@ const testhbDevicesResult = [
|
|
|
2169
2233
|
"name": "Canoe 5036",
|
|
2170
2234
|
"service": "CameraRTPStreamManagement",
|
|
2171
2235
|
"sortName": "Canoe 5036:CameraRTPStreamManagement",
|
|
2172
|
-
"uniqueId": "
|
|
2236
|
+
"uniqueId": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe 503600000110",
|
|
2173
2237
|
},
|
|
2174
2238
|
{
|
|
2175
|
-
"fullName": "Canoe - Motion Sensor",
|
|
2239
|
+
"fullName": "Canoe 5036 - Motion Sensor",
|
|
2176
2240
|
"homebridge": "ECI-T24F2",
|
|
2177
2241
|
"manufacturer": "HikVision",
|
|
2178
|
-
"name": "Canoe",
|
|
2242
|
+
"name": "Canoe 5036",
|
|
2179
2243
|
"service": "MotionSensor",
|
|
2180
|
-
"sortName": "Canoe:MotionSensor",
|
|
2181
|
-
"uniqueId": "
|
|
2244
|
+
"sortName": "Canoe 5036:MotionSensor",
|
|
2245
|
+
"uniqueId": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe 503600000085",
|
|
2182
2246
|
},
|
|
2183
2247
|
{
|
|
2184
2248
|
name: 'Side door',
|
|
2185
2249
|
fullName: 'Side door - Camera Rtp Stream Management',
|
|
2186
2250
|
sortName: 'Side door:CameraRTPStreamManagement',
|
|
2187
|
-
uniqueId: '
|
|
2251
|
+
uniqueId: 'homebridge0E:89:A7:DA:D3:21EufySide door00000110',
|
|
2188
2252
|
homebridge: 'homebridge',
|
|
2189
2253
|
service: 'CameraRTPStreamManagement',
|
|
2190
2254
|
manufacturer: 'Eufy'
|
|
@@ -2193,7 +2257,7 @@ const testhbDevicesResult = [
|
|
|
2193
2257
|
name: 'Side door',
|
|
2194
2258
|
fullName: 'Side door - Motion Sensor',
|
|
2195
2259
|
sortName: 'Side door:MotionSensor',
|
|
2196
|
-
uniqueId: '
|
|
2260
|
+
uniqueId: 'homebridge0E:89:A7:DA:D3:21EufySide door00000085',
|
|
2197
2261
|
homebridge: 'homebridge',
|
|
2198
2262
|
service: 'MotionSensor',
|
|
2199
2263
|
manufacturer: 'Eufy'
|