Skip to content

Commit

Permalink
Merge pull request iobroker-community-adapters#461 from sbormann/patch-1
Browse files Browse the repository at this point in the history
Fix for  iobroker-community-adapters#389 - online-status toggles to false
  • Loading branch information
Apollon77 authored Nov 14, 2021
2 parents c8c21f4 + 8e6878a commit f118377
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ class MQTTClient {
if (stop === 'stop') {
await this.adapter.setStateAsync(deviceId + '.online', {val: false, ack: true});
} else {
let state = await this.adapter.getStateAsync(deviceId + '.online');
if (state && state.val === false) await this.adapter.setStateAsync(deviceId + '.online', {val: true, ack: true});
this.onlinehandle = setTimeout(async () => {
await this.adapter.setStateAsync(deviceId + '.online', {val: false, ack: true});
}, (polltime * 1000) + 10 * 1000);
let state = await this.adapter.getStateAsync(deviceId + '.online');
if (state && state.val === false) await this.adapter.setStateAsync(deviceId + '.online', {val: true, ack: true});
}
} catch (err) {
// Ignore
Expand Down

0 comments on commit f118377

Please sign in to comment.