Reset sunset times every time enabled
This commit is contained in:
@ -31,7 +31,6 @@ export class FluxAccessory implements IAccessory {
|
||||
private _switchService: HAPNodeJS.Service;
|
||||
private _infoService: HAPNodeJS.Service;
|
||||
|
||||
private _isEnabled: boolean;
|
||||
private _hue: Api;
|
||||
|
||||
private _lights: Array<Light> = [];
|
||||
@ -51,7 +50,6 @@ export class FluxAccessory implements IAccessory {
|
||||
this._scheduler = new Scheduler(this._config.delay ? this._config.delay : 60000, 60000, this._log);
|
||||
this._scheduler.addTask({ delegate: this.updateDelegate, title: "Update" })
|
||||
|
||||
this._isEnabled = false;
|
||||
this._hue = props.hue;
|
||||
this.name = this._config.name;
|
||||
|
||||
@ -88,6 +86,7 @@ export class FluxAccessory implements IAccessory {
|
||||
*/
|
||||
private onSetEnabled = async (activeState: boolean, callback: (error?: Error | null | undefined) => void) => {
|
||||
if (activeState) {
|
||||
this._times = getTimes(new Date(), this._config.latitude, this._config.longitude);
|
||||
this._scheduler.start();
|
||||
} else {
|
||||
this._scheduler.stop();
|
||||
|
Reference in New Issue
Block a user