Skip to main content
SianiAnni
Rank 4
Rank 4
February 10, 2021
Solved

Ovo integration for Home Assistant - Unofficial API

  • February 10, 2021
  • 27 replies
  • 3255 views

I’ve recently started using Home Assistant to monitor my home. I’ve got 5 Aqara temperature and humidity sensors feeding in data via a ConBee II usb device, I’ve got a Hive integration, and I’ve got an Ovo integration. But I don’t understand what the Ovo integration is showing me. The documentation says

Sensors

This integration provides a few sensors for OVO Energy:

  • Last Electricity Reading - Last meter reading consumption in kWh.
  • Last Gas Reading - Last meter reading consumption in kWh.
  • Last Electricity Cost - Last meter reading electricity cost.
  • Last Gas Cost - Last meter reading gas cost.

But it doesn’t explain whether these are half hourly readings, or daily or something else. I’m also very suspicious of an electricity reading that’s decreased over the last 48 hours.

Has anyone on here used this Home Assistant integration, and if so what do they make of it?     

Best answer by Blastoise186

Updated on 02/04/24 by Tim_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.

 

Unfortunately @SianiAnni , that integration looks like it’s a community contribution, for which the source code and GitHub Repository can be found at https://github.com/timmo001/ovoenergy .

It doesn’t look like it’s anything OVO’s done in an official capacity either. If you need help with that integration specifically, it might be worth creating an Issue on that repository.

I’m not really a coding expert or a developer myself, but I’ll try to read the code overnight and see if I can figure it out. It’s only Python, so it’s not too hard for me to read it!

27 replies

Blastoise186
Super User
Super User
February 10, 2021

Updated on 02/04/24 by Tim_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.

 

Unfortunately @SianiAnni , that integration looks like it’s a community contribution, for which the source code and GitHub Repository can be found at https://github.com/timmo001/ovoenergy .

It doesn’t look like it’s anything OVO’s done in an official capacity either. If you need help with that integration specifically, it might be worth creating an Issue on that repository.

I’m not really a coding expert or a developer myself, but I’ll try to read the code overnight and see if I can figure it out. It’s only Python, so it’s not too hard for me to read it!

Securing energy by zapping security bugs... For that is The Blastoise Way! Remember, I'm just like you - AI Powered Evil Geniuses aren't Staff!
SianiAnni
Rank 4
SianiAnniAuthor
Rank 4
February 11, 2021

Thanks for pointing me in the right direction @Blastoise186!  I can see that there was a minor change to the code just 10 days ago, although I haven’t figured out whether it’s relevant, and there is no indication in Home Assistant that there’s an update available, so will raise a query via the Home Assistant forum. They’re a helpful bunch, much like the people on here:)

SianiAnni
Newcomer
February 13, 2021

I have home assistant and the OVO integration. In my case it shows yesterdays gas and electricity consumption in kWh and £. If you want more data I’d have a look at Hildebrand for their glow stick https://shop.glowmarkt.com/products/glow-stick which you can integrate with Home Assistant.

If things don't change, they stay the same!
Blastoise186
Super User
Super User
February 13, 2021

Ok, I’ve spent some time reviewing the code behind the integration, both on the Home Assistant repository itself on GitHub and the upstream repository for which it gets most of the functionality from.

Please don’t forget that I’m no coding expert however and I can’t provide any kind of support for something like this. Fortunately, it’s only Python so it’s not exactly impossible to figure out what it does.

By the looks of things, the integration appears to basically be pulling data straight from the same OVO API that MyOVO uses to show you all the data in your online account. The only significant differences are that it strips out the UI and pulls raw data directly.

On the plus side, at least it’s not technically scraping the website itself, which would be pretty load generating and fairly wasteful. The downside however, is that the way the integration works means that it does technically have full access to your online account in MyOVO. Make sure to be cautious and don’t use the integration if you’re not fully confident that you can trust the code and the developers behind it.

That’s probably about as much as I can contribute though I’m afraid. But I hope it helps either way

Securing energy by zapping security bugs... For that is The Blastoise Way! Remember, I'm just like you - AI Powered Evil Geniuses aren't Staff!
SianiAnni
Rank 4
SianiAnniAuthor
Rank 4
February 13, 2021

Ok, I’ve spent some time reviewing the code behind the integration, both on the Home Assistant repository itself on GitHub and the upstream repository for which it gets most of the functionality from.

Please don’t forget that I’m no coding expert however and I can’t provide any kind of support for something like this. Fortunately, it’s only Python so it’s not exactly impossible to figure out what it does.

By the looks of things, the integration appears to basically be pulling data straight from the same OVO API that MyOVO uses to show you all the data in your online account. The only significant differences are that it strips out the UI and pulls raw data directly.

On the plus side, at least it’s not technically scraping the website itself, which would be pretty load generating and fairly wasteful. The downside however, is that the way the integration works means that it does technically have full access to your online account in MyOVO. Make sure to be cautious and don’t use the integration if you’re not fully confident that you can trust the code and the developers behind it.

That’s probably about as much as I can contribute though I’m afraid. But I hope it helps either way

 

Thanks for delving into the code:) No doubt the same API that many of us have been asking for for years!

 

