diff --git a/build/nodes/service.html b/build/nodes/service.html
index ea6eb684..a8f3855a 100644
--- a/build/nodes/service.html
+++ b/build/nodes/service.html
@@ -203,13 +203,13 @@
-
+
@@ -498,10 +498,12 @@ Characteristic Properties
value: false,
},
adaptiveLightingOptionsMode: {
- value: 0,
+ value: 1,
+ validate: RED.validators.number()
},
adaptiveLightingOptionsCustomTemperatureAdjustment: {
- value: undefined,
+ value: 0,
+ validate: RED.validators.number()
},
},
inputs: 1,
diff --git a/build/nodes/service2.html b/build/nodes/service2.html
index 5933f715..a96c8d40 100644
--- a/build/nodes/service2.html
+++ b/build/nodes/service2.html
@@ -203,13 +203,13 @@
-
+
@@ -508,10 +508,12 @@ Characteristic Properties
value: false,
},
adaptiveLightingOptionsMode: {
- value: 0,
+ value: 1,
+ validate: RED.validators.number()
},
adaptiveLightingOptionsCustomTemperatureAdjustment: {
- value: undefined,
+ value: 0,
+ validate: RED.validators.number()
},
},
inputs: 1,
diff --git a/package-lock.json b/package-lock.json
index 1f58000c..680e5b73 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
"name": "node-red-contrib-homekit-bridged",
- "version": "1.7.0-dev.2",
+ "version": "1.7.0-dev.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "node-red-contrib-homekit-bridged",
- "version": "1.7.0-dev.2",
+ "version": "1.7.0-dev.3",
"license": "Apache-2.0",
"dependencies": {
- "@nrchkb/logger": "^2.0.2",
+ "@nrchkb/logger": "^3.0.0",
"hap-nodejs": "0.12.2",
"node-persist": "^4.0.1",
"semver": "^7.6.2",
@@ -738,12 +738,27 @@
}
},
"node_modules/@nrchkb/logger": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/@nrchkb/logger/-/logger-2.0.2.tgz",
- "integrity": "sha512-HrUalHjO1UOrvEHDHQ0z4kgOQ7Enmvhqq8JLe/ZmSCRCKw2Gt78ziClpFJ6lEz7M8jimTHVvlrdd39QB9tcnQg==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@nrchkb/logger/-/logger-3.0.0.tgz",
+ "integrity": "sha512-hDWLzX0IXiWcQUO4qsqnTW9BE4vodHtd871blHSS5s/5efR0snWERxoahGvDdsakdObRLn65D8xE1oZY42jiEA==",
"dependencies": {
- "@types/debug": "^4.1.12",
- "debug": "^4.3.4"
+ "debug": "^4.3.5"
+ }
+ },
+ "node_modules/@nrchkb/logger/node_modules/debug": {
+ "version": "4.3.5",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz",
+ "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==",
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
}
},
"node_modules/@pkgr/core": {
@@ -881,14 +896,6 @@
"@types/node": "*"
}
},
- "node_modules/@types/debug": {
- "version": "4.1.12",
- "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
- "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
- "dependencies": {
- "@types/ms": "*"
- }
- },
"node_modules/@types/express": {
"version": "4.17.17",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
@@ -952,11 +959,6 @@
"integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==",
"dev": true
},
- "node_modules/@types/ms": {
- "version": "0.7.34",
- "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
- "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g=="
- },
"node_modules/@types/node": {
"version": "18.19.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.34.tgz",
diff --git a/package.json b/package.json
index c2fe4b4c..cf2907d3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-homekit-bridged",
- "version": "1.7.0-dev.2",
+ "version": "1.7.0-dev.3",
"description": "Node-RED nodes to simulate Apple HomeKit devices.",
"main": "build/nodes/nrchkb.js",
"scripts": {
@@ -42,7 +42,7 @@
},
"homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
"dependencies": {
- "@nrchkb/logger": "^2.0.2",
+ "@nrchkb/logger": "^3.0.0",
"hap-nodejs": "0.12.2",
"node-persist": "^4.0.1",
"semver": "^7.6.2",
diff --git a/src/lib/utils/ServiceUtils.ts b/src/lib/utils/ServiceUtils.ts
index 3e90130e..2f74aab1 100644
--- a/src/lib/utils/ServiceUtils.ts
+++ b/src/lib/utils/ServiceUtils.ts
@@ -5,6 +5,7 @@ import {
Accessory,
AdaptiveLightingController,
AdaptiveLightingControllerMode,
+ AdaptiveLightingOptions,
Characteristic,
CharacteristicChange,
CharacteristicGetCallback,
@@ -474,24 +475,35 @@ module.exports = function (node: HAPServiceNodeType) {
const configureAdaptiveLightning = () => {
if (
- node.service.name === 'Lightbulb' &&
+ node.service.UUID === Service.Lightbulb.UUID &&
node.config.adaptiveLightingOptionsEnable
) {
try {
+ node.service.getCharacteristic(Characteristic.Brightness)
+ node.service.getCharacteristic(Characteristic.ColorTemperature)
+
+ const options: AdaptiveLightingOptions = {
+ controllerMode: node.config.adaptiveLightingOptionsMode
+ ? +node.config.adaptiveLightingOptionsMode
+ : AdaptiveLightingControllerMode.AUTOMATIC,
+ customTemperatureAdjustment: node.config
+ .adaptiveLightingOptionsCustomTemperatureAdjustment
+ ? +node.config
+ .adaptiveLightingOptionsCustomTemperatureAdjustment
+ : undefined,
+ }
+
+ log.trace(
+ `Configuring Adaptive Lighting with options: ${options}`
+ )
+
const adaptiveLightingController =
- new AdaptiveLightingController(node.service, {
- controllerMode:
- node.config.adaptiveLightingOptionsMode ??
- AdaptiveLightingControllerMode.AUTOMATIC,
- customTemperatureAdjustment:
- node.config
- .adaptiveLightingOptionsCustomTemperatureAdjustment,
- })
+ new AdaptiveLightingController(node.service, options)
node.accessory.configureController(adaptiveLightingController)
} catch (error) {
log.error(
- `Failed to configure adaptive lightning due to ${error}`
+ `Failed to configure Adaptive Lightning due to ${error}`
)
}
}