Skip to content

Commit

Permalink
remove static search intervals, make configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
boergegrunicke committed Aug 8, 2023
1 parent 0bf0ed1 commit c7cb601
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,7 @@ class GoveeLocal extends utils.Adapter {
this.setState('info.connection', { val: true, ack: true });
this.log.info('UDP listening on ' + server.address().address + ':' + server.address().port);

if (this.config.searchInterval == undefined) {
this.config.searchInterval = 10000;
}
if (this.config.deviceStatusRefreshInterval == undefined) {
this.config.deviceStatusRefreshInterval = 1000;
}

const result = this.setInterval(this.sendScan.bind(this), this.config.searchInterval);
const result = this.setInterval(this.sendScan.bind(this), this.config.searchInterval * 1000);
if (result !== void 0) {
searchInterval = result;
}
Expand Down Expand Up @@ -129,13 +122,12 @@ class GoveeLocal extends utils.Adapter {
if (!(messageObject.msg.data.device in intervals)) {
const result = this.setInterval(
() => this.requestDeviceStatus(messageObject.msg.data.ip),
this.config.deviceStatusRefreshInterval,
this.config.deviceStatusRefreshInterval * 1000,
);
if (result !== void 0) {
intervals[messageObject.msg.data.device] = result;
}
}
// this.requestDeviceStatus(remote.address);
break;
case 'devStatus':
const devices = await this.getStatesAsync(this.name + '.' + this.instance + '.*.deviceInfo.ip');
Expand Down

0 comments on commit c7cb601

Please sign in to comment.