Tibber integration to include get_historic_data from pyTibber

Since pyTibber library contains already function to query power consumption, it would be great to include it in the Home Assistant integration.
That in result would help getting Tibber supported using the new Energy feature of Home Assistant.

Would it be possible @Danielhiversen ?

Remember to vote for your own request.

Home Assistant does not know if the user has Discovergy or not (Information is not available in API from Tibber).
I do not want to start polling consumption data for all users, when it is only available for very few users.
So currently not going to add support for it.

To be honest it doesn’t need to be pulled for all the users.
It’s just another flag that can be added to integration setup - “include consumption data yes/no”.
That way those having pulse or live consumption data can enable it for themselves.

Not a very nice solution, so nothing I plan to do.

It works already for everyone with realtime consumption (Pulse or Watty)

I’m in favor of this too! Not using Discovergy, but just want to rather read current consumption without Watty/Pulse in HA.

Your data are then most likely updated only once a day?
There are no support to import historic data to Home Assistant today.

It is still of relevance to look into historic consumption I’d say. By templating one could work something out with looking at the data.

That is a different feature request, and would require Home Assistant to support import of historic data.

I am also interested of this.
I am trying to import it myself with own python script but i don’t know how to use it.

You could use this function in pyTibber: https://github.com/Danielhiversen/pyTibber/blob/1254d643e4fec27a207f2c650019f4e0beaf0ed6/tibber/init.py#L683

I was playing with that but i don’t know how i use it in a script.
Can you give an example?

import tibber
access_token = tibber.DEMO_TOKEN
tibber_connection = tibber.Tibber(access_token)
await tibber_connection.update_info()
print(tibber_connection.name)

home = tibber_connection.get_homes()[0]
await home.get_historic_data(5)

Ok i didn’t have (5) there but i still get errors.

File “tibbertest.py”, line 6
await tibber_connection.update_info()
^
SyntaxError: ‘await’ outside function

Strange i have that problem with your first example on github too.

I recommend that you read up on python async

1 Like

I will try to read about it but shouldn’t your example on github work?
That exemple gives me same error.

I give up i found this instead and i still have statistics from greenely since earlier.
I hope to see something similar integrated in Tibber addon later.

Support for external statistics i did mention above is merged now in newest release.
Has anyone looked at this yet?

I have it on my todo list to add support for historic data

1 Like

ok sounds good.
Another idea after this works would be a “other sensor” that shows the difference between total energy usage of sensors added in energy dashboard and tibber usage.

For example:
Grid Total 3 kWh
Tibber 10 kWh

That would add 7 kWh to other sensor.