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:
@ -235,35 +235,56 @@ export class FluxAccessory {
|
||||
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
||||
);
|
||||
|
||||
const startColorTemp = this._config.ceilingColorTemp ?? 4000;
|
||||
const sunsetColorTemp = this._config.sunsetColorTemp ?? 2800;
|
||||
const floorColorTemp = this._config.floorColorTemp ?? 1900;
|
||||
const hueStartColorTemp = this._config.hueCeilingColorTemp ?? 4000;
|
||||
const hueSunsetColorTemp = this._config.hueSunsetColorTemp ?? 2800;
|
||||
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) {
|
||||
newTemp = this.getTempOffset(
|
||||
startColorTemp,
|
||||
sunsetColorTemp,
|
||||
newHueTemp = this.getTempOffset(
|
||||
hueStartColorTemp,
|
||||
hueSunsetColorTemp,
|
||||
start,
|
||||
sunsetStart
|
||||
);
|
||||
|
||||
newWizTemp = this.getTempOffset(
|
||||
wizStartColorTemp,
|
||||
wizSunsetColorTemp,
|
||||
start,
|
||||
sunsetStart
|
||||
);
|
||||
} else if (sunsetStart < now && now < sunsetEnd) {
|
||||
newTemp = this._config.sunsetColorTemp;
|
||||
newHueTemp = this._config.hueSunsetColorTemp;
|
||||
newWizTemp = this._config.wizSunsetColorTemp;
|
||||
} else if (sunsetEnd < now && now < nightStart) {
|
||||
newTemp = this.getTempOffset(
|
||||
sunsetColorTemp,
|
||||
floorColorTemp,
|
||||
newHueTemp = this.getTempOffset(
|
||||
hueSunsetColorTemp,
|
||||
hueFloorColorTemp,
|
||||
sunsetEnd,
|
||||
nightStart
|
||||
);
|
||||
|
||||
newWizTemp = this.getTempOffset(
|
||||
wizSunsetColorTemp,
|
||||
wizFloorColorTemp,
|
||||
sunsetEnd,
|
||||
nightStart
|
||||
);
|
||||
} else if (nightStart < now && now < sunrise) {
|
||||
newTemp = this._config.floorColorTemp;
|
||||
newHueTemp = this._config.hueFloorColorTemp;
|
||||
newWizTemp = this._config.wizFloorColorTemp;
|
||||
}
|
||||
|
||||
//Set RGB
|
||||
this._hueRGB = colorTempToRgb(newTemp);
|
||||
this._wizRGB = colorTemperature2rgb(newTemp);
|
||||
this._hueRGB = colorTempToRgb(newHueTemp);
|
||||
this._wizRGB = colorTemperature2rgb(newWizTemp);
|
||||
};
|
||||
|
||||
private scheduleLights = async (): Promise<void> => {
|
||||
|
@ -34,17 +34,32 @@ export interface IConfig {
|
||||
/**
|
||||
* The color temperature at the start of sunset transition
|
||||
*/
|
||||
ceilingColorTemp: number;
|
||||
hueCeilingColorTemp: number;
|
||||
|
||||
/**
|
||||
* The color temp during the night
|
||||
*/
|
||||
floorColorTemp: number;
|
||||
hueFloorColorTemp: number;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
Reference in New Issue
Block a user