node-red-contrib-homekit-bridged 1.7.0-dev.4 → 1.7.0-dev.6
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 +38 -3
- package/build/nodes/service.html +6 -7
- package/build/nodes/service2.html +6 -7
- 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,20 @@ 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
|
+
if (key === '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
|
+
}
|
|
173
180
|
log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
|
|
174
181
|
}
|
|
175
182
|
else {
|
|
176
|
-
const value = (
|
|
177
|
-
const parentNode = (
|
|
183
|
+
const value = (_c = msg.payload) === null || _c === void 0 ? void 0 : _c[key];
|
|
184
|
+
const parentNode = (_d = node.parentNode) !== null && _d !== void 0 ? _d : node;
|
|
178
185
|
parentNode.reachable = value !== NO_RESPONSE_MSG;
|
|
179
186
|
const characteristic = node.service.getCharacteristic(Characteristic[key]);
|
|
180
187
|
if (context !== null) {
|
|
@@ -317,7 +324,35 @@ module.exports = function (node) {
|
|
|
317
324
|
};
|
|
318
325
|
log.trace(`Configuring Adaptive Lighting with options: ${options}`);
|
|
319
326
|
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(node.service, options);
|
|
327
|
+
adaptiveLightingController.on('update', () => {
|
|
328
|
+
const activeAdaptiveLightingTransition = {
|
|
329
|
+
transitionStartMillis: adaptiveLightingController.getAdaptiveLightingStartTimeOfTransition(),
|
|
330
|
+
timeMillisOffset: adaptiveLightingController.getAdaptiveLightingTimeOffset(),
|
|
331
|
+
transitionCurve: adaptiveLightingController.getAdaptiveLightingTransitionCurve(),
|
|
332
|
+
brightnessAdjustmentRange: adaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange(),
|
|
333
|
+
updateInterval: adaptiveLightingController.getAdaptiveLightingUpdateInterval(),
|
|
334
|
+
notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold(),
|
|
335
|
+
};
|
|
336
|
+
node.send({
|
|
337
|
+
payload: {
|
|
338
|
+
AdaptiveLightingController: {
|
|
339
|
+
event: 'update',
|
|
340
|
+
data: activeAdaptiveLightingTransition,
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
adaptiveLightingController.on('disable', () => {
|
|
346
|
+
node.send({
|
|
347
|
+
payload: {
|
|
348
|
+
AdaptiveLightingController: {
|
|
349
|
+
event: 'disable',
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
});
|
|
320
354
|
node.accessory.configureController(adaptiveLightingController);
|
|
355
|
+
node.adaptiveLightingController = adaptiveLightingController;
|
|
321
356
|
}
|
|
322
357
|
catch (error) {
|
|
323
358
|
log.error(`Failed to configure Adaptive Lightning due to ${error}`);
|
package/build/nodes/service.html
CHANGED
|
@@ -203,13 +203,14 @@
|
|
|
203
203
|
<div class="form-row">
|
|
204
204
|
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
-
<option value="
|
|
207
|
-
<option value="
|
|
206
|
+
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
|
+
<option value="1">AUTOMATIC</option>
|
|
208
|
+
<option value="2">MANUAL</option>
|
|
208
209
|
</select>
|
|
209
210
|
</div>
|
|
210
211
|
<div class="form-row">
|
|
211
212
|
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
-
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment" placeholder="0">
|
|
213
214
|
</div>
|
|
214
215
|
</div>
|
|
215
216
|
|
|
@@ -498,12 +499,10 @@
|
|
|
498
499
|
value: false,
|
|
499
500
|
},
|
|
500
501
|
adaptiveLightingOptionsMode: {
|
|
501
|
-
|
|
502
|
-
validate: RED.validators.number()
|
|
502
|
+
validate: RED.validators.number(true)
|
|
503
503
|
},
|
|
504
504
|
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
505
|
-
|
|
506
|
-
validate: RED.validators.number()
|
|
505
|
+
validate: RED.validators.number(true)
|
|
507
506
|
},
|
|
508
507
|
},
|
|
509
508
|
inputs: 1,
|
|
@@ -203,13 +203,14 @@
|
|
|
203
203
|
<div class="form-row">
|
|
204
204
|
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
205
|
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
-
<option value="
|
|
207
|
-
<option value="
|
|
206
|
+
<option value="" selected hidden disabled>AUTOMATIC</option>
|
|
207
|
+
<option value="1">AUTOMATIC</option>
|
|
208
|
+
<option value="2">MANUAL</option>
|
|
208
209
|
</select>
|
|
209
210
|
</div>
|
|
210
211
|
<div class="form-row">
|
|
211
212
|
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
-
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
<input type="number" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment" placeholder="0">
|
|
213
214
|
</div>
|
|
214
215
|
</div>
|
|
215
216
|
|
|
@@ -508,12 +509,10 @@ if (nrchkbExperimental) {
|
|
|
508
509
|
value: false,
|
|
509
510
|
},
|
|
510
511
|
adaptiveLightingOptionsMode: {
|
|
511
|
-
|
|
512
|
-
validate: RED.validators.number()
|
|
512
|
+
validate: RED.validators.number(true)
|
|
513
513
|
},
|
|
514
514
|
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
515
|
-
|
|
516
|
-
validate: RED.validators.number()
|
|
515
|
+
validate: RED.validators.number(true)
|
|
517
516
|
},
|
|
518
517
|
},
|
|
519
518
|
inputs: 1,
|
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.6",
|
|
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"
|