Before seeing this  I had managed to confirm that some of the kWh values match those for the daily values as shown on MyOVO.

 

But I don’t understand what triggers the integration to poll MyOVO. There seem to be three data points for gas yesterday (12th), the first and second were the same gas usage for the 11th as shown on MyOVO, the third at 23:23  was a little higher, and the only one for today was just at 8:43 this morning and corresponding to the MyOVO value for 12th. The latest electricity value in both HA and MyOVO is for 11th - no data on either for yesterday, the 12th.  All seems a bit random...  But it will be useful to check gas usage against number of hours Hive switches boiler on. I’m not too interested in electricity usage at the moment. 

SianiAnni
Blastoise186
Super User
Super User
February 13, 2021

Digs through even more GitHub repos… :spy:

Well… Based on this file https://github.com/home-assistant/core/blob/dev/homeassistant/components/ovo_energy/sensor.py I found a clue or two. Line 14 in particular seems to be relevant.

If I’m understanding it all correctly, it appears to trigger using a timer based schedule that fires up the polling roughly every five minutes. Personally, I’d say that’s a little bit too aggressive for my liking, especially if the data isn’t changing that often and polling the API 288 times a day per account is an awful lot of requests smashing the server to pieces! But it is what it is I guess...

If I had access to the server logs, I could probably look through those and identify activity from this stuff fairly easily which would make it a piece of cake to figure out the polling frequency. Alas, that’s also something I can’t do as a volunteer! :wink:

Securing energy by zapping security bugs... For that is The Blastoise Way! Remember, I'm just like you - AI Powered Evil Geniuses aren't Staff!
Blastoise186
Super User
Super User
February 14, 2021

Bit of bad news I’m afraid.

Thanks for delving into the code:) No doubt the same API that many of us have been asking for for years!

 

Unfortunately, I’m not sure that’s what this particular API is intended for and I get the feeling it’s intended for internal use only within MyOVO right now. If it was designed to be opened up, I would expect to see things like API Keys, permission scopes and possibly OAuth2 to ensure security while still allowing third-party apps to have access to just the stuff they need.

However, this doesn’t seem to be the case right now. The API just seems to be used for connecting the back end systems to MyOVO via a secure setup.

I actually happen to know of someone who could potentially stop by and leave his thoughts on this topic - who happens to be following me on the forums as well! Unfortunately however, he’s a bit shy and doesn’t like to reveal himself. You won’t be able to guess who he is however, my followers list is private and only myself and the Mods can see it. :wink:

Securing energy by zapping security bugs... For that is The Blastoise Way! Remember, I'm just like you - AI Powered Evil Geniuses aren't Staff!
SianiAnni
Rank 4
SianiAnniAuthor
Rank 4
February 14, 2021

I can’t see where the 5 minute constant is used. But I completely agree that for daily readings it doesn’t need to be that often. 

SianiAnni
Blastoise186
Super User
Super User
February 14, 2021

Hang on…

Of course… I was looking at the wrong file! This probably shows you why I’m not an expert here! Lines 70 to 77 in this other file are relevant: https://github.com/home-assistant/core/blob/dev/homeassistant/components/ovo_energy/__init__.py

But once again, seems to confirm a polling interval of every five minutes… It might as well be a WebSocket if it’s going to be that frequent! :wink:

The code for the integration itself does appear to be capable of doing half-hourly mode, but it appears to be disabled by default. I suspect this is intended to allow it to pull down the half-hourly readings data if such data exists in MyOVO.

The problem there however, is that even the Half-Hourly readings from a smart meter don’t get uploaded every 30 minutes! The meter(s) do of course capture readings every 30 minutes on that setting, but it’s still only submitted on a daily basis, shortly after midnight. So in effect, polling the API every five minutes is only either going to do one of the following:

  • Get new data, but only if it’s the first poll after MyOVO has been refreshed with the latest meter data
  • Get the same data that’s already been polled for 50+ times that day
  • Return a server error of some kind, such as HTTP 404 Not Found or HTTP 500 Internal Server Error because you crashed it…
  • Crash something and completely break
  • Get itself rate-limited and keep slamming into HTTP 429 Too Many Requests
  • Potentially get your online account in MyOVO flagged by any anti-abuse mechanisms, which might result in you getting locked out

It’s a pretty interesting concept they’ve got there, but I definitely think it would be a lot more appropriate - and a lot more respectful to OVO - if that integration were to perhaps slow down a bit? I can’t speak officially on behalf of anyone, but I’d say reducing the polling interval to  maybe once per hour or perhaps even once every 6 or 12 hours would be worth considering. Possibly also with some other protective measures in there too, in order to help prevent all these bots from smashing up the API all at the same time?

Securing energy by zapping security bugs... For that is The Blastoise Way! Remember, I'm just like you - AI Powered Evil Geniuses aren't Staff!
Newcomer
February 14, 2021

I did have a look at expanding on this integration but gave up because of the limitations and reliability. I switched to Hildebrand and using their MQTT stream because it allowed so much data and manipulation of that data to create Home Assistant sensors and meters. I get ½ hour gas readings and near real time electric readings. The only thing it doesn’t support natively (but there is an easy work around) is export readings from the smart meter.

If things don't change, they stay the same!