Skip to main content

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.

For those interested in something like this being easily accessible I’ve made a terrible walkthrough of how to do so. hope you don’t mind me posting this Tim.

https://github.com/ThePaulAdams/OvOEnergy

https://www.thepauladams.com/blog/2020/02/24/ovo-energy-integration-to-smart-home-dashboard/


@TerryE I tried to run your script but it’s erroring for me - something is wrong with the authentication.   Does the password field need to be in a certain format?   I left all of the quotes in place.

 

pi@raspberrypi:~/Documents $ python2 energy.py 
Date,00:00,00:30,01:00,01:30,02:00,02:30,03:00,03:30,04:00,04:30,05:00,05:30,06:00,06:30,07:00,07:30,08:00,08:30,09:00,09:30,10:00,10:30,11:00,11:30,12:00,12:30,13:00,13:30,14:00,14:30,15:00,15:30,16:00,16:30,17:00,17:30,18:00,18:30,19:00,19:30,20:00,20:30,21:00,21:30,22:00,22:30,23:00,23:30
{"message":"No refresh token cookie or authorization header sent","redirect":"https://my.ovoenergy.com"}
Traceback (most recent call last):
File "energy.py", line 86, in <module>
main()
File "energy.py", line 78, in main
ovo = OVOreadings(USERNAME, PASSWORD)
File "energy.py", line 50, in __init__
self.account = json.loads(resp.content)n'accountIds']t0]
KeyError: 'accountIds'
pi@raspberrypi:~/Documents $

 


Can I point out that the “new” Billing Software, which is the connection point to our Smart Meters, is still undergoing development and bug-eradication. Any script which tries to lift data from the online Usage pages will need to be continually updated to match the current Billing Software version.

To make it even more tricky, it’s becoming apparent that not all customers are running the same software version. See this discussion about the Zero-in option.

My current Online Usage interface has changed further since that discussion. Not only do I not have a Zero-in Option, but there is no longer the ability to choose Yearly or Monthly from the Usage entry on the let menu.

 

I’m afraid we’re chasing a moving target.


… Any script which tries to lift data from the online Usage pages will need to be continually updated to match the current Billing Software version.

To make it even more tricky, it’s becoming apparent that not all customers are running the same software version. See this discussion about the Zero-in option.

 

Yes any script will need to be updated as the online interface changes, but I have only updated mine once in the last 3 years., and this latest one still works for me.  I don’t know about zero-in and am not interested as I have a near zero-energy new build and track all of my energy use through my own home automation system.

As to @uvarvu ‘s Q I use a password keeper / generator for my online passwords which generates strong passwords and these will often need quoting using the r’’’password’’’ syntax as below:

 PASSWORD = r'''D#adR'xGFj{Ks";=$'''

Also note that I have an electricity-only supply and the script may need tweaking for multiple supplies.


If anyone else is still looking for this, Home Assistant just added support for OVO in the latest release (0.114). Details on the integration can be found here: https://www.home-assistant.io/integrations/ovo_energy/

This uses the “ovoenergy” library which can be found here: https://pypi.org/project/ovoenergy/

The only problem is data is only available from OVO up to the previous day. I suspect there is some overnight batch process to format the data for the frontend.

Edit: Actually it seems OVO turned off real-time data years ago as it was “unreliable”:

 


Brilliant post here, @g-de - can you help me understand if the links above allow users to access raw data as if from an API?

 

As you can probably tell, I am not very computer literate. I am however decent at communities, so this has sparked my interest in that I feel it might help potentially everyone who has commented on this topic. Give us some more info, and I might need to re-assign the ‘best answer’ to your topic.  :) 


Well we could ask @Jequinlan to interpret for you @Tim_OVO :wink:


 

Updated on 19/11/24 by Emmanuelle_OVO: 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.

 

can you help me understand if the links above allow users to access raw data as if from an API?

I can certainly give it a go.

 

Firstly, big thanks to Timmo and other contributors for developing the library. All thanks go to them and links to buy them a coffee for their effort can be found on PyPi or GitHub:

https://pypi.org/project/ovoenergy/
https://github.com/timmo001/ovoenergy

 

I assume the way the library was developed this was to reverse engineer the My OVO website. That is, browse the website as normal and and monitor the traffic to see what OVO URLs and APIs it uses. Assuming this is the case, one of these URLs (get account IDs) already seems to be different but the library is still working for the moment. The APIs being used are not officially supported outside of the website, so first, a warning that any changes to the My OVO website may break the library.

 

For anyone using Python, you should be able to include the ovoenergy library and look at https://github.com/timmo001/ovoenergy/blob/master/ovoenergy/cli.py for how to use it.

 

For replicating this in other languages, the process seems to be as follows:

  1. Login by sending a POST request to https://my.ovoenergy.com/api/v2/auth/login with the following JSON in the body:
    {
    "username": "...",
    "password": "...",
    "rememberMe": true
    }

    From the response, save the cookies to use in all future requests.

  2. Next, send a GET request to https://smartpaym.ovoenergy.com/api/customer-and-account-ids . Be sure to save the items in the “accountIds” property (usually only one item).
  3. Finally, make a GET request to https://smartpaym.ovoenergy.com/api/energy-usage/daily/{accountId}?date={yyyy-MM} where {accountId} is the value from the previous request and {yyyy-MM} is the month in the format 2020-08.

You can also get monthly or half-hourly usage using the following URLs similar to step 3:

