Skip to content

Commit

Permalink
use this.setTimeout instead of this.setInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Weber committed Nov 29, 2024
1 parent ab89e6a commit 94c1c3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
**Tests:** ![Test and Release](https://github.com/weberk/ioBroker.uvr16xx-blnet/workflows/Test%20and%20Release/badge.svg)

## uvr16xx-blnet adapter for ioBroker
An ioBroker adapter for reading data from one or up to eight UVRxx controllers by [Technische Alternative](http://www.ta.co.at) using BL-NET.

An ioBroker adapter for reading data from one or up to eight UVRxx controllers by [Technische Alternative](http://www.ta.co.at) using BL-NET.

After installation, you need to create an instance and configure custom values for the IP address, port number, and update interval that the instance should use.

Expand All @@ -33,10 +34,11 @@ Placeholder for next version: ### **WORK IN PROGRESS**
- improved node typing;
- explicitely created every node;
- improved outputs value filter;
- ensured calls to setObjectNotExistsAsync happen only once;
- ensured calls to setObjectNotExistsAsync happen only once;
- removed data_frame_number parameter
- introduced limit for poll intervall
- removed obsolete react admin GUI settings and artefacts
- use this.setTimeout instead of this.setInterval

### 1.0.18 (2024-11-28)

Expand Down
10 changes: 8 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Uvr16xxBlNet extends utils.Adapter {
startPolling() {
const pollInterval = Math.min(this.config.poll_interval * 1000, 3600000); // Poll interval in milliseconds, with a maximum of 3600000 ms (1 hour)

this.pollingInterval = this.setInterval(async () => {
const poll = async () => {
// Perform an initialization read attempt, if failed do not start polling
if (!this.initialized) {
try {
Expand Down Expand Up @@ -109,7 +109,13 @@ class Uvr16xxBlNet extends utils.Adapter {
this.log.error("Error polling state values: " + error);
}
}
}, pollInterval); // Poll every pollInterval milliseconds

// Schedule the next poll
this.setTimeout(poll, pollInterval);
};

// Start the polling loop
this.setTimeout(poll, pollInterval);
}

/**
Expand Down

0 comments on commit 94c1c3f

Please sign in to comment.