Tibber Binding

Awesome that you started to look into this!

I don’t have a y device that reports my real-time consumption to the tibber app, so I’m interested in getting the energy price. However, if I would’ve had it I would’ve required as close to real time values as possible.

With the energy price i would draw two graphs, today’s and tomorrows energy prices per hour. As you say the current energy price (the current hour) is a must, but for the graphs I would need also today’s and tomorrows energy price ( maybe that’s what you mean by the current price). I don’t know what possibilities there are, but 24 values (one for each hour) in some format would be great.

Also I scrolled through the API documentation (not that I understand the details) and it looked like there was some value available for high/low energy price that would be nivlve to get

Glad to help out as much as it’s worth without the technical understanding :slightly_smiling_face:

Then I believe I have an initial version ready to test:

Requires Tibber personal token as manual input as part of binding initialization (retrived by logging in to personal Tibber account): https://thewall.tibber.com/Account/Login?

Also, as part of initialization, user defines the desired refresh interval (minimum 1 minute) as to how often the binding is polling data/measurements.

Current Features of binding

  1. Home ID retrieval

  2. Current Price (hourly)
    Will enable persistence in OpenHab, thus enabling graph options for historic price.

  3. Daily cost/consumption
    Report total cost and consumption from last/previous day.

  4. Hourly cost/consumption
    Report total cost and consumption from last/previous hour.

Note:
I assume resolution for consumption, i.e. last/previous hour, is too infrequent, but is apparently the best we can achieve from polling method. In order to get more frequent updates (real time), websocket connection would be required, and a more complex binding structure would be required.

Also, extension of the binding would be required to get “future” price data.

Please feel free to test the binding and report back issues/improvements.

2 Likes

Great!

I was going to test this, but turns out I’ve forgotten how to use OH (I think) :stuck_out_tongue: I added the .jar file to the addons folder as you can see below. But the binding doesn’t show up in the console (also screen shot below). What am I missing? I’ve tried to reboot OH, but no luck…

image
image

EDIT: I’m running OH 2.4 stable on a RPi3b (Raspbian), do I need to upgrade to 2.5 perhaps?

Your approach of adding the jar file to the addons folder seems right, so not sure why it does not start automatically (did start automatically and became active for me, as shown below).

Note: Please download the latest version from the link, I identified a bug which is corrected into a new jar file.

Have you tried (from console):
bundle:install -s file:/usr/share/openhab2/addons/org.openhab.binding.tibber-2.5.0-SNAPSHOT.jar where you change the path to your path of the addons folder?

After upgrading to the latest Milestone build of 2.5 it’s working. I also downloaded the latest build of the .jar. The binding is there now in PaperUI. Now for my next noob question. How do I get the Token from thewall.tibber.com? I suspect that I should use chrome dev tool and use the RequestVerificationToken, but it’s not working. Am I completely out in the blue?
image

Good to hear! I am still running OH 2.4 stable release, and the install worked as supposed to.

Go to https://thewall.tibber.com/Account/Login? in your regular web browser (no need using dev tools), log in to the page using your Tibber account credentials, and there the token key is available/visible as “copy to clipboard”.

Then just input the token as part of binding initialization.

Just an update:

Struggle with a bug, as the response from Tibber is sending null response for hourly cost/consumption right around hour transition.

Thus, need to evaluate refresh time, and will also check alternative handling of response in the binding.

Also, the websocket solution for realtime measurements would be the preferred solution, but havent’t been able to dig into this approach yet.

UPDATE
I believe I have found a workaround for the null response from Tibber around hour/day transition, thus I have replaced the jar file to be downloaded (from the link provided above).

Hi @kjoglums, where can I find the jar file?

@Baruba:

Check out github link provided in post above:
Link

Currently the binding supports retrieval of current price, daily cost/consumption and hourly cost/consumption (see graph examples using Grafana below). Keep on working to get websocket/real time measurements.

Hello, I cant for the life of me find the .jar file in the link you posted. Im not very experienced in using Github, Do I have to download the source and do something with it?

Steinar

1 Like

https://github.com/kjoglum/openhab2-addons/releases/download/1.0.0/org.openhab.binding.tibber-2.5.0-SNAPSHOT.jar

And to comment the binding further: I have both Tibber Pulse and Tibber Electricity. And as a criteria for getting thing (Tibber binding) Online, homeID must be received as part of the initial response from Tibber (automatically handled by the binding). So for me, this is working.

However, have realized that the homeID might not be present if one only have Tibber Electricity? If that is the case, you will not be able to get Online, and I will need to change the criterias in the binding to set thing Online.

Thank you very much, binding is now installed and appearing in PaperUI, but you may be right in the last post, i dont have tibber pulse and i cant seem to enter my token anywhere. I would presume a Thing would appear where i can enter the token?

There is something strange with the link to where to find the token. I think it’s just a link to the login screen, you need to have been redirected there by tibber to be redirected to the correct site after logging in. When I clicked and logged in I was just met by a picture of the wall from game of thrones :joy: After googling tibber api access token I was able to find the correct link.

I was able to enter the access token and receive the current energy price for the first hour and now it’s just in “Uninitilized” state and can’t seem to get it running again

You enter the token in the Tibber thing configuration. If that is not available for you, what is then “appearing in paper UI”?

I only have the electricity contract from tibber, but the binding shows a home id so I think you’re good. But of course i don’t know if it’s my “real” home Id

@Steinar_Gradal

Strange, regardless you should be able to provide personal token for initialization. From PaperUI, after trying to install new Thing (+), which of the below steps are not possible for you? Have you tried rebooting OpenHab?

  1. Choose binding to install new thing from

  2. Choose thing

  3. Configure thing

@kosken

Appreciate the testing and response you provide.

The fact that you get homeID means you are having one, and it is correct. Binding is set up to retrieve JsonObject “id”, and the fact that you get homeID as a channel means it is correctly retrieved.

The reason for the “Handler_Initializing_Error” could be a result of a bug within the binding. What I have realized myself: The binding is set up to set thing OFFLINE / handle exceptions (errors). I did however not prepare the binding to handle events where queries are timed out from Tibber. So I have seen my Thing become OFFLINE, although response/data have been retrieved still.

A couple ot things to try:

  1. Enable debug (from OH console, log:set debug org.openhab.binding.tibber)
    This will show you the actual response from Tibber every “refresh_time_interval” you have set. If response keeps coming in from log, your data is tracked even if Thing is defined as UNINITALIZED / OFFLINE. Will off course follow up this bug.
  2. Have you tried to delete Tibber Thing and reinstalled it in PaperUI?

My bad, restart openhab an i can create the Thing and everyting is working.

As a sidenote for other users, i am on Openhab 2.4 stable and i had to install a a newer version of gson.

bundle:install http://central.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar

1 Like

I downloaded the latest .jar file and it started to work. I’ll keep an eye on it to see how it works. Will start to persist the hourly prices as well so it’s easy to see when things stopped working (if they do). Great binding!

1 Like

Then I have a new version of the binding, now also enabling live measurements (Tibber Pulse is required), and would appreciate if others also could test. Features:

  • Bug fix for initial contribution (price/consumption queries)
  • Added functionality for live measurements for Tibber Pulse users (websocket stream)

JAR file
https://github.com/kjoglum/openhab2-addons/releases/download/2.0.0/org.openhab.binding.tibber-2.5.0-SNAPSHOT.jar

README
Readme

NOTE:
To enable live measurements (Tibber Pulse users only), the user need to manually set “Pulse” as addon as part of configuration in PaperUI (shown below).

Users not having Tibber Pulse need to set Addon “None”, and will still retrieve query based price/consumption data.