Fixed Tibber API breaking changes (Dec 2022)#28
Fixed Tibber API breaking changes (Dec 2022)#28jenskdsgn wants to merge 1 commit intoPelleplutt:mainfrom jenskdsgn:main
Conversation
|
Kudos, SonarCloud Quality Gate passed! |
|
Thank you for this @jenskdsgn. The changes for this are very attractive from the tibber-exporter's standpoint (just a header obviously), I will not merge this however until the changes in python-graphql-client has been accepted. That is a much larger rework however and also includes some other changes. I have run into some asyncio problems that I have not had the time to work out properly. I pushed this WIP just now in new-api-202212 for the sake of collaboration. If I can sort out these problems I will likely move to this solution as the https://github.com/graphql-python/gql package seems more complete. |
|
Thanks for the update on this. If you need anyone to discuss high level ideas or if you want some general feedback ping me. As I said I am not a python expert but maybe there is other parts where I can help. Maybe we can get ahold of an engineer at tibber to explain why the breaking change of the websocket subprotocol was introduced. If you are rewriting, this repo might also be nice for inspiration. |








The PR aims to quick fix the breaking changes introduced by the tibber API
https://developer.tibber.com/docs/overview#breaking-websocket-change
After brief research the it felt like exactly the opposite, that graphql-transport-ws would be the deprecated one.
The graphql library that was picked only supports graphql-ws, so I hope they accept my PR to add the other subprotocol as well. For the time being, I pointed my the reference to my repository with the fix in the graphql library. Once their PR is merged we can point it to the official one again. I guess this is better as to have a fully broken exporter.
This was the error message I encountered:
I compared the websocket messages with Tibbers GraphQL playground and found the mismatching ws subprotocols.
Also they have changed the GraphQL Subscription URL. It would be better to get them dynamically from the GraphQL query API. My Python skills didn't allow to also do that quickly so I just updated the URL.