Adding separate configuration for wiz vs hue lights
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
417f017f45
commit
1d39c725af
@ -75,7 +75,7 @@ steps:
|
|||||||
from_secret: ssh_key
|
from_secret: ssh_key
|
||||||
port: 22
|
port: 22
|
||||||
script:
|
script:
|
||||||
- rm -r /home/$SSH_USER/.npm-global/lib/node_modules/@watsonb8/homebridge-flux
|
- rm -r /home/$SSH_USER/.npm-global/lib/node_modules/@watsonb8/homebridge-flux || true
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
@ -92,7 +92,7 @@ steps:
|
|||||||
from_secret: ssh_key
|
from_secret: ssh_key
|
||||||
port: 22
|
port: 22
|
||||||
script:
|
script:
|
||||||
- npm install -g @watsonb8/homebridge-flux --registry https://gitea.watsonlabs.net
|
- npm install -g @watsonb8/homebridge-flux
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
@ -102,18 +102,33 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"ceilingColorTemp": {
|
"hueCeilingColorTemp": {
|
||||||
"title": "Ceiling Color Temperature",
|
"title": "Hue Ceiling Color Temperature",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"sunsetColorTemp": {
|
"hueSunsetColorTemp": {
|
||||||
"title": "Sunset Color Temperature",
|
"title": "Hue Sunset Color Temperature",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"floorColorTemp": {
|
"hueFloorColorTemp": {
|
||||||
"title": "Floor Color Temperature",
|
"title": "Hue Floor Color Temperature",
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"wizCeilingColorTemp": {
|
||||||
|
"title": "Wiz Ceiling Color Temperature",
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"wizSunsetColorTemp": {
|
||||||
|
"title": "Wiz Sunset Color Temperature",
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"wizFloorColorTemp": {
|
||||||
|
"title": "Wiz Floor Color Temperature",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
1382
package-lock.json
generated
1382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@watsonb8/homebridge-flux",
|
"name": "@watsonb8/homebridge-flux",
|
||||||
"version": "1.1.4",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node-cron": "^2.0.3",
|
"@types/node-cron": "^2.0.3",
|
||||||
"@types/suncalc": "^1.8.0",
|
"@types/suncalc": "^1.8.0",
|
||||||
"@watsonb8/wiz-lib": "^1.0.1-e1c84.0",
|
"@watsonb8/wiz-lib": "^1.0.1-ae175.0",
|
||||||
"node-cron": "^2.0.3",
|
"node-cron": "^2.0.3",
|
||||||
"node-hue-api": "^4.0.5",
|
"node-hue-api": "^4.0.5",
|
||||||
"suncalc": "^1.8.0"
|
"suncalc": "^1.8.0"
|
||||||
|
@ -235,35 +235,56 @@ export class FluxAccessory {
|
|||||||
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
||||||
);
|
);
|
||||||
|
|
||||||
const startColorTemp = this._config.ceilingColorTemp ?? 4000;
|
const hueStartColorTemp = this._config.hueCeilingColorTemp ?? 4000;
|
||||||
const sunsetColorTemp = this._config.sunsetColorTemp ?? 2800;
|
const hueSunsetColorTemp = this._config.hueSunsetColorTemp ?? 2800;
|
||||||
const floorColorTemp = this._config.floorColorTemp ?? 1900;
|
const hueFloorColorTemp = this._config.hueFloorColorTemp ?? 1900;
|
||||||
|
|
||||||
let newTemp = this._config.ceilingColorTemp;
|
const wizStartColorTemp = this._config.wizCeilingColorTemp ?? 4000;
|
||||||
|
const wizSunsetColorTemp = this._config.wizSunsetColorTemp ?? 2800;
|
||||||
|
const wizFloorColorTemp = this._config.wizFloorColorTemp ?? 1900;
|
||||||
|
|
||||||
|
let newHueTemp = this._config.hueCeilingColorTemp;
|
||||||
|
let newWizTemp = this._config.wizCeilingColorTemp;
|
||||||
|
|
||||||
if (start < now && now < sunsetStart) {
|
if (start < now && now < sunsetStart) {
|
||||||
newTemp = this.getTempOffset(
|
newHueTemp = this.getTempOffset(
|
||||||
startColorTemp,
|
hueStartColorTemp,
|
||||||
sunsetColorTemp,
|
hueSunsetColorTemp,
|
||||||
|
start,
|
||||||
|
sunsetStart
|
||||||
|
);
|
||||||
|
|
||||||
|
newWizTemp = this.getTempOffset(
|
||||||
|
wizStartColorTemp,
|
||||||
|
wizSunsetColorTemp,
|
||||||
start,
|
start,
|
||||||
sunsetStart
|
sunsetStart
|
||||||
);
|
);
|
||||||
} else if (sunsetStart < now && now < sunsetEnd) {
|
} else if (sunsetStart < now && now < sunsetEnd) {
|
||||||
newTemp = this._config.sunsetColorTemp;
|
newHueTemp = this._config.hueSunsetColorTemp;
|
||||||
|
newWizTemp = this._config.wizSunsetColorTemp;
|
||||||
} else if (sunsetEnd < now && now < nightStart) {
|
} else if (sunsetEnd < now && now < nightStart) {
|
||||||
newTemp = this.getTempOffset(
|
newHueTemp = this.getTempOffset(
|
||||||
sunsetColorTemp,
|
hueSunsetColorTemp,
|
||||||
floorColorTemp,
|
hueFloorColorTemp,
|
||||||
|
sunsetEnd,
|
||||||
|
nightStart
|
||||||
|
);
|
||||||
|
|
||||||
|
newWizTemp = this.getTempOffset(
|
||||||
|
wizSunsetColorTemp,
|
||||||
|
wizFloorColorTemp,
|
||||||
sunsetEnd,
|
sunsetEnd,
|
||||||
nightStart
|
nightStart
|
||||||
);
|
);
|
||||||
} else if (nightStart < now && now < sunrise) {
|
} else if (nightStart < now && now < sunrise) {
|
||||||
newTemp = this._config.floorColorTemp;
|
newHueTemp = this._config.hueFloorColorTemp;
|
||||||
|
newWizTemp = this._config.wizFloorColorTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set RGB
|
//Set RGB
|
||||||
this._hueRGB = colorTempToRgb(newTemp);
|
this._hueRGB = colorTempToRgb(newHueTemp);
|
||||||
this._wizRGB = colorTemperature2rgb(newTemp);
|
this._wizRGB = colorTemperature2rgb(newWizTemp);
|
||||||
};
|
};
|
||||||
|
|
||||||
private scheduleLights = async (): Promise<void> => {
|
private scheduleLights = async (): Promise<void> => {
|
||||||
|
@ -34,17 +34,32 @@ export interface IConfig {
|
|||||||
/**
|
/**
|
||||||
* The color temperature at the start of sunset transition
|
* The color temperature at the start of sunset transition
|
||||||
*/
|
*/
|
||||||
ceilingColorTemp: number;
|
hueCeilingColorTemp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color temp during the night
|
* The color temp during the night
|
||||||
*/
|
*/
|
||||||
floorColorTemp: number;
|
hueFloorColorTemp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color temp at sunet
|
* The color temp at sunet
|
||||||
*/
|
*/
|
||||||
sunsetColorTemp: number;
|
hueSunsetColorTemp: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color temperature at the start of sunset transition
|
||||||
|
*/
|
||||||
|
wizCeilingColorTemp: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color temp during the night
|
||||||
|
*/
|
||||||
|
wizFloorColorTemp: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color temp at sunet
|
||||||
|
*/
|
||||||
|
wizSunsetColorTemp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time in milliseconds the lights should remain at sunset temperature.
|
* The time in milliseconds the lights should remain at sunset temperature.
|
||||||
|
Loading…
Reference in New Issue
Block a user