Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

Commit 7007ad3

Browse files
committed
fix: Periodically discover new or removed devices
1 parent 0782546 commit 7007ad3

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/platform.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ export class FritzLight implements DynamicPlatformPlugin {
2828
});
2929

3030
this.log.debug('Finished initializing:', this.config.name);
31-
this.api.on('didFinishLaunching', async () => await this.discoverDevices());
31+
this.api.on('didFinishLaunching', async () => {
32+
33+
// Discover new or removed devices
34+
await this.discoverDevices();
35+
36+
// Periodically update device state: every minute
37+
setInterval(async () => await this.refreshState(), 60 * 1000);
38+
});
3239
}
3340

3441
/**
@@ -88,8 +95,8 @@ export class FritzLight implements DynamicPlatformPlugin {
8895
}
8996
}
9097

91-
// Periodically update device info: every minute
92-
setInterval(async () => await this.refreshState(), 60 * 1000);
98+
// Periodically discover new or removed devices: every 10 minutes
99+
setTimeout(async() => await this.discoverDevices(), 10 * 60 * 1000);
93100
}
94101

95102
async refreshState() {

0 commit comments

Comments
 (0)