add support to dynamic interval time for polling the status

pull/923/head
Molham 2025-04-19 14:19:28 +02:00 committed by Bastien Wirtz
parent 9307f5a926
commit 28ad80369f
2 changed files with 8 additions and 3 deletions

View File

@ -468,10 +468,11 @@ The following configuration is available for the PiHole service.
- name: "Pi-hole"
logo: "assets/tools/sample.png"
# subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown
url: "http://192.168.0.151/admin"
url: "http://192.168.0.151/admin" # For v6 API, do not include /admin in the URL
apikey: "<---insert-api-key-here--->" # optional, needed if web interface is password protected
type: "PiHole"
apiVersion: 5 # optional, defaults to 5. Use 6 if your PiHole instance uses API v6
checkInterval: 3000 # optional, defaults to 300000. interval in ms to check Pi-hole status
```
**Remarks:**

View File

@ -68,8 +68,12 @@ export default {
methods: {
startStatusPolling: function () {
this.fetchStatus();
// Poll every 5 minutes
this.pollInterval = setInterval(this.fetchStatus, 300000);
// Set the interval to the checkInterval or default to 5 minutes
const interval = parseInt(this.item.checkInterval, 10) || 300000;
if (this.item.checkInterval < 1000) {
this.item.checkInterval = 1000;
}
this.pollInterval = setInterval(this.fetchStatus, interval);
},
stopStatusPolling: function () {
if (this.pollInterval) {