Can we get access to the OVO energy online account API to download our smart meter usage data?
Hi Ovo,
I wondered whether the API that powers your live and historical usage page in the account menu is something you could look into opening up a bit so we can freely access our raw data and also perhaps it may stimulate some interesting community projects?
For instance (more sport related), Strava and Fitbit.
I have tried removing the headers and I am still getting the same error
@apolosisk You'll still need to authenticate first. See step 1 in the “beat answer" marked at the top of this thread. That should let you authenticate and store and auth cookie. Then include the cookie with the graphql request you're sending.
Just a note on your code, the content type header might need to be “application/json” and I expect it should just be”json=body” rather than wrapping in another document. I'm not sure on these though. Just something to try if you resolve the auth error and still encounter issues.
@apolosiskYou'll still need to authenticate first. See step 1 in the “beat answer" marked at the top of this thread. That should let you authenticate and store and auth cookie. Then include the cookie with the graphql request you're sending.
Just a note on your code, the content type header might need to be “application/json” and I expect it should just be”json=body” rather than wrapping in another document. I'm not sure on these though. Just something to try if you resolve the auth error and still encounter issues.
I have done that, but I am getting that error. I must be missing something in the latest POST:
@apolosisk, see GraphQL. I am surprised the OVO expose this to the client side APIs -- all sort of potential security vulnerabilities there, IMO. However, what you are missing is easily obtained from the browser’s debug query log, and this is that the post expects a JSON encoded input:
The GraphQL website gives the syntax of the QL, if you are interested.
@apolosisk, see GraphQL. I am surprised the OVO expose this to the client side APIs -- all sort of potential security vulnerabilities there, IMO. However, what you are missing is easily obtained from the browser’s debug query log, and this is that the post expects a JSON encoded input:
I still do not understand what I am missing exactly. Is it in the headers? I have tried finding examples and playing around. I took the headers from the first POST (the login) and even made an update:
headers>'Content-Type'] = "application/graphql"
I am not familiar with the authorisation and the examples online do not help
I am not familiar with the authorisation and the examples online do not help
You need to understand how session cookies work and walk through this using your browser debug console to walk through how the client-side JS code on an interactive myovo session builds up the necessary cookies and context. The scripting syntax and the HTTP API are different for python and JS. It’s bit of tedious but fairly straight forward retro-engineering to work out what calls are needed. I can only point the way, not do it all for you.
We love seeing the innovative ways our customers are using tech to help monitor and manage their energy usage. It’s inspiring us to think about ways to do energy differently. We know some customers have been using some of the application programming interface (APIs) behind our public facing services. While we’re OK with that, we do need to make you aware of a couple of things.
These APIs are designed to be used by OVO teams only, and aren't public facing. There are some downsides to using APIs that aren't for the public, and we wanted to let you know what these are. Behind the scenes, OVO uses APIs to share and update information between systems that power your bills and your online account. This is done in partnership with Kaluza, the tech company that’s part of the OVO family. They’ve built the billing platform designed to put our customers in the driving seat of their energy usage.
These internal APIs are intended for use by Kaluza and its clients, who are energy retailers like OVO, rather than customers. Because of this, there’s no support for them being used anywhere else, which means they may be discontinued with no notice when we update our products and services.
OVO Energy and Kaluza need to be able to monitor these APIs, and may block access if there's any problems in the future.
We know some customers may have put time and effort into developing solutions that use these API. So, now that you know the risks, we want to hear from you on how you’re using the APIs and the problems you’re solving with your DIY approach.
Is there anything you’d like to see from OVO to help you monitor and manage your energy better? Leave a comment below to tell us.
I found that this integration didn’t provide information reliably enough though (can’t remember what the issue was) so currently use a ShellyEM for energy monitoring. I currently only use the integration for energy/unit costs, however this still has limitations.
The ideal I think for home assistant would be to have separate gas and electricity usage available as quickly as possible (I realise a limitation on the smart meters is every 30 mins), along with the price per unit (for those using separate energy monitoring such as with a Shelly), and overall cost (i.e. how much have I used so far in £). Essentially, the information that is visible on the IHD.
This isn’t currently covered, but solar FIT rates and standing charges would also be very valuable and should be fairly static data. This would allow the energy dashboard to be fully populated in real time for those with something like a ShellyEM doing the monitoring, and accurate to ~30mins for those without.
Works fine for getting me information into home assistant, and it's not likely to have the rug pulled from under you.
@Fuzzysteve Good to know. I think I looked at their products at one point but wasn’t sure about compatibility. That might have changed now so I’ll take a look. The app provided me with closer to real-time usage for a while, but then the APIs to grab the data seemed to start having issues. Possibly DoS protection given I wasn’t paying for anything ♂️
I use the Home assistant api to get data for my OVO account but it's not real time. I’m aware of the Glowmarkt device but can't justify the cost to be honest.
Another bit of feedback from @blakedrayson who is happy for me to post here on their behalf:
I think that from an API perspective Octopus has been great. However I have continued to use the products of Hildebrand (their SMETS 2 IHD is brilliant and has been a good way to work around supplier areas that were lacking).
I have managed to write a lot of code that integrates with their systems and build my own home display and automation.
I just wanted to share with anyone who might be interested that I have developed a package in R (a programming language mostly used for statistical programming) to interact with the Ovo API. I basically wrote the code based on what it has already been explained in this thread.
It is a very early version, so if you are interested mind the rough edges. You can find it on my GitHub account. I decided to call it Uovo Energy (Uovo means egg in Italian).
I also created a web application alongside the package and put it all in a docker file. The README file explains how to use it.
My experiments in this area have somewhat stalled. Partly due to pressure of family and work life but partly because I still don't have a smart meter. My one and only attempt to get one fitted some years ago resulted in the engineer saying he wouldn't touch the existing gas meter, that it needed someone else to change the mounting. I never heard back. Since then, so many of the people I know who have had one fitted have had nothing but problems, often going years (if ever) before they actually started working, I really don't want one at the moment. Also, since I work from home, I'm reluctant to have to power everything down to get new meters installed.
So currently, I grab my annual figures into a spreadsheet to monitor usage.
One thing that would be super cool would be if the Ovo app was better at showing a this-vs-last year comparison - at the moment, you have to keep switching back and forth between the years and the Y-axis changes making it hard to see visually.
Other than that, I would strongly urge Ovo to have a published API that customers can access using standard REST and appropriate open standards security. If for no other reason than it fits nicely with a “green” stance on helping people better manage and reduce power consumption.
However, the API should not only provide near real-time data from the smart meters but should also give access to the underlying customer data for those of us who don’t have smart meters and for those many people who do but they don’t work. That data would presumably just be monthly data but that is more than sufficient to be honest.
Personally, as I’m active in the Node-RED project, that is what I would use to grab my monthly stats, storing the data locally and showing on a dashboard using my own published UIBUILDER contribution to Node-RED.
Node-RED is also accessible from Home Assistant but is easily run stand-alone and I use it for all my home automation as do many people. It is a low-code development environment and server based on Node.js. It has a very large and supportive user base and a very active community.
I have just published my application which fetches your data and stores it in a local SQLite database on your PC.
It can also export the data to CSV and Excel files, to allow easy anaylsis.
From here you download the zip file, extract it to a folder on your PC, then run it.
Data is written to the folder C:\ProgramData\OvoData
Any problems either raise an issue in GitHub or get back to me here.
At the moment it is Windows only, but as it’s .NET Core and C# it could be compiled for other platforms.
/Mike Williams
I have just published my application which fetches your data and stores it in a local SQLite database on your PC.
That’s great, thanks very much
… download the zip file, extract it to a folder on your PC, then run it.
I must be missing a step. I’ve done all that (ignoring Windows Security warnings), selected a period (This month) and ended up with an apparently empty DB file (84kB) in ProgramData:
*edited by mod*
What am I doing wrong?
I have just published my application which fetches your data and stores it in a local SQLite database on your PC.
That’s great, thanks very much
… download the zip file, extract it to a folder on your PC, then run it.
I must be missing a step. I’ve done all that (ignoring Windows Security warnings), selected a period (This month) and ended up with an apparently empty DB file (84kB) in ProgramData:
What am I doing wrong?
Possibly a silly question, but did you click on the “Read” button after logging on?
For a first time run it is recomended to select “All Time”, then click on “Read”
/Mike Williams
I have just published my application which fetches your data and stores it in a local SQLite database on your PC.
That’s great, thanks very much
… download the zip file, extract it to a folder on your PC, then run it.
I must be missing a step. I’ve done all that (ignoring Windows Security warnings), selected a period (This month) and ended up with an apparently empty DB file (84kB) in ProgramData:
What am I doing wrong?
Possibly a silly question, but did you click on the “Read” button after logging on?
For a first time run it is recomended to select “All Time”, then click on “Read”
/Mike Williams
The highlighted part of the screen shows what data has been read.
… did you click on the “Read” button after logging on?
Yes!
For a first time run it is recomended to select “All Time”, then click on “Read”
Done that, but the DB is still empty. Could there be a Windows problem with storing data from an unsigned application to ProgramData? Perhaps change that to LocalAppData? I do have full control of ProgramData as an administrator, and I own the OvoData folder, but still ...
The highlighted part of the screen shows what data has been read.
>The image went away, presumably to be edited by a mod to obfuscate the username. It’s back now ]
When I click read, there’s a brief delay with a status message Checking 2024, then the dialogue disappears (and the app closes, apparently). I’ve not seen anything in the box you highlighted.
There’s plenty of data available to download: I can see my own half-hourly data back to March 2017.
Would you prefer to continue this troubleshooting backstage? You could PM me.
With the aid of @Firedog I have managed to work out why the program kept crashing.
I will be deploying a new version to GitHub later, watch this space.
I have managed to work out why the program kept crashing.
Mea culpa: it looks as if the app was choking when it found no gas data for me. Mike was quick to spot the hurdle and remove it, so now I’ve run out of ways to break it.
I can really recommend Mike’s solution to anyone happy to work from an SQLite database.
Reply
Need advice from other members?
Ask your question to our members - they have the experience you're looking for: