node-red-contrib-homekit-bridged 1.7.0-dev.5 → 1.7.0-dev.7
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/types/HAPHostNodeType.d.ts +0 -1
- package/build/lib/types/HAPServiceNodeType.d.ts +2 -1
- package/build/lib/types/PublishTimersType.d.ts +0 -1
- package/build/lib/utils/NodeStatusUtils.d.ts +0 -1
- package/build/lib/utils/ServiceUtils.js +41 -4
- package/build/lib/utils/ServiceUtils2.js +10 -3
- package/build/nodes/service.html +1 -1
- package/build/nodes/service2.html +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessory, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
|
|
1
|
+
import { Accessory, AdaptiveLightingController, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
|
|
2
2
|
import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
|
|
3
3
|
import { NodeAPI } from 'node-red';
|
|
4
4
|
import { NodeStatusUtils } from '../utils/NodeStatusUtils';
|
|
@@ -32,5 +32,6 @@ type HAPServiceNodeType = NodeType & {
|
|
|
32
32
|
uniqueIdentifier: string;
|
|
33
33
|
reachable?: boolean;
|
|
34
34
|
nodeStatusUtils: NodeStatusUtils;
|
|
35
|
+
adaptiveLightingController?: AdaptiveLightingController;
|
|
35
36
|
};
|
|
36
37
|
export default HAPServiceNodeType;
|
|
@@ -168,13 +168,22 @@ module.exports = function (node) {
|
|
|
168
168
|
}
|
|
169
169
|
node.topic_in = (_b = msg.topic) !== null && _b !== void 0 ? _b : '';
|
|
170
170
|
Object.keys(msg.payload).map((key) => {
|
|
171
|
-
var _a, _b;
|
|
171
|
+
var _a, _b, _c, _d;
|
|
172
172
|
if (node.supported.indexOf(key) < 0) {
|
|
173
|
-
|
|
173
|
+
if (key === 'AdaptiveLightingController' && node.adaptiveLightingController) {
|
|
174
|
+
const value = (_a = msg.payload) === null || _a === void 0 ? void 0 : _a[key];
|
|
175
|
+
const event = value === null || value === void 0 ? void 0 : value.event;
|
|
176
|
+
if (event === 'disable') {
|
|
177
|
+
(_b = node.adaptiveLightingController) === null || _b === void 0 ? void 0 : _b.disableAdaptiveLighting();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
|
|
182
|
+
}
|
|
174
183
|
}
|
|
175
184
|
else {
|
|
176
|
-
const value = (
|
|
177
|
-
const parentNode = (
|
|
185
|
+
const value = (_c = msg.payload) === null || _c === void 0 ? void 0 : _c[key];
|
|
186
|
+
const parentNode = (_d = node.parentNode) !== null && _d !== void 0 ? _d : node;
|
|
178
187
|
parentNode.reachable = value !== NO_RESPONSE_MSG;
|
|
179
188
|
const characteristic = node.service.getCharacteristic(Characteristic[key]);
|
|
180
189
|
if (context !== null) {
|
|
@@ -317,7 +326,35 @@ module.exports = function (node) {
|
|
|
317
326
|
};
|
|
318
327
|
log.trace(`Configuring Adaptive Lighting with options: ${options}`);
|
|
319
328
|
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(node.service, options);
|
|
329
|
+
adaptiveLightingController.on('update', () => {
|
|
330
|
+
const activeAdaptiveLightingTransition = {
|
|
331
|
+
transitionStartMillis: adaptiveLightingController.getAdaptiveLightingStartTimeOfTransition(),
|
|
332
|
+
timeMillisOffset: adaptiveLightingController.getAdaptiveLightingTimeOffset(),
|
|
333
|
+
transitionCurve: adaptiveLightingController.getAdaptiveLightingTransitionCurve(),
|
|
334
|
+
brightnessAdjustmentRange: adaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange(),
|
|
335
|
+
updateInterval: adaptiveLightingController.getAdaptiveLightingUpdateInterval(),
|
|
336
|
+
notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold(),
|
|
337
|
+
};
|
|
338
|
+
node.send({
|
|
339
|
+
payload: {
|
|
340
|
+
AdaptiveLightingController: {
|
|
341
|
+
event: 'update',
|
|
342
|
+
data: activeAdaptiveLightingTransition,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
adaptiveLightingController.on('disable', () => {
|
|
348
|
+
node.send({
|
|
349
|
+
payload: {
|
|
350
|
+
AdaptiveLightingController: {
|
|
351
|
+
event: 'disable',
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
});
|
|
320
356
|
node.accessory.configureController(adaptiveLightingController);
|
|
357
|
+
node.adaptiveLightingController = adaptiveLightingController;
|
|
321
358
|
}
|
|
322
359
|
catch (error) {
|
|
323
360
|
log.error(`Failed to configure Adaptive Lightning due to ${error}`);
|
|
@@ -152,7 +152,7 @@ module.exports = function (node) {
|
|
|
152
152
|
}
|
|
153
153
|
node.topic_in = (_b = msg.topic) !== null && _b !== void 0 ? _b : '';
|
|
154
154
|
Object.keys(msg.payload).map((key) => {
|
|
155
|
-
var _a, _b, _c;
|
|
155
|
+
var _a, _b, _c, _d, _e;
|
|
156
156
|
if (node.supported.indexOf(key) < 0) {
|
|
157
157
|
if (node.config.useEventCallback &&
|
|
158
158
|
Storage_1.Storage.uuid4Validate(key)) {
|
|
@@ -167,13 +167,20 @@ module.exports = function (node) {
|
|
|
167
167
|
log.error(`Callback ${callbackID} timeout`);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
+
else if (key === 'AdaptiveLightingController' && node.adaptiveLightingController) {
|
|
171
|
+
const value = (_b = msg.payload) === null || _b === void 0 ? void 0 : _b[key];
|
|
172
|
+
const event = value === null || value === void 0 ? void 0 : value.event;
|
|
173
|
+
if (event === 'disable') {
|
|
174
|
+
(_c = node.adaptiveLightingController) === null || _c === void 0 ? void 0 : _c.disableAdaptiveLighting();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
170
177
|
else {
|
|
171
178
|
log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
181
|
else {
|
|
175
|
-
const value = (
|
|
176
|
-
const parentNode = (
|
|
182
|
+
const value = (_d = msg.payload) === null || _d === void 0 ? void 0 : _d[key];
|
|
183
|
+
const parentNode = (_e = node.parentNode) !== null && _e !== void 0 ? _e : node;
|
|
177
184
|
parentNode.reachable = value !== NO_RESPONSE_MSG;
|
|
178
185
|
const characteristic = node.service.getCharacteristic(Characteristic[key]);
|
|
179
186
|
if (context !== null) {
|
package/build/nodes/service.html
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
206
|
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
207
|
<option value="1">AUTOMATIC</option>
|
|
208
|
-
<option value="2"
|
|
208
|
+
<option value="2">MANUAL</option>
|
|
209
209
|
</select>
|
|
210
210
|
</div>
|
|
211
211
|
<div class="form-row">
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
206
|
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
207
|
<option value="1">AUTOMATIC</option>
|
|
208
|
-
<option value="2"
|
|
208
|
+
<option value="2">MANUAL</option>
|
|
209
209
|
</select>
|
|
210
210
|
</div>
|
|
211
211
|
<div class="form-row">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-homekit-bridged",
|
|
3
|
-
"version": "1.7.0-dev.
|
|
3
|
+
"version": "1.7.0-dev.7",
|
|
4
4
|
"description": "Node-RED nodes to simulate Apple HomeKit devices.",
|
|
5
5
|
"main": "build/nodes/nrchkb.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@homebridge/ciao": "^1.2.0",
|
|
53
|
-
"@node-red/registry": "^
|
|
54
|
-
"@types/mocha": "^10.0.
|
|
53
|
+
"@node-red/registry": "^4.0.0",
|
|
54
|
+
"@types/mocha": "^10.0.7",
|
|
55
55
|
"@types/node": "^18",
|
|
56
56
|
"@types/node-persist": "^3.1.8",
|
|
57
57
|
"@types/node-red": "^1.3.5",
|
|
58
58
|
"@types/node-red-node-test-helper": "^0.3.4",
|
|
59
59
|
"@types/semver": "^7.5.8",
|
|
60
|
-
"@types/uuid": "^
|
|
60
|
+
"@types/uuid": "^10.0.0",
|
|
61
61
|
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
62
62
|
"@typescript-eslint/parser": "^7.13.1",
|
|
63
63
|
"babel-eslint": "^10.1.0",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
69
69
|
"husky": "^9.0.11",
|
|
70
70
|
"mocha": "^10.4.0",
|
|
71
|
-
"node-red": "^
|
|
71
|
+
"node-red": "^4.0.0",
|
|
72
72
|
"node-red-node-test-helper": "^0.3.4",
|
|
73
73
|
"prettier": "^3.3.2",
|
|
74
74
|
"ts-node": "^10.9.2",
|
|
75
|
-
"typescript": "^5.
|
|
75
|
+
"typescript": "^5.5.2"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=18"
|