[tibber] Introduce history values - #20699
Merged
Merged
Conversation
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> initial commit Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> initial contribution Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> bugfix fetching Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Tibber binding with a new history channel group that exposes historical consumption, production, and cost as TimeSeries values, persisted via StorageService and refreshed on a daily schedule. It addresses the request for monthly and annual values (issue #16797) by adding corresponding channels and a manual action to (re-)fetch history.
Changes:
- Added a new
historychannel group (daily/weekly/monthly/yearly for consumption, production, and cost) plus migration instructions (thingTypeVersion 8). - Implemented history fetching, persistence, and “current period” gap-filling aggregation logic.
- Added a
fetchHistoryThing Action and updated documentation/i18n; adjusted tests and factory wiring forStorageService.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| bundles/org.openhab.binding.tibber/src/test/java/org/openhab/binding/tibber/internal/TibberHandlerTest.java | Updates test construction to pass StorageService to the handler mock. |
| bundles/org.openhab.binding.tibber/src/test/java/org/openhab/binding/tibber/internal/TibberHandlerMock.java | Updates handler mock to accept and forward StorageService. |
| bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/update/instructions.xml | Adds migration instructions (targetVersion 8) for new history channels. |
| bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/thing-types.xml | Adds history channel-group and bumps thingTypeVersion to 8. |
| bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/thing/history-group.xml | Defines the new history channel-group type and its channels. |
| bundles/org.openhab.binding.tibber/src/main/resources/OH-INF/i18n/tibber.properties | Adds i18n labels/descriptions for history group + new status/action texts. |
| bundles/org.openhab.binding.tibber/src/main/resources/graphql/production.graphql | Adds GraphQL template for paginated production history queries. |
| bundles/org.openhab.binding.tibber/src/main/resources/graphql/consumption.graphql | Adds GraphQL template for paginated consumption+cost history queries. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberHandlerFactory.java | Injects StorageService and passes it to TibberHandler. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/TibberBindingConstants.java | Adds history channel/group constants, resource paths, and JSON paths. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/history/TibberHistorySeries.java | Introduces a persisted series model that merges consumption+production results and emits TimeSeries. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/history/TibberHistoryListener.java | Adds callback interface for “history updated” notifications. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/history/TibberHistoryAggregator.java | Adds bottom-up aggregation to synthesize current (incomplete) periods. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/history/TibberHistory.java | Implements history fetching/pagination, persistence, and listener notifications. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/handler/TibberHandler.java | Wires history lifecycle into the Thing handler, scheduling, and channel updates. |
| bundles/org.openhab.binding.tibber/src/main/java/org/openhab/binding/tibber/internal/action/TibberActions.java | Adds fetchHistory(window) Thing Action to trigger a full fetch. |
| bundles/org.openhab.binding.tibber/README.md | Documents the history group and the new fetchHistory action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
markus7017
pushed a commit
to markus7017/openhab-addons
that referenced
this pull request
Jun 13, 2026
* initial commit Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
darkscout
pushed a commit
to darkscout/openhab-addons
that referenced
this pull request
Jul 5, 2026
* initial commit Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
olemr
pushed a commit
to olemr/openhab2-addons
that referenced
this pull request
Aug 8, 2026
* initial commit Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> Signed-off-by: olemr <olemr@olemr.com>
cipianpascu
pushed a commit
to cipianpascu/openhab-addons
that referenced
this pull request
Aug 16, 2026
* initial commit Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
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.
Tibber users can query historic values for consumption, production and costs. New
historygroup is introduced to present these values.Timeseriesis used to strore the values in persistence. Update runs on daily basis.Fixes #16797