Open jovana opened 1 year ago
What is wrong with this line?
if hourly_data.is_production:
What is wrong with this line?
if hourly_data.is_production:
Hi, I meant "it's starting from this line" (again I think). The calculation is not correct, and I have tried to find out what is going wrong, only try to help you trace the issue.
The actual issue from what I can tell is that in https://github.com/Danielhiversen/pyTibber/blob/35dcd185d009b213d6aa46fa4a1a863e5237246d/tibber/tibber_home.py#L484-L487
the logic is wrong ifhasPreviousPage
is false
. So instead of getting previous data, it just gets the same data again.
Also it does not set cursor
(line 497 is not reached). I've reproduced this with the first example from the README.md with pyTibber installed via pip3 install pyTibber
P.S: I'm not sure what the code should do in that case, otherwise I'd create a pull request for it myself.
Cool that you have found the issue. Can we make a pull request to fix this @Danielhiversen ?
By the way: this only impacts new Tibber customers that joined Tibber less than 60 days ago, as the fetch_data function always tries to get 60 days worth of data.
@Danielhiversen has made another PR that also fixes part of the problem: https://github.com/Danielhiversen/pyTibber/pull/273
Its still getting a different (too low) montly cost for me than the app. It looks like the value the app uses is in the "totalCost" field of the "node"'s returned by get_historic_data(), not "cost". Even though the API Docs say that the totalCost field should not be used but the cost field.
Hi,
We have some issues with the HA integration. But the problem seems to be in the pyTibber. (this is the original issue: https://github.com/home-assistant/core/issues/92859)
I think the problem is the consuming energy and the production energy are added together. Probably this is why the readings are not correct.
Probably the issue is on this line: https://github.com/Danielhiversen/pyTibber/blob/35dcd185d009b213d6aa46fa4a1a863e5237246d/tibber/tibber_home.py#L104
Running this example code to reproduce:
This gives me:
30.86
Running the below code on https://developer.tibber.com/explorer
This gives me:
Please let me know if you need more information from me.