Skip to content

Commit

Permalink
Renamed.
Browse files Browse the repository at this point in the history
  • Loading branch information
XHunter74 committed May 1, 2024
1 parent 5bab432 commit f3e13d3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const utils = require('@iobroker/adapter-core');

const MinPollInterval = 1000;
const MaxPollInterval = 60000;
const CheckDeviceTimeoutMs = 1000;
const CheckDevicesTimeoutMs = 1000;
const CheckDevicesTimeout = 'CheckDevices';

class GreeHvac extends utils.Adapter {

Expand Down Expand Up @@ -115,16 +116,16 @@ class GreeHvac extends utils.Adapter {
}

checkDevices() {
this.timeouts['CheckDevice'] = this.setTimeout(async () => {
this.timeouts[CheckDevicesTimeout] = this.setTimeout(async () => {
const inactiveDevices = this.activeDevices.filter(device => device.isActive === false);
if (inactiveDevices.length > 0) {
await this.setStateAsync('info.connection', { val: false, ack: true });
} else {
await this.setStateAsync('info.connection', { val: true, ack: true });
}
this.clearTimeout(this.timeouts['CheckDevice']);
this.clearTimeout(this.timeouts[CheckDevicesTimeout]);
this.checkDevices();
}, CheckDeviceTimeoutMs);
}, CheckDevicesTimeoutMs);
}

/**
Expand Down

0 comments on commit f3e13d3

Please sign in to comment.