[pihole] Discrepencies between dashboard and channels#20394
Open
clinique wants to merge 3 commits intoopenhab:mainfrom
Open
[pihole] Discrepencies between dashboard and channels#20394clinique wants to merge 3 commits intoopenhab:mainfrom
clinique wants to merge 3 commits intoopenhab:mainfrom
Conversation
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Contributor
|
I'm ooo. Will take a look next week |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the Pi-hole v6 binding’s ads_percentage_today and unique_clients channels with what the Pi-hole dashboard reports by switching the stats window to the last 24 hours and by populating unique_clients from the v6 stats response.
Changes:
- Change the v6 database summary query window from “since midnight” to “last 24 hours” to match dashboard semantics for
ads_percentage_today. - Populate
unique_clientsin the translatedDnsStatisticsusing v6clients.active. - Adjust the v6 stats model naming/visibility to expose the
clientsrecord component.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bundles/org.openhab.binding.pihole/src/main/java/org/openhab/binding/pihole/internal/rest/model/v6/StatAnswer.java | Renames/exposes the clients component so the v6 stats payload can be consumed for unique client count. |
| bundles/org.openhab.binding.pihole/src/main/java/org/openhab/binding/pihole/internal/rest/JettyAdminServiceV6.java | Updates the stats aggregation window to last-24h and maps v6 client activity into uniqueClients. |
Comments suppressed due to low confidence (1)
bundles/org.openhab.binding.pihole/src/main/java/org/openhab/binding/pihole/internal/rest/JettyAdminServiceV6.java:132
- summary() captures
Instant now = Instant.now()but later uses a secondInstant.now()when computingduration. Reuse the already-capturednowfor consistency (and to avoid tiny time-drift issues in calculations/tests).
Instant now = Instant.now();
String oneDayAgo = Long.toString(now.minus(24, ChronoUnit.HOURS).getEpochSecond());
String toNow = Long.toString(now.getEpochSecond());
StatDatabaseSummary statDatabase = get(databaseSummaryURI, StatDatabaseSummary.class, "from", oneDayAgo,
"until", toNow);
HistoryClients historyClients = get(historyClientsURI, HistoryClients.class, "N", "0");
ConfigAnswer configAnswer = get(configURI, ConfigAnswer.class);
Duration duration = Duration.between(gravity.instant(), Instant.now());
Relative relative = new Relative((int) duration.toDaysPart(), duration.toHoursPart(), duration.toMinutesPart());
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...nding.pihole/src/main/java/org/openhab/binding/pihole/internal/rest/JettyAdminServiceV6.java
Show resolved
Hide resolved
Reintroduce missing channels Signed-off-by: clinique <gael@lhopital.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves #20381
ads_percentage_today: dashboard displays it on the past 24h, while binding worked 'since midnight'. Corrected.unique_clientswas not provided by the binding.gravity-last-updateandgravity-file-exists