Skip to content

Commit

Permalink
Changed check config params.
Browse files Browse the repository at this point in the history
  • Loading branch information
XHunter74 committed Apr 23, 2024
1 parent c0355a8 commit 5746dc1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,20 @@ class GreeHvac extends utils.Adapter {

// The adapters config (in the instance object everything under the attribute "native") is accessible via
// this.config:
if (!this.config.devicelist) {
this.log.error('You should config device list in adapter configuration page');
await this.stop();
}

this.log.info('Device list: ' + JSON.stringify(this.config.devicelist));
this.log.info('Poll interval: ' + this.config.pollInterval);

if (!this.validateIPList(this.config.devicelist)) {
this.log.error('Invalid device list');
if (!this.config.devicelist || this.config.devicelist.length === 0 || !this.validateIPList(this.config.devicelist)) {
this.log.error(`Invalid device list: ${JSON.stringify(this.config.devicelist)}`);
await this.stop();
return

Check failure on line 54 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint (18.x)

Missing semicolon
}

if (this.config.pollInterval < MinPollInterval || isNaN(this.config.pollInterval) || this.config.pollInterval > MaxPollInterval) {
this.log.error('Invalid poll interval: ' + this.config.pollInterval);
await this.stop();
return;
}

await this.setStateAsync('info.connection', { val: false, ack: true });
Expand Down

0 comments on commit 5746dc1

Please sign in to comment.