As mentioned above, if this is wanted for Home Assistant, the integration was added in version 0.114 (https://www.home-assistant.io/integrations/ovo_energy/).


Unfortunately the data only goes up to the end of the previous day as OVO no longer provide real-time data:

 


The whole issue goes away once OVO release IHDs with CAD via WiFi. So I can’t see anyone committing programmer time to it.


I Whatsapped my friend, a programmer, who likes little challenges, he is just getting back from holiday but read this post and reckons its under an hours work so it taking it on for me as a customisable and sharable dev! Fingers xed we will all ve able to download and analyse the info in detail!


What about his pay?  :beer:  :wink:


@Transparent we work on helping each other ;)


Well in that case it’s :beers:  :tropical_drink:   :wine_glass:  :champagne:  :champagne_glass:  


For replicating this in other languages, the process seems to be as follows:

  1. Login by sending a POST request to https://my.ovoenergy.com/api/v2/auth/login with the following JSON in the body:
    {
    "username": "...",
    "password": "...",
    "rememberMe": true
    }

    From the response, save the cookies to use in all future requests.

  2. Next, send a GET request to https://smartpaym.ovoenergy.com/api/customer-and-account-ids . Be sure to save the items in the “accountIds” property (usually only one item).

 

 

The issue with caching the cookies is that authorisation cookies have a lifetime.  IIRC, it’s 31 days, so your code still needs to handle cookie expiry and do reauthentication.  You might find it simpler just to do the authentication every time or to have a separate (say weekly) process to refresh the authentication cookie.


We are getting there! 

May be a bit longer but getting there with a reusable easy download:

 


And whilst we’re at it, let’s tag @NinjaGeek too. He might want to playing with this as well.

 

Just in case you missed this, @NinjaGeek - check out the latest in this thread and the work done by @g-de@Jequinlan, Timmo and other contributors


As a small update, A rival who offers TOU have published a download file for rates, so I can start the work on the comparison model!


Hey coders,

 

We might have an update on this in the not too distant future, I can’t share any more just yet, but it’s being looked into.

 

More to come on this in 2020….


@Tim_OVO @Transparent @TerryE @andsee @SianiAnni 

 

Here is it: The API exe I promised that takes all that HH data and nicely formats it into a consumable Sheet

 

https://drive.google.com/drive/folders/1A7XRov0579O53T8OsIGe3wXCk09jul0F?usp=sharing

 

Download all the files, and read the Readme! (oh, and Enjoy) - now I can start work on ther TOU comparison tool!! 

 

If anyone is willing to send me their export please do!  - It will help me build the tooling.

John (at) QuinlanServices (dot) Com 


Thanks @Jequinlan Have got it working, and it confirms last HH gas data was logged on 19 August 23:30!

What’s the TOU comparison tool you’re working on next?


@Jequinlan I will have a read of this, but without an OVO account I won’t be able to test :pensive: Sounds like amazing customer-led action though!

 

Please be advised that from OVO’s point of view, I neither condone or condemn this workaround. It’s untested and possibly insecure, either way it’s not made alongside OVO. However I know there's been lots of interest, and (whilst OVO/Kaluza developers are tabling an idea that will be of interest to everyone here in November) so far we haven't been able to deliver anything in house. 

 

So I’m tagging everyone that's commented here to make sure you're aware of this work from @Jequinlan 

 

Let us know how it goes please! 

 

@Gary @GarethMarlow @rgphilpott @atilagiant @Deanohol @Peter_Mat @didge05 @sam_cat @jmontalvo @adec @Pramsbottom @ryck @CeeJayCee @alexbaulch @Random @maccordingley @sfgreenwood @johnk @jadam @Fordy @Steveo67 @Siggy0 @CerebralDigits @deanjames @ChrisB @jadam @DaveJenYearsley @ErTnEc @Marshcroft @jordanharper @Simonfea @obiwanzamora @AdamJ @dorinho @Ross2411 @Chrherms @MikeWilliams @blakedrayson @TerryE @VibroAxe @jdenver @maurorappa @adec @100903609 @Riscy @r3m0dul8 @MyZoe.Uk @Ajk @AlanN51 @CloudCircus @r3m0dul8 @technogeoff @resoai @Fuzzysteve @mattc @andsee @uvarvu @Transparent @g-de 


Thanks @Jequinlan Have got it working, and it confirms last HH gas data was logged on 19 August 23:30!

What’s the TOU comparison tool you’re working on next?

I am working on creating a "price comparison tool" for taking your actuals and comparing to tarrifs from suppliers where rates may change on up to a half hourly basis. Allowing a true "annual cost projection"


Btw, I can confirm there is no risk of insecure as you will see from the command line the details are on your machine and provided to directly access ovo, the exe has been made by best practice .net core code and is a standalone on pc only exe.


Thanks this is great.

What’s the purpose of the fields Login, Password and File in the appsettings.json

The command line in the readme seems to negate their existence in the settings file!

{

  "OvoUrls": {

    "Login": "https://my.ovoenergy.com/api/v2/auth/login",

    "Accounts": "https://smartpaym.ovoenergy.com/api/customer-and-account-ids",

    "Usage": "https://smartpaym.ovoenergy.com/api/energy-usage/"

  },

  "OvoAccount": {

    "Login": "x",

    "Password": "x"

  },

  "Output": {

    "File": "s:\\MyFile.csv"

  }

}

 


You can put them in there to save typing them all the time! Thats all. Then you can omit those params from command line.


Reply