node-red-contrib-homekit-bridged 2.0.0-dev.0 → 2.0.0-dev.1
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/build/lib/HAPHostNode.js +3 -5
- package/build/lib/HAPServiceNode.js +5 -5
- package/build/lib/HAPServiceNode2.js +5 -5
- package/build/lib/api.js +17 -18
- package/build/lib/hap/eve-app/EveCharacteristics.js +10 -10
- package/build/lib/utils/AccessoryUtils.js +7 -5
- package/build/lib/utils/BridgeUtils.js +2 -2
- package/build/lib/utils/CharacteristicUtils.js +1 -1
- package/build/lib/utils/CharacteristicUtils2.js +1 -1
- package/build/lib/utils/ServiceUtils.js +17 -20
- package/build/lib/utils/ServiceUtils2.js +13 -14
- package/build/lib/utils/index.js +1 -1
- package/build/nodes/status.js +3 -3
- package/examples/demo/01 - ALL Demos single import.json +64 -318
- package/examples/demo/02 - Air Purifier.json +279 -328
- package/examples/demo/03 - Air Quality sensor with Battery.json +254 -282
- package/examples/demo/04 - Dimmable Bulb.json +172 -189
- package/examples/demo/05 - Color Bulb (HSV).json +195 -216
- package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -265
- package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -192
- package/examples/demo/08 - CO2 detector.json +224 -255
- package/examples/demo/09 - CO (carbon monoxide) example.json +255 -290
- package/examples/demo/10 - Door window contact sensor.json +234 -265
- package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -607
- package/examples/switch/01 - Plain Switch.json +7 -27
- package/package.json +82 -81
package/build/lib/HAPHostNode.js
CHANGED
|
@@ -84,13 +84,11 @@ module.exports = (RED, hostType) => {
|
|
|
84
84
|
}
|
|
85
85
|
self.host.publish({
|
|
86
86
|
username: self.bridgeUsername,
|
|
87
|
-
port: self.config.port && !isNaN(self.config.port)
|
|
88
|
-
? self.config.port
|
|
89
|
-
: 0,
|
|
87
|
+
port: self.config.port && !isNaN(self.config.port) ? self.config.port : 0,
|
|
90
88
|
pincode: oldPinCode,
|
|
91
89
|
category: self.accessoryCategory,
|
|
92
90
|
bind: bind,
|
|
93
|
-
advertiser: (_b = self.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap"
|
|
91
|
+
advertiser: (_b = self.config.advertiser) !== null && _b !== void 0 ? _b : "bonjour-hap"
|
|
94
92
|
}, self.config.allowInsecureRequest);
|
|
95
93
|
self.published = true;
|
|
96
94
|
return true;
|
|
@@ -149,6 +147,6 @@ module.exports = (RED, hostType) => {
|
|
|
149
147
|
};
|
|
150
148
|
return {
|
|
151
149
|
init,
|
|
152
|
-
macify
|
|
150
|
+
macify
|
|
153
151
|
};
|
|
154
152
|
};
|
|
@@ -39,7 +39,7 @@ module.exports = (RED) => {
|
|
|
39
39
|
self.nodeStatusUtils.setStatus({
|
|
40
40
|
fill: 'blue',
|
|
41
41
|
shape: 'dot',
|
|
42
|
-
text: 'Waiting for Setup'
|
|
42
|
+
text: 'Waiting for Setup'
|
|
43
43
|
});
|
|
44
44
|
self.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(self.config, msg, resolve);
|
|
45
45
|
self.on('input', self.handleWaitForSetup);
|
|
@@ -145,7 +145,7 @@ module.exports = (RED) => {
|
|
|
145
145
|
model: self.config.model,
|
|
146
146
|
firmwareRev: self.config.firmwareRev,
|
|
147
147
|
hardwareRev: self.config.hardwareRev,
|
|
148
|
-
softwareRev: self.config.softwareRev
|
|
148
|
+
softwareRev: self.config.softwareRev
|
|
149
149
|
}, subtypeUUID);
|
|
150
150
|
self.onIdentify = AccessoryUtils.onIdentify;
|
|
151
151
|
self.accessory.on('identify', self.onIdentify);
|
|
@@ -159,7 +159,7 @@ module.exports = (RED) => {
|
|
|
159
159
|
name: self.name,
|
|
160
160
|
UUID: subtypeUUID,
|
|
161
161
|
serviceName: self.config.serviceName,
|
|
162
|
-
config: self.config
|
|
162
|
+
config: self.config
|
|
163
163
|
}, self.parentService);
|
|
164
164
|
self.characteristicProperties = CharacteristicUtils.load(self.service, self.config);
|
|
165
165
|
ServiceUtils.configureAdaptiveLightning();
|
|
@@ -169,7 +169,7 @@ module.exports = (RED) => {
|
|
|
169
169
|
self.nodeStatusUtils.setStatus({
|
|
170
170
|
fill: 'yellow',
|
|
171
171
|
shape: 'ring',
|
|
172
|
-
text: self.hostNode.config.pinCode
|
|
172
|
+
text: self.hostNode.config.pinCode
|
|
173
173
|
});
|
|
174
174
|
self.supported = CharacteristicUtils.subscribeAndGetSupported(self.service);
|
|
175
175
|
self.on('input', ServiceUtils.onInput);
|
|
@@ -177,6 +177,6 @@ module.exports = (RED) => {
|
|
|
177
177
|
};
|
|
178
178
|
return {
|
|
179
179
|
preInit,
|
|
180
|
-
init
|
|
180
|
+
init
|
|
181
181
|
};
|
|
182
182
|
};
|
|
@@ -39,7 +39,7 @@ module.exports = (RED) => {
|
|
|
39
39
|
self.nodeStatusUtils.setStatus({
|
|
40
40
|
fill: 'blue',
|
|
41
41
|
shape: 'dot',
|
|
42
|
-
text: 'Waiting for Setup'
|
|
42
|
+
text: 'Waiting for Setup'
|
|
43
43
|
});
|
|
44
44
|
self.handleWaitForSetup = (msg) => ServiceUtils.handleWaitForSetup(self.config, msg, resolve);
|
|
45
45
|
self.on('input', self.handleWaitForSetup);
|
|
@@ -145,7 +145,7 @@ module.exports = (RED) => {
|
|
|
145
145
|
model: self.config.model,
|
|
146
146
|
firmwareRev: self.config.firmwareRev,
|
|
147
147
|
hardwareRev: self.config.hardwareRev,
|
|
148
|
-
softwareRev: self.config.softwareRev
|
|
148
|
+
softwareRev: self.config.softwareRev
|
|
149
149
|
}, subtypeUUID);
|
|
150
150
|
self.onIdentify = AccessoryUtils.onIdentify;
|
|
151
151
|
self.accessory.on('identify', self.onIdentify);
|
|
@@ -159,7 +159,7 @@ module.exports = (RED) => {
|
|
|
159
159
|
name: self.name,
|
|
160
160
|
UUID: subtypeUUID,
|
|
161
161
|
serviceName: self.config.serviceName,
|
|
162
|
-
config: self.config
|
|
162
|
+
config: self.config
|
|
163
163
|
}, self.parentService);
|
|
164
164
|
self.characteristicProperties = CharacteristicUtils.load(self.service, self.config);
|
|
165
165
|
ServiceUtils.configureAdaptiveLightning();
|
|
@@ -169,7 +169,7 @@ module.exports = (RED) => {
|
|
|
169
169
|
self.nodeStatusUtils.setStatus({
|
|
170
170
|
fill: 'yellow',
|
|
171
171
|
shape: 'ring',
|
|
172
|
-
text: self.hostNode.config.pinCode
|
|
172
|
+
text: self.hostNode.config.pinCode
|
|
173
173
|
});
|
|
174
174
|
self.supported = CharacteristicUtils.subscribeAndGetSupported(self.service);
|
|
175
175
|
self.on('input', ServiceUtils.onInput);
|
|
@@ -177,6 +177,6 @@ module.exports = (RED) => {
|
|
|
177
177
|
};
|
|
178
178
|
return {
|
|
179
179
|
preInit,
|
|
180
|
-
init
|
|
180
|
+
init
|
|
181
181
|
};
|
|
182
182
|
};
|
package/build/lib/api.js
CHANGED
|
@@ -35,32 +35,32 @@ module.exports = function (RED) {
|
|
|
35
35
|
log.debug('Initialize Service API');
|
|
36
36
|
const serviceData = {
|
|
37
37
|
BatteryService: {
|
|
38
|
-
nrchkbDisabledText: 'BatteryService (deprecated, replaced by Battery)'
|
|
38
|
+
nrchkbDisabledText: 'BatteryService (deprecated, replaced by Battery)'
|
|
39
39
|
},
|
|
40
40
|
BridgeConfiguration: {
|
|
41
|
-
nrchkbDisabledText: 'BridgeConfiguration (deprecated, unused)'
|
|
41
|
+
nrchkbDisabledText: 'BridgeConfiguration (deprecated, unused)'
|
|
42
42
|
},
|
|
43
43
|
BridgingState: {
|
|
44
|
-
nrchkbDisabledText: 'BridgingState (deprecated, unused)'
|
|
44
|
+
nrchkbDisabledText: 'BridgingState (deprecated, unused)'
|
|
45
45
|
},
|
|
46
46
|
CameraControl: {
|
|
47
|
-
nrchkbDisabledText: 'CameraControl (deprecated, replaced by)'
|
|
47
|
+
nrchkbDisabledText: 'CameraControl (deprecated, replaced by)'
|
|
48
48
|
},
|
|
49
49
|
CameraEventRecordingManagement: {
|
|
50
|
-
nrchkbDisabledText: 'CameraEventRecordingManagement (deprecated, replaced by CameraRecordingManagement)'
|
|
50
|
+
nrchkbDisabledText: 'CameraEventRecordingManagement (deprecated, replaced by CameraRecordingManagement)'
|
|
51
51
|
},
|
|
52
52
|
Relay: {
|
|
53
|
-
nrchkbDisabledText: 'Relay (deprecated, replaced by CloudRelay)'
|
|
53
|
+
nrchkbDisabledText: 'Relay (deprecated, replaced by CloudRelay)'
|
|
54
54
|
},
|
|
55
55
|
Slat: {
|
|
56
|
-
nrchkbDisabledText: 'Slat (deprecated, replaced by Slats)'
|
|
56
|
+
nrchkbDisabledText: 'Slat (deprecated, replaced by Slats)'
|
|
57
57
|
},
|
|
58
58
|
TimeInformation: {
|
|
59
|
-
nrchkbDisabledText: 'TimeInformation (deprecated, unused)'
|
|
59
|
+
nrchkbDisabledText: 'TimeInformation (deprecated, unused)'
|
|
60
60
|
},
|
|
61
61
|
TunneledBTLEAccessoryService: {
|
|
62
|
-
nrchkbDisabledText: 'TunneledBTLEAccessoryService (deprecated, replaced by Tunnel)'
|
|
63
|
-
}
|
|
62
|
+
nrchkbDisabledText: 'TunneledBTLEAccessoryService (deprecated, replaced by Tunnel)'
|
|
63
|
+
}
|
|
64
64
|
};
|
|
65
65
|
Object.values(hap_nodejs_1.Service)
|
|
66
66
|
.filter((service) => service.prototype instanceof hap_nodejs_1.Service)
|
|
@@ -128,7 +128,7 @@ module.exports = function (RED) {
|
|
|
128
128
|
res.setHeader('Content-Type', 'application/json');
|
|
129
129
|
res.json({
|
|
130
130
|
version: xyzVersion,
|
|
131
|
-
experimental
|
|
131
|
+
experimental
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
134
|
};
|
|
@@ -201,7 +201,7 @@ module.exports = function (RED) {
|
|
|
201
201
|
super(name, CustomCharacteristic.UUID, Object.assign(Object.assign({}, validatedProps), { perms: (_a = validatedProps.perms) !== null && _a !== void 0 ? _a : [
|
|
202
202
|
"pr",
|
|
203
203
|
"pw",
|
|
204
|
-
"ev"
|
|
204
|
+
"ev"
|
|
205
205
|
] }));
|
|
206
206
|
this.value = this.getDefaultValue();
|
|
207
207
|
}
|
|
@@ -209,11 +209,11 @@ module.exports = function (RED) {
|
|
|
209
209
|
CustomCharacteristic.UUID = UUID;
|
|
210
210
|
Object.defineProperty(CustomCharacteristic, 'name', {
|
|
211
211
|
value: key,
|
|
212
|
-
configurable: true
|
|
212
|
+
configurable: true
|
|
213
213
|
});
|
|
214
214
|
Object.defineProperty(hap_nodejs_1.Characteristic, key, {
|
|
215
215
|
value: CustomCharacteristic,
|
|
216
|
-
configurable: true
|
|
216
|
+
configurable: true
|
|
217
217
|
});
|
|
218
218
|
customCharacteristicKeys.push(key);
|
|
219
219
|
}
|
|
@@ -245,8 +245,7 @@ module.exports = function (RED) {
|
|
|
245
245
|
if (customCharacteristicKeys.includes(key)) {
|
|
246
246
|
const characteristic = serviceNode.service
|
|
247
247
|
.getCharacteristic(hap_nodejs_1.Characteristic[key])
|
|
248
|
-
.setProps(serviceNode
|
|
249
|
-
.characteristicProperties[key]);
|
|
248
|
+
.setProps(serviceNode.characteristicProperties[key]);
|
|
250
249
|
serviceNode.supported.push(key);
|
|
251
250
|
characteristic.on('get', serviceNode.onCharacteristicGet);
|
|
252
251
|
characteristic.on('set', serviceNode.onCharacteristicSet);
|
|
@@ -263,7 +262,7 @@ module.exports = function (RED) {
|
|
|
263
262
|
RED.httpAdmin.get('/nrchkb/config', RED.auth.needsPermission('nrchkb.read'), (_req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
264
263
|
res.setHeader('Content-Type', 'application/json');
|
|
265
264
|
res.json({
|
|
266
|
-
customCharacteristics: yield getCustomCharacteristics()
|
|
265
|
+
customCharacteristics: yield getCustomCharacteristics()
|
|
267
266
|
});
|
|
268
267
|
}));
|
|
269
268
|
RED.httpAdmin.post('/nrchkb/config', RED.auth.needsPermission('nrchkb.write'), (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -304,6 +303,6 @@ module.exports = function (RED) {
|
|
|
304
303
|
};
|
|
305
304
|
return {
|
|
306
305
|
init,
|
|
307
|
-
stringifyVersion
|
|
306
|
+
stringifyVersion
|
|
308
307
|
};
|
|
309
308
|
};
|
|
@@ -11,42 +11,42 @@ const EveCharacteristics = [
|
|
|
11
11
|
name: 'Eve-Volt',
|
|
12
12
|
format: "float",
|
|
13
13
|
perms: ["pr"],
|
|
14
|
-
description: 'Volt (V) value. Used by Eve.app.'
|
|
14
|
+
description: 'Volt (V) value. Used by Eve.app.'
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
UUID: 'E863F126-079E-48FF-8F27-9C2605A29F52',
|
|
18
18
|
name: 'Eve-Ampere',
|
|
19
19
|
format: "float",
|
|
20
20
|
perms: ["pr"],
|
|
21
|
-
description: 'Ampere (A) value. Used by Eve.app.'
|
|
21
|
+
description: 'Ampere (A) value. Used by Eve.app.'
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
UUID: 'E863F10D-079E-48FF-8F27-9C2605A29F52',
|
|
25
25
|
name: 'Eve-Watt',
|
|
26
26
|
format: "float",
|
|
27
27
|
perms: ["pr"],
|
|
28
|
-
description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
|
|
28
|
+
description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
UUID: 'E863F10C-079E-48FF-8F27-9C2605A29F52',
|
|
32
32
|
name: 'Eve-Kilowatt-hour',
|
|
33
33
|
format: "float",
|
|
34
34
|
perms: ["pr"],
|
|
35
|
-
description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.'
|
|
35
|
+
description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.'
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
UUID: 'E863F110-079E-48FF-8F27-9C2605A29F52',
|
|
39
39
|
name: 'Eve-Volt-Ampere',
|
|
40
40
|
format: "uint16",
|
|
41
41
|
perms: ["pr"],
|
|
42
|
-
description: 'Volt-Ampere (VA) value. Used by Eve.app.'
|
|
43
|
-
}
|
|
42
|
+
description: 'Volt-Ampere (VA) value. Used by Eve.app.'
|
|
43
|
+
}
|
|
44
44
|
];
|
|
45
45
|
class EveS2R1 extends HAPCharacteristic_1.default {
|
|
46
46
|
constructor() {
|
|
47
47
|
super('Eve-S2R1', EveS2R1.UUID, {
|
|
48
48
|
format: "data",
|
|
49
|
-
perms: ["pr", "ev", "hd"]
|
|
49
|
+
perms: ["pr", "ev", "hd"]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -57,7 +57,7 @@ class EveS2R2 extends HAPCharacteristic_1.default {
|
|
|
57
57
|
constructor() {
|
|
58
58
|
super('Eve-S2R2', EveS2R2.UUID, {
|
|
59
59
|
format: "data",
|
|
60
|
-
perms: ["pr", "ev", "hd"]
|
|
60
|
+
perms: ["pr", "ev", "hd"]
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -68,7 +68,7 @@ class EveS2W1 extends HAPCharacteristic_1.default {
|
|
|
68
68
|
constructor() {
|
|
69
69
|
super('Eve-S2W1', EveS2W1.UUID, {
|
|
70
70
|
format: "data",
|
|
71
|
-
perms: ["pw", "hd"]
|
|
71
|
+
perms: ["pw", "hd"]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -79,7 +79,7 @@ class EveS2W2 extends HAPCharacteristic_1.default {
|
|
|
79
79
|
constructor() {
|
|
80
80
|
super('Eve-S2W2', EveS2W2.UUID, {
|
|
81
81
|
format: "data",
|
|
82
|
-
perms: ["pw", "hd"]
|
|
82
|
+
perms: ["pw", "hd"]
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -21,8 +21,10 @@ module.exports = function (node) {
|
|
|
21
21
|
const accessoryInformationService = accessory.getService(Service.AccessoryInformation) ||
|
|
22
22
|
accessory.addService(Service.AccessoryInformation);
|
|
23
23
|
if (accessoryInformationService.getCharacteristic(Characteristic.Manufacturer).value !== accessoryInformation.manufacturer ||
|
|
24
|
-
accessoryInformationService.getCharacteristic(Characteristic.Model)
|
|
25
|
-
|
|
24
|
+
accessoryInformationService.getCharacteristic(Characteristic.Model)
|
|
25
|
+
.value !== accessoryInformation.model ||
|
|
26
|
+
accessoryInformationService.getCharacteristic(Characteristic.Name)
|
|
27
|
+
.value !== accessoryInformation.name ||
|
|
26
28
|
accessoryInformationService.getCharacteristic(Characteristic.SerialNumber).value !== accessoryInformation.serialNo) {
|
|
27
29
|
log.debug('... Manufacturer, Model, Name or Serial Number changed! Replacing it.');
|
|
28
30
|
accessory.services
|
|
@@ -92,12 +94,12 @@ module.exports = function (node) {
|
|
|
92
94
|
const msg = {
|
|
93
95
|
payload: { Identify: 1 },
|
|
94
96
|
name: nodes[i].name,
|
|
95
|
-
topic: topic
|
|
97
|
+
topic: topic
|
|
96
98
|
};
|
|
97
99
|
const statusId = nodes[i].nodeStatusUtils.setStatus({
|
|
98
100
|
fill: 'yellow',
|
|
99
101
|
shape: 'dot',
|
|
100
|
-
text: 'Identify : 1'
|
|
102
|
+
text: 'Identify : 1'
|
|
101
103
|
});
|
|
102
104
|
setTimeout(function () {
|
|
103
105
|
nodes[i].nodeStatusUtils.clearStatus(statusId);
|
|
@@ -108,6 +110,6 @@ module.exports = function (node) {
|
|
|
108
110
|
};
|
|
109
111
|
return {
|
|
110
112
|
getOrCreate,
|
|
111
|
-
onIdentify
|
|
113
|
+
onIdentify
|
|
112
114
|
};
|
|
113
115
|
};
|
|
@@ -32,13 +32,13 @@ module.exports = function () {
|
|
|
32
32
|
node.nodeStatusUtils.setStatus({
|
|
33
33
|
fill: 'red',
|
|
34
34
|
shape: 'ring',
|
|
35
|
-
text: 'Error while publishing ' + hostTypeName
|
|
35
|
+
text: 'Error while publishing ' + hostTypeName
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}, 5000);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return {
|
|
42
|
-
delayedPublish: delayedPublish
|
|
42
|
+
delayedPublish: delayedPublish
|
|
43
43
|
};
|
|
44
44
|
};
|
|
@@ -54,7 +54,7 @@ module.exports = function (node) {
|
|
|
54
54
|
username: connection.username,
|
|
55
55
|
remoteAddress: connection.remoteAddress,
|
|
56
56
|
localAddress: connection.localAddress,
|
|
57
|
-
httpPort: connection.remotePort
|
|
57
|
+
httpPort: connection.remotePort
|
|
58
58
|
};
|
|
59
59
|
hap.context = {};
|
|
60
60
|
}
|
|
@@ -97,7 +97,7 @@ module.exports = function (node) {
|
|
|
97
97
|
fill: 'red',
|
|
98
98
|
shape: 'ring',
|
|
99
99
|
text: 'Not reachable',
|
|
100
|
-
type: 'NO_RESPONSE'
|
|
100
|
+
type: 'NO_RESPONSE'
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
@@ -105,15 +105,13 @@ module.exports = function (node) {
|
|
|
105
105
|
node.nodeStatusUtils.setStatus({
|
|
106
106
|
fill: 'yellow',
|
|
107
107
|
shape: 'dot',
|
|
108
|
-
text: key + ': ' + newValue
|
|
108
|
+
text: key + ': ' + newValue
|
|
109
109
|
}, 3000);
|
|
110
110
|
(_d = node.childNodes) === null || _d === void 0 ? void 0 : _d.forEach((n) => n.nodeStatusUtils.clearStatusByType('NO_RESPONSE'));
|
|
111
111
|
(_e = node.parentNode) === null || _e === void 0 ? void 0 : _e.nodeStatusUtils.clearStatusByType('NO_RESPONSE');
|
|
112
112
|
}
|
|
113
113
|
log.debug(`${node.name} received ${key} : ${newValue}`);
|
|
114
|
-
if (connection ||
|
|
115
|
-
context ||
|
|
116
|
-
node.hostNode.config.allowMessagePassthrough) {
|
|
114
|
+
if (connection || context || node.hostNode.config.allowMessagePassthrough) {
|
|
117
115
|
if (outputNumber === 0) {
|
|
118
116
|
node.send(msg);
|
|
119
117
|
}
|
|
@@ -136,7 +134,7 @@ module.exports = function (node) {
|
|
|
136
134
|
catch (_) { }
|
|
137
135
|
onValueChange.call(this, allCharacteristics, 1, {
|
|
138
136
|
newValue,
|
|
139
|
-
context
|
|
137
|
+
context
|
|
140
138
|
}, connection);
|
|
141
139
|
};
|
|
142
140
|
const onCharacteristicChange = (allCharacteristics) => function (change) {
|
|
@@ -148,7 +146,7 @@ module.exports = function (node) {
|
|
|
148
146
|
onValueChange.call(this, allCharacteristics, 0, {
|
|
149
147
|
oldValue,
|
|
150
148
|
newValue,
|
|
151
|
-
context
|
|
149
|
+
context
|
|
152
150
|
}, originator);
|
|
153
151
|
}
|
|
154
152
|
};
|
|
@@ -284,7 +282,7 @@ module.exports = function (node) {
|
|
|
284
282
|
node.nodeStatusUtils.setStatus({
|
|
285
283
|
fill: 'blue',
|
|
286
284
|
shape: 'dot',
|
|
287
|
-
text: 'Waiting for Parent Service'
|
|
285
|
+
text: 'Waiting for Parent Service'
|
|
288
286
|
});
|
|
289
287
|
const checkAndWait = () => {
|
|
290
288
|
const parentNode = node.RED.nodes.getNode(node.config.parentService);
|
|
@@ -329,9 +327,8 @@ module.exports = function (node) {
|
|
|
329
327
|
: 1,
|
|
330
328
|
customTemperatureAdjustment: node.config
|
|
331
329
|
.adaptiveLightingOptionsCustomTemperatureAdjustment
|
|
332
|
-
? +node.config
|
|
333
|
-
|
|
334
|
-
: undefined,
|
|
330
|
+
? +node.config.adaptiveLightingOptionsCustomTemperatureAdjustment
|
|
331
|
+
: undefined
|
|
335
332
|
};
|
|
336
333
|
log.trace(`Configuring Adaptive Lighting with options: ${options}`);
|
|
337
334
|
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(node.service, options);
|
|
@@ -342,24 +339,24 @@ module.exports = function (node) {
|
|
|
342
339
|
transitionCurve: adaptiveLightingController.getAdaptiveLightingTransitionCurve(),
|
|
343
340
|
brightnessAdjustmentRange: adaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange(),
|
|
344
341
|
updateInterval: adaptiveLightingController.getAdaptiveLightingUpdateInterval(),
|
|
345
|
-
notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold()
|
|
342
|
+
notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold()
|
|
346
343
|
};
|
|
347
344
|
node.send({
|
|
348
345
|
payload: {
|
|
349
346
|
AdaptiveLightingController: {
|
|
350
347
|
event: 'update',
|
|
351
|
-
data: activeAdaptiveLightingTransition
|
|
352
|
-
}
|
|
353
|
-
}
|
|
348
|
+
data: activeAdaptiveLightingTransition
|
|
349
|
+
}
|
|
350
|
+
}
|
|
354
351
|
});
|
|
355
352
|
});
|
|
356
353
|
adaptiveLightingController.on('disable', () => {
|
|
357
354
|
node.send({
|
|
358
355
|
payload: {
|
|
359
356
|
AdaptiveLightingController: {
|
|
360
|
-
event: 'disable'
|
|
361
|
-
}
|
|
362
|
-
}
|
|
357
|
+
event: 'disable'
|
|
358
|
+
}
|
|
359
|
+
}
|
|
363
360
|
});
|
|
364
361
|
});
|
|
365
362
|
node.accessory.configureController(adaptiveLightingController);
|
|
@@ -379,6 +376,6 @@ module.exports = function (node) {
|
|
|
379
376
|
onClose,
|
|
380
377
|
waitForParent,
|
|
381
378
|
handleWaitForSetup,
|
|
382
|
-
configureAdaptiveLightning
|
|
379
|
+
configureAdaptiveLightning
|
|
383
380
|
};
|
|
384
381
|
};
|
|
@@ -20,7 +20,7 @@ module.exports = function (node) {
|
|
|
20
20
|
log.debug(`${eventObject.name} event, oldValue: ${oldValue}, newValue: ${newValue}, connection ${connection === null || connection === void 0 ? void 0 : connection.sessionID}`);
|
|
21
21
|
const msg = {
|
|
22
22
|
name: node.name,
|
|
23
|
-
topic: node.config.topic ? node.config.topic : node.topic_in
|
|
23
|
+
topic: node.config.topic ? node.config.topic : node.topic_in
|
|
24
24
|
};
|
|
25
25
|
msg.payload = {};
|
|
26
26
|
msg.hap = {
|
|
@@ -30,7 +30,7 @@ module.exports = function (node) {
|
|
|
30
30
|
allChars[cKey] = singleChar.value;
|
|
31
31
|
return allChars;
|
|
32
32
|
}, {}),
|
|
33
|
-
oldValue
|
|
33
|
+
oldValue
|
|
34
34
|
};
|
|
35
35
|
const key = this.constructor.name;
|
|
36
36
|
msg.hap.reachable = (_a = node.reachable) !== null && _a !== void 0 ? _a : (_b = node.parentNode) === null || _b === void 0 ? void 0 : _b.reachable;
|
|
@@ -40,7 +40,7 @@ module.exports = function (node) {
|
|
|
40
40
|
fill: 'red',
|
|
41
41
|
shape: 'ring',
|
|
42
42
|
text: 'Not reachable',
|
|
43
|
-
type: 'NO_RESPONSE'
|
|
43
|
+
type: 'NO_RESPONSE'
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
@@ -48,7 +48,7 @@ module.exports = function (node) {
|
|
|
48
48
|
node.nodeStatusUtils.setStatus({
|
|
49
49
|
fill: 'yellow',
|
|
50
50
|
shape: 'dot',
|
|
51
|
-
text: `[${eventObject.name}] ${key}${newValue != undefined ? `: ${newValue}` : ''}
|
|
51
|
+
text: `[${eventObject.name}] ${key}${newValue != undefined ? `: ${newValue}` : ''}`
|
|
52
52
|
}, 3000);
|
|
53
53
|
(_d = node.childNodes) === null || _d === void 0 ? void 0 : _d.forEach((n) => n.nodeStatusUtils.clearStatusByType('NO_RESPONSE'));
|
|
54
54
|
(_e = node.parentNode) === null || _e === void 0 ? void 0 : _e.nodeStatusUtils.clearStatusByType('NO_RESPONSE');
|
|
@@ -60,7 +60,7 @@ module.exports = function (node) {
|
|
|
60
60
|
username: connection.username,
|
|
61
61
|
remoteAddress: connection.remoteAddress,
|
|
62
62
|
localAddress: connection.localAddress,
|
|
63
|
-
httpPort: connection.remotePort
|
|
63
|
+
httpPort: connection.remotePort
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
log.debug(`${node.name} received ${eventObject.name} ${key}: ${newValue}`);
|
|
@@ -84,18 +84,18 @@ module.exports = function (node) {
|
|
|
84
84
|
}
|
|
85
85
|
output.call(characteristic, allCharacteristics, {
|
|
86
86
|
name: "get",
|
|
87
|
-
context: { key: this.displayName }
|
|
87
|
+
context: { key: this.displayName }
|
|
88
88
|
}, { oldValue, newValue }, connection);
|
|
89
89
|
};
|
|
90
90
|
if (node.config.useEventCallback) {
|
|
91
91
|
const callbackID = Storage_1.Storage.saveCallback({
|
|
92
92
|
event: "get",
|
|
93
|
-
callback: delayedCallback
|
|
93
|
+
callback: delayedCallback
|
|
94
94
|
});
|
|
95
95
|
log.debug(`Registered callback ${callbackID} for Characteristic ${characteristic.displayName}`);
|
|
96
96
|
output.call(this, allCharacteristics, {
|
|
97
97
|
name: "get",
|
|
98
|
-
context: { callbackID, key: this.displayName }
|
|
98
|
+
context: { callbackID, key: this.displayName }
|
|
99
99
|
}, { oldValue }, connection);
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
@@ -114,7 +114,7 @@ module.exports = function (node) {
|
|
|
114
114
|
catch (_) { }
|
|
115
115
|
output.call(this, allCharacteristics, {
|
|
116
116
|
name: "set",
|
|
117
|
-
context: { key: this.displayName }
|
|
117
|
+
context: { key: this.displayName }
|
|
118
118
|
}, { newValue }, connection);
|
|
119
119
|
};
|
|
120
120
|
const onCharacteristicChange = (allCharacteristics) => function (change) {
|
|
@@ -122,7 +122,7 @@ module.exports = function (node) {
|
|
|
122
122
|
if (oldValue != newValue) {
|
|
123
123
|
output.call(this, allCharacteristics, {
|
|
124
124
|
name: "change",
|
|
125
|
-
context: { reason, key: this.displayName }
|
|
125
|
+
context: { reason, key: this.displayName }
|
|
126
126
|
}, { oldValue, newValue, context }, originator);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
@@ -153,8 +153,7 @@ module.exports = function (node) {
|
|
|
153
153
|
Object.keys(msg.payload).map((key) => {
|
|
154
154
|
var _a, _b, _c, _d, _e;
|
|
155
155
|
if (node.supported.indexOf(key) < 0) {
|
|
156
|
-
if (node.config.useEventCallback &&
|
|
157
|
-
Storage_1.Storage.uuid4Validate(key)) {
|
|
156
|
+
if (node.config.useEventCallback && Storage_1.Storage.uuid4Validate(key)) {
|
|
158
157
|
const callbackID = key;
|
|
159
158
|
const callbackValue = (_a = msg.payload) === null || _a === void 0 ? void 0 : _a[key];
|
|
160
159
|
const eventCallback = Storage_1.Storage.loadCallback(callbackID);
|
|
@@ -271,7 +270,7 @@ module.exports = function (node) {
|
|
|
271
270
|
node.nodeStatusUtils.setStatus({
|
|
272
271
|
fill: 'blue',
|
|
273
272
|
shape: 'dot',
|
|
274
|
-
text: 'Waiting for Parent Service'
|
|
273
|
+
text: 'Waiting for Parent Service'
|
|
275
274
|
});
|
|
276
275
|
const checkAndWait = () => {
|
|
277
276
|
const parentNode = node.RED.nodes.getNode(node.config.parentService);
|
|
@@ -313,6 +312,6 @@ module.exports = function (node) {
|
|
|
313
312
|
onClose,
|
|
314
313
|
waitForParent,
|
|
315
314
|
handleWaitForSetup,
|
|
316
|
-
configureAdaptiveLightning: ServiceUtilsLegacy.configureAdaptiveLightning
|
|
315
|
+
configureAdaptiveLightning: ServiceUtilsLegacy.configureAdaptiveLightning
|
|
317
316
|
};
|
|
318
317
|
};
|
package/build/lib/utils/index.js
CHANGED
package/build/nodes/status.js
CHANGED
|
@@ -22,18 +22,18 @@ module.exports = (RED) => {
|
|
|
22
22
|
self.nodeStatusUtils.setStatus({
|
|
23
23
|
fill: 'green',
|
|
24
24
|
shape: 'dot',
|
|
25
|
-
text: 'Done'
|
|
25
|
+
text: 'Done'
|
|
26
26
|
}, 3000);
|
|
27
27
|
const serializedService = hap_nodejs_1.Service.serialize(self.serviceNode.service);
|
|
28
28
|
self.send({
|
|
29
|
-
payload: serializedService
|
|
29
|
+
payload: serializedService
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
self.nodeStatusUtils.setStatus({
|
|
34
34
|
fill: 'red',
|
|
35
35
|
shape: 'dot',
|
|
36
|
-
text: 'Check your config'
|
|
36
|
+
text: 'Check your config'
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
});
|