Skip to content

[tibber] Introduce history values - #20699

Merged
lsiepel merged 4 commits into
openhab:mainfrom
weymann:tibber-history
May 25, 2026
Merged

[tibber] Introduce history values#20699
lsiepel merged 4 commits into
openhab:mainfrom
weymann:tibber-history

Conversation

@weymann

@weymann weymann commented May 10, 2026

Copy link
Copy Markdown
Member

Tibber users can query historic values for consumption, production and costs. New history group is introduced to present these values. Timeseries is used to strore the values in persistence. Update runs on daily basis.

Fixes #16797

weymann added 3 commits May 9, 2026 18:16
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 history channel 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 fetchHistory Thing Action and updated documentation/i18n; adjusted tests and factory wiring for StorageService.

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>

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from my side, but maybe @jlaur has something to add.

@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label May 13, 2026
@lsiepel
lsiepel requested a review from jlaur May 16, 2026 09:00
@lsiepel
lsiepel merged commit db89c29 into openhab:main May 25, 2026
3 checks passed
@lsiepel lsiepel added this to the 5.2 milestone May 25, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tibber] monthly and annual information.

3 participants