mirror of https://github.com/bastienwirtz/homer
add support to dynamic interval time for polling the status
parent
9307f5a926
commit
28ad80369f
|
@ -468,10 +468,11 @@ The following configuration is available for the PiHole service.
|
||||||
- name: "Pi-hole"
|
- name: "Pi-hole"
|
||||||
logo: "assets/tools/sample.png"
|
logo: "assets/tools/sample.png"
|
||||||
# subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown
|
# 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
|
apikey: "<---insert-api-key-here--->" # optional, needed if web interface is password protected
|
||||||
type: "PiHole"
|
type: "PiHole"
|
||||||
apiVersion: 5 # optional, defaults to 5. Use 6 if your PiHole instance uses API v6
|
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:**
|
**Remarks:**
|
||||||
|
|
|
@ -68,8 +68,12 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
startStatusPolling: function () {
|
startStatusPolling: function () {
|
||||||
this.fetchStatus();
|
this.fetchStatus();
|
||||||
// Poll every 5 minutes
|
// Set the interval to the checkInterval or default to 5 minutes
|
||||||
this.pollInterval = setInterval(this.fetchStatus, 300000);
|
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 () {
|
stopStatusPolling: function () {
|
||||||
if (this.pollInterval) {
|
if (this.pollInterval) {
|
||||||
|
|
Loading…
Reference in New Issue