Time of Use Electricity Supply - Octopus Energies

Hi all,

would anyone have any apps created which would be able to access Octopus’s api and bring back the current unit price for electricity? Octopus have several smart tariffs which change every half hour, in line with the actual unit cost of electricity. At certain points in the day, apparently, they also pay you to use electricity, so I’m currently looking to see if I can get this integrated into VeraPlus, so we can charge items around the house, run our air source heating, etc, and when the missus gets her electric car (which she’s started thinking about) charging that too.

The missing part of this, is the integration into Vera.


How does that work.

I’ve thought about Octopus Energy a little bit knowing they have an API. Not currently with them however.

Api details.

Maybe a plugin like Site Sensor can be used to pull values in to Vera? Never used that plugin myself.

Or maybe there is some LUA code samples on the forum for this type of thing.

1 Like

Hi Stu,

hope you and the family are keeping well.

Octopus rely on customers having a working smart meter, and feeding back their usage every 30 mins. This is the flaw in our current house, Bulb installed a SMETS2 smart meter, but it has never worked in the 18 months since it was installed, but Octopus have agreed to come and install a new meter (or see if they can get the current one working) so we can then move onto one of their smarter tariffs.

So basically, when peak demand is high, between 4-7pm, prices rocket, but during the evening and overnight, the prices drop really low, and apparently for an hour a night (or it used to be), they actually pay customers to use the surplus electricity, which is generated and would be lost. So having a number of items in our house, run smartly, I plan to make the most of those cheaper hours and shift our usage accordingly.

If you’re interested, I have a reference code, which gives new customers £50 credit, and I get the same…

I’ll check out site sensor, see if I can access their api and pull in the data - that would be great, otherwise it may be a case of trying to write one… something I’ve not done on Vera, but would be up for the challenge!


1 Like

FYI, I have a virtual meter, pulling some data from other sources, and it’s pretty easy to do. Just do an HTTP call to your endpoint and update urn:micasaverde-com:serviceId:EnergyMetering1 / KWH variable.

If you create a device from Apps, Develop Apps, Create device with:

  • D_PowerMeter1.xml as device filename
    you’re good to go, and you just need to update the variable (ie: via Reactor/Pleg/code/whatever).
1 Like

I am using Octopus Agile, and have created some simple LUA code to grab and process the daily prices.
This can be used with Scenes to turn devices on or off, and to sent alerts about prices, eg if the wholesale prices go very low, or even negative, then heating and charging can be turned on. Hue lights could be changed to indicate the current price.

At present, I increase room temps for my Air Source Heat Pump before peak time, then reduce it during peak. I disable my car from charging from the mains, and turn off a couple of my other devices. I have not seen any negative prices yet, but should get an email from Vera if prices plunge. I also check that my house battery charge is timed during the cheapest price period (and use the battery during the peak time).

The code and some instructions are on github at https://github.com/octoplayer2/Vera-OctopusAgile.
Ideally this should be wrapped up as a Virtual Device, but at present I have concentrated on making it do what I need. I hope it may also be useful for others, so any comments, suggestions or bug fixes welcome.
Also if you decide to switch to octopus energy, feel free to use my Introduction code to get us both £50. share.octopus.energy/denim-koala-967



Hi Octoplayer,

thanks - I’ve tried setting this up on my veraplus - for some reason the rate variables are not being changed, when we hit the specific times (for example the 4 hours of cheapest electricity).

Would it be possible, for you to add a couple of extra variables (I’ve tried but my knowledge is limited) - current price and next price ?


Hi Tony,
Yep, I only update the rates once a day around 7pm, but should be able to add Current Price and NextPrice fairly quickly, they would be updated every 30 min.
Good idea, thanks

Feel free to take a look at my own Virtual HTTP Devices for inspiration on how to do a virtual device :wink:
GitHub - dbochicchio/vera-VirtualDevices: Virtual HTTP Devices plug-in for Vera and openLuup

VirtualAlarmPartition is the easiest, probably very similar to your use case.

1 Like

Thanks; I have modded the SolarMeter device, but that was too complex to act as basis for what should be a simple device. I’ll have a look at the Alarm Partition some time…

1 Like

I have updated the code in Github to include the Current and Next prices. Only briefly tested, but it seems to be working.
Just copy the code into the scene LUA and press Submit. The new variables should appear on the next half-hour, or edit the ValidTilEpoch entry to a small timestamp, eg 0, and run the scene to get the updated values.


Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules