node-red-contrib-homekit-bridged 1.7.0-dev.0 → 1.7.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 +1 -1
- package/build/lib/api.js +1 -1
- package/build/lib/types/HAPHostConfigType.d.ts +1 -1
- package/build/lib/types/HAPService2ConfigType.d.ts +3 -20
- package/build/lib/types/HAPService2NodeType.d.ts +1 -30
- package/build/lib/types/HAPServiceConfigType.d.ts +4 -0
- package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +5 -0
- package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +8 -0
- package/build/lib/utils/ServiceUtils.js +16 -0
- package/build/lib/utils/ServiceUtils2.js +16 -0
- package/build/nodes/service.html +40 -1
- package/build/nodes/service2.html +40 -1
- package/package.json +1 -1
- /package/build/lib/types/{HapCategories.d.ts → hap-nodejs/HapCategories.d.ts} +0 -0
- /package/build/lib/types/{HapCategories.js → hap-nodejs/HapCategories.js} +0 -0
package/build/lib/HAPHostNode.js
CHANGED
|
@@ -17,7 +17,7 @@ const hap_nodejs_1 = require("hap-nodejs");
|
|
|
17
17
|
const semver_1 = require("semver");
|
|
18
18
|
const preload_1 = __importDefault(require("semver/preload"));
|
|
19
19
|
const NRCHKBError_1 = __importDefault(require("./NRCHKBError"));
|
|
20
|
-
const HapCategories_1 = __importDefault(require("./types/HapCategories"));
|
|
20
|
+
const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
|
|
21
21
|
const HostType_1 = __importDefault(require("./types/HostType"));
|
|
22
22
|
module.exports = (RED, hostType) => {
|
|
23
23
|
const MdnsUtils = require('./utils/MdnsUtils')();
|
package/build/lib/api.js
CHANGED
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const logger_1 = require("@nrchkb/logger");
|
|
27
27
|
const hap_nodejs_1 = require("hap-nodejs");
|
|
28
28
|
const Storage_1 = require("./Storage");
|
|
29
|
-
const HapCategories_1 = __importDefault(require("./types/HapCategories"));
|
|
29
|
+
const HapCategories_1 = __importDefault(require("./types/hap-nodejs/HapCategories"));
|
|
30
30
|
const version = require('../../package.json').version.trim();
|
|
31
31
|
module.exports = function (RED) {
|
|
32
32
|
const log = (0, logger_1.logger)('NRCHKB', 'API');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MDNSAdvertiser } from 'hap-nodejs';
|
|
2
2
|
import { NodeDef } from 'node-red';
|
|
3
3
|
import { SemVer } from 'semver';
|
|
4
|
-
import HapCategories from './HapCategories';
|
|
4
|
+
import HapCategories from './hap-nodejs/HapCategories';
|
|
5
5
|
type HAPHostConfigType = NodeDef & {
|
|
6
6
|
bridgeName: string;
|
|
7
7
|
pinCode: string;
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { NodeDef } from 'node-red';
|
|
2
|
-
import
|
|
3
|
-
type HAPService2ConfigType = NodeDef & {
|
|
4
|
-
isParent: boolean;
|
|
5
|
-
hostType: number;
|
|
6
|
-
bridge: string;
|
|
7
|
-
accessoryId: string;
|
|
8
|
-
parentService: string;
|
|
9
|
-
name: string;
|
|
10
|
-
serviceName: string;
|
|
11
|
-
topic: string;
|
|
12
|
-
filter: boolean;
|
|
13
|
-
manufacturer: string;
|
|
14
|
-
model: string;
|
|
15
|
-
serialNo: string;
|
|
16
|
-
firmwareRev?: string;
|
|
17
|
-
hardwareRev?: string;
|
|
18
|
-
softwareRev?: string;
|
|
19
|
-
characteristicProperties: string;
|
|
20
|
-
waitForSetupMsg: boolean;
|
|
2
|
+
import HAPServiceConfigType from './HAPServiceConfigType';
|
|
3
|
+
type HAPService2ConfigType = NodeDef & HAPServiceConfigType & {
|
|
21
4
|
useEventCallback: boolean;
|
|
22
|
-
}
|
|
5
|
+
};
|
|
23
6
|
export default HAPService2ConfigType;
|
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
import { Accessory, Characteristic, CharacteristicChange, CharacteristicGetCallback, CharacteristicProps, CharacteristicSetCallback, CharacteristicValue, Service } from 'hap-nodejs';
|
|
2
|
-
import { HAPConnection } from 'hap-nodejs/dist/lib/util/eventedhttp';
|
|
3
|
-
import { NodeAPI } from 'node-red';
|
|
4
|
-
import { NodeStatusUtils } from '../utils/NodeStatusUtils';
|
|
5
|
-
import HAPHostNodeType from './HAPHostNodeType';
|
|
6
1
|
import HAPService2ConfigType from './HAPService2ConfigType';
|
|
7
2
|
import HAPServiceNodeType from './HAPServiceNodeType';
|
|
8
3
|
import NodeType from './NodeType';
|
|
9
|
-
|
|
10
|
-
type HAPService2NodeType = NodeType & {
|
|
4
|
+
type HAPService2NodeType = NodeType & HAPServiceNodeType & {
|
|
11
5
|
config: HAPService2ConfigType;
|
|
12
|
-
RED: NodeAPI;
|
|
13
|
-
setupDone: boolean;
|
|
14
|
-
configured: boolean;
|
|
15
|
-
handleWaitForSetup: (msg: any) => any;
|
|
16
|
-
onIdentify: (paired: boolean, callback: () => any) => void;
|
|
17
|
-
hostNode: HAPHostNodeType;
|
|
18
|
-
childNodes?: (HAPService2NodeType | HAPServiceNodeType)[];
|
|
19
|
-
service: Service;
|
|
20
|
-
parentService: Service;
|
|
21
|
-
parentNode?: HAPService2NodeType | HAPServiceNodeType;
|
|
22
|
-
accessory: Accessory;
|
|
23
|
-
characteristicProperties: {
|
|
24
|
-
[key: string]: CharacteristicProps;
|
|
25
|
-
};
|
|
26
|
-
supported: string[];
|
|
27
|
-
publishTimers: PublishTimersType;
|
|
28
|
-
topic_in: string;
|
|
29
|
-
onCharacteristicGet: (this: Characteristic, callback: CharacteristicGetCallback, context: any, connection?: HAPConnection) => void;
|
|
30
|
-
onCharacteristicSet: (this: Characteristic, newValue: CharacteristicValue, callback: CharacteristicSetCallback, context: any, connection?: HAPConnection) => void;
|
|
31
|
-
onCharacteristicChange: (this: Characteristic, change: CharacteristicChange) => void;
|
|
32
|
-
uniqueIdentifier: string;
|
|
33
|
-
reachable?: boolean;
|
|
34
|
-
nodeStatusUtils: NodeStatusUtils;
|
|
35
6
|
};
|
|
36
7
|
export default HAPService2NodeType;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AdaptiveLightingControllerMode } from 'hap-nodejs/dist/lib/controller/AdaptiveLightingController';
|
|
1
2
|
import { NodeDef } from 'node-red';
|
|
2
3
|
import CameraConfigType from './CameraConfigType';
|
|
3
4
|
type HAPServiceConfigType = NodeDef & {
|
|
@@ -18,5 +19,8 @@ type HAPServiceConfigType = NodeDef & {
|
|
|
18
19
|
softwareRev?: string;
|
|
19
20
|
characteristicProperties: string;
|
|
20
21
|
waitForSetupMsg: boolean;
|
|
22
|
+
adaptiveLightingOptionsEnable?: boolean;
|
|
23
|
+
adaptiveLightingOptionsMode?: AdaptiveLightingControllerMode;
|
|
24
|
+
adaptiveLightingOptionsCustomTemperatureAdjustment?: number;
|
|
21
25
|
} & CameraConfigType;
|
|
22
26
|
export default HAPServiceConfigType;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var HapAdaptiveLightingControllerMode;
|
|
4
|
+
(function (HapAdaptiveLightingControllerMode) {
|
|
5
|
+
HapAdaptiveLightingControllerMode[HapAdaptiveLightingControllerMode["AUTOMATIC"] = 1] = "AUTOMATIC";
|
|
6
|
+
HapAdaptiveLightingControllerMode[HapAdaptiveLightingControllerMode["MANUAL"] = 2] = "MANUAL";
|
|
7
|
+
})(HapAdaptiveLightingControllerMode || (HapAdaptiveLightingControllerMode = {}));
|
|
8
|
+
exports.default = HapAdaptiveLightingControllerMode;
|
|
@@ -184,6 +184,7 @@ module.exports = function (node) {
|
|
|
184
184
|
done();
|
|
185
185
|
};
|
|
186
186
|
const getOrCreate = function (accessory, serviceInformation, parentService) {
|
|
187
|
+
var _a;
|
|
187
188
|
const newService = new Service[serviceInformation.serviceName](serviceInformation.name, serviceInformation.UUID);
|
|
188
189
|
log.debug(`Looking for service with UUID ${serviceInformation.UUID} ...`);
|
|
189
190
|
let service = accessory.services.find((service) => {
|
|
@@ -202,6 +203,21 @@ module.exports = function (node) {
|
|
|
202
203
|
}
|
|
203
204
|
else {
|
|
204
205
|
service = accessory.addService(newService);
|
|
206
|
+
if (serviceInformation.serviceName === 'Lightbulb' &&
|
|
207
|
+
serviceInformation.config.adaptiveLightingOptionsEnable) {
|
|
208
|
+
try {
|
|
209
|
+
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(service, {
|
|
210
|
+
controllerMode: (_a = serviceInformation.config
|
|
211
|
+
.adaptiveLightingOptionsMode) !== null && _a !== void 0 ? _a : 1,
|
|
212
|
+
customTemperatureAdjustment: serviceInformation.config
|
|
213
|
+
.adaptiveLightingOptionsCustomTemperatureAdjustment,
|
|
214
|
+
});
|
|
215
|
+
accessory.configureController(adaptiveLightingController);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
log.error(`Failed to configure adaptive lightning due to ${error}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
223
|
else {
|
|
@@ -207,6 +207,7 @@ module.exports = function (node) {
|
|
|
207
207
|
done();
|
|
208
208
|
};
|
|
209
209
|
const getOrCreate = function (accessory, serviceInformation, parentService) {
|
|
210
|
+
var _a;
|
|
210
211
|
const newService = new Service[serviceInformation.serviceName](serviceInformation.name, serviceInformation.UUID);
|
|
211
212
|
log.debug(`Looking for service with UUID ${serviceInformation.UUID} ...`);
|
|
212
213
|
let service = accessory.services.find((service) => {
|
|
@@ -225,6 +226,21 @@ module.exports = function (node) {
|
|
|
225
226
|
}
|
|
226
227
|
else {
|
|
227
228
|
service = accessory.addService(newService);
|
|
229
|
+
if (serviceInformation.serviceName === 'Lightbulb' &&
|
|
230
|
+
serviceInformation.config.adaptiveLightingOptionsEnable) {
|
|
231
|
+
try {
|
|
232
|
+
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(service, {
|
|
233
|
+
controllerMode: (_a = serviceInformation.config
|
|
234
|
+
.adaptiveLightingOptionsMode) !== null && _a !== void 0 ? _a : 1,
|
|
235
|
+
customTemperatureAdjustment: serviceInformation.config
|
|
236
|
+
.adaptiveLightingOptionsCustomTemperatureAdjustment,
|
|
237
|
+
});
|
|
238
|
+
accessory.configureController(adaptiveLightingController);
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
log.error(`Failed to configure adaptive lightning due to ${error}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
}
|
|
230
246
|
else {
|
package/build/nodes/service.html
CHANGED
|
@@ -194,6 +194,25 @@
|
|
|
194
194
|
</div>
|
|
195
195
|
</div>
|
|
196
196
|
|
|
197
|
+
<div id="adaptive-lightning-configuration" style="display: none; border: 1px solid var(--red-ui-secondary-border-color); padding: 12px 12px 0 12px; margin-bottom: 12px;">
|
|
198
|
+
<label> <i class="fa fa-cog"></i> Adaptive Lightning Configuration</label>
|
|
199
|
+
<div class="form-row">
|
|
200
|
+
<label for="node-input-adaptiveLightingOptionsEnable"><i class="fa fa-toggle-on"></i> Enable</label>
|
|
201
|
+
<input type="checkbox" id="node-input-adaptiveLightingOptionsEnable">
|
|
202
|
+
</div>
|
|
203
|
+
<div class="form-row">
|
|
204
|
+
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
|
+
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
+
<option value="0" selected="selected">AUTOMATIC</option>
|
|
207
|
+
<option value="1">MANUAL</option>
|
|
208
|
+
</select>
|
|
209
|
+
</div>
|
|
210
|
+
<div class="form-row">
|
|
211
|
+
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
+
<input type="text" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
197
216
|
<div class="form-row">
|
|
198
217
|
<label for="node-input-characteristicProperties"><i class="fa fa-wrench"></i> Characteristic Properties</label>
|
|
199
218
|
<input type="text" id="node-input-characteristicProperties" style="width: 70%">
|
|
@@ -474,7 +493,16 @@
|
|
|
474
493
|
},
|
|
475
494
|
outputs: {
|
|
476
495
|
value: 2,
|
|
477
|
-
}
|
|
496
|
+
},
|
|
497
|
+
adaptiveLightingOptionsEnable: {
|
|
498
|
+
value: false,
|
|
499
|
+
},
|
|
500
|
+
adaptiveLightingOptionsMode: {
|
|
501
|
+
value: 0,
|
|
502
|
+
},
|
|
503
|
+
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
504
|
+
value: undefined,
|
|
505
|
+
},
|
|
478
506
|
},
|
|
479
507
|
inputs: 1,
|
|
480
508
|
outputs: 2,
|
|
@@ -581,6 +609,7 @@
|
|
|
581
609
|
})
|
|
582
610
|
|
|
583
611
|
let cameraConfiguration = $('#camera-configuration')
|
|
612
|
+
let adaptiveLightningConfiguration = $('#adaptive-lightning-configuration')
|
|
584
613
|
|
|
585
614
|
selectServiceName
|
|
586
615
|
.find('option')
|
|
@@ -601,6 +630,16 @@
|
|
|
601
630
|
})
|
|
602
631
|
.change()
|
|
603
632
|
|
|
633
|
+
selectServiceName
|
|
634
|
+
.change(function () {
|
|
635
|
+
if (this.value === 'Lightbulb') {
|
|
636
|
+
adaptiveLightningConfiguration.fadeIn('fast')
|
|
637
|
+
} else {
|
|
638
|
+
adaptiveLightningConfiguration.fadeOut('fast')
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
.change()
|
|
642
|
+
|
|
604
643
|
$('#node-input-characteristicProperties').typedInput({
|
|
605
644
|
type: 'json',
|
|
606
645
|
types: ['json'],
|
|
@@ -194,6 +194,25 @@
|
|
|
194
194
|
</div>
|
|
195
195
|
</div>
|
|
196
196
|
|
|
197
|
+
<div id="adaptive-lightning-configuration" style="display: none; border: 1px solid var(--red-ui-secondary-border-color); padding: 12px 12px 0 12px; margin-bottom: 12px;">
|
|
198
|
+
<label> <i class="fa fa-cog"></i> Adaptive Lightning Configuration</label>
|
|
199
|
+
<div class="form-row">
|
|
200
|
+
<label for="node-input-adaptiveLightingOptionsEnable"><i class="fa fa-toggle-on"></i> Enable</label>
|
|
201
|
+
<input type="checkbox" id="node-input-adaptiveLightingOptionsEnable">
|
|
202
|
+
</div>
|
|
203
|
+
<div class="form-row">
|
|
204
|
+
<label for="node-input-adaptiveLightingOptionsMode"><i class="fa fa-hand-o-up"></i> Mode</label>
|
|
205
|
+
<select id="node-input-adaptiveLightingOptionsMode">
|
|
206
|
+
<option value="0" selected="selected">AUTOMATIC</option>
|
|
207
|
+
<option value="1">MANUAL</option>
|
|
208
|
+
</select>
|
|
209
|
+
</div>
|
|
210
|
+
<div class="form-row">
|
|
211
|
+
<label for="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment"><i class="fa fa-thermometer-quarter"></i> Custom Temperature Adjustment</label>
|
|
212
|
+
<input type="text" id="node-input-adaptiveLightingOptionsCustomTemperatureAdjustment">
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
197
216
|
<div class="form-row">
|
|
198
217
|
<label for="node-input-characteristicProperties"><i class="fa fa-wrench"></i> Characteristic Properties</label>
|
|
199
218
|
<input type="text" id="node-input-characteristicProperties" style="width: 70%">
|
|
@@ -484,7 +503,16 @@ if (nrchkbExperimental) {
|
|
|
484
503
|
},
|
|
485
504
|
outputs: {
|
|
486
505
|
value: 1,
|
|
487
|
-
}
|
|
506
|
+
},
|
|
507
|
+
adaptiveLightingOptionsEnable: {
|
|
508
|
+
value: false,
|
|
509
|
+
},
|
|
510
|
+
adaptiveLightingOptionsMode: {
|
|
511
|
+
value: 0,
|
|
512
|
+
},
|
|
513
|
+
adaptiveLightingOptionsCustomTemperatureAdjustment: {
|
|
514
|
+
value: undefined,
|
|
515
|
+
},
|
|
488
516
|
},
|
|
489
517
|
inputs: 1,
|
|
490
518
|
outputs: 1,
|
|
@@ -583,6 +611,7 @@ if (nrchkbExperimental) {
|
|
|
583
611
|
})
|
|
584
612
|
|
|
585
613
|
let cameraConfiguration = $('#camera-configuration')
|
|
614
|
+
let adaptiveLightningConfiguration = $('#adaptive-lightning-configuration')
|
|
586
615
|
|
|
587
616
|
selectServiceName
|
|
588
617
|
.find('option')
|
|
@@ -603,6 +632,16 @@ if (nrchkbExperimental) {
|
|
|
603
632
|
})
|
|
604
633
|
.change()
|
|
605
634
|
|
|
635
|
+
selectServiceName
|
|
636
|
+
.change(function () {
|
|
637
|
+
if (this.value === 'Lightbulb') {
|
|
638
|
+
adaptiveLightningConfiguration.fadeIn('fast')
|
|
639
|
+
} else {
|
|
640
|
+
adaptiveLightningConfiguration.fadeOut('fast')
|
|
641
|
+
}
|
|
642
|
+
})
|
|
643
|
+
.change()
|
|
644
|
+
|
|
606
645
|
$('#node-input-characteristicProperties').typedInput({
|
|
607
646
|
type: 'json',
|
|
608
647
|
types: ['json'],
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|