diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..893a97f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,21 @@ +#!/bin/bash +remote_user="bmw" +remote_server="192.168.1.31" +deploy_location="/home/bmw/homebridge-flux" + +#build +tsc --build +#copy files to remote machine +scp -r bin $remote_user@$remote_server:$deploy_location +scp package.json $remote_user@$remote_server:$deploy_location + +#install package +ssh -t $remote_user@$remote_server "sudo npm install -g --unsafe-perm $deploy_location" + +#restart service +ssh -t +ssh -t $remote_user@$remote_server "sudo systemctl restart homebridge.service" +ssh -t $remote_user@$remote_server "sudo systemctl status homebridge.service" + +echo done +exit diff --git a/src/fluxAccessory.ts b/src/fluxAccessory.ts index 78fbb3a..b9078e9 100644 --- a/src/fluxAccessory.ts +++ b/src/fluxAccessory.ts @@ -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 = []; @@ -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();