Skip to content

TibberHome.update_info_and_price_info with parameter to change the resolution of Price_Info#381

Open
Godionplus wants to merge 5 commits intoDanielhiversen:masterfrom
Godionplus:master
Open

TibberHome.update_info_and_price_info with parameter to change the resolution of Price_Info#381
Godionplus wants to merge 5 commits intoDanielhiversen:masterfrom
Godionplus:master

Conversation

@Godionplus
Copy link
Copy Markdown

The new Tibber API allows to request the Price_Info with the resolution QUARTER_HOURLY or HOURLY. For many reasons it is necessary to change the resolution. But the current implementation of pyTibber requests always only the QUARTER_HOURLY resolution.
This pull request includes the changes to add to the TibberHome.update_info_and_price_info function an 'resolution' parameter. In addition, the new const RESOLUTION_QUARTER_HOURLY has been added. Also the gql_query 'UPDATE_INFO_PRICE' has been changed to add the resolution as parameter.

I hope these changes comes to the master branch, in order to give everyone the possibility to change the resolution in the Price_Info request to the Tibber API.

Add
RESOLUTION_QUARTER_HOURLY: Final = "QUARTER_HOURLY"
UPDATE_INFO_PRICE make 'resolution' as parameter
Add parameter in function 'update_info_and_price_info' in order to change the resolution. For compatibly the default value is RESOLUTION_QUARTER_HOURLY. But if necessary, the parameter can also changed to RESOLUTION_HOURLY.
add parameter description of update_info_and_price_info
@Danielhiversen
Copy link
Copy Markdown
Owner

Why do you need this? You can always aggregate the quarterly prices if needed?

Add import RESOLUTION_QUARTER_HOURLY
@Godionplus
Copy link
Copy Markdown
Author

Hi Daniel,
thanks for investigation my changes.
Sorry for the codecheck error. I forgot to add the import of RESOLUTION_QUARTER_HOURLY. I hope now everything is fine.

You ask about the sense of my changes.
You are right, it is possible to aggregate the quarter values.
But there are three reasons for my changes:

  1. Wy should the user of pyTibber complicate his code? It makes no sense to implement aggregation of values, if you get these values simply by calling the Tibber API with the appropriate parameter. Annotation: There are still some cases in house automation to handle/calculate with hourly prices.
  2. The call for 'PriceInfo' at the Tibber API (https://developer.tibber.com/docs/reference#priceinfo) got an additional parameter to change the temporal resolution. Therefore pyTibber should also offer the possibility to use this parameter.
  3. To allow still to get hourly prices with pyTibber, makes it backwards compatible to the old behavior, since there where only hourly values available. (This is my current case, I have to use the new pyTibber with a existing code.)

Let me know what do you think.

beste regards,
Carsten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants