Is this possible? Tracking cost of electricity that is charged on 1/2 hour variable tariff

Tags: #<Tag:0x00007f6e043e2140>


In addition to tracking electric consumption I also graph cost as this is more meaningful to the rest of the family. We are switching to Octopus where they have a variable tariff that is billed in 1/2 sessions all different. The billing rates are set the previous day some time after 16:00 UTC when the wholesale electricity generation auction has taken place. The rates are available for download and I have set up a node-red flow to get them as a json object.

Is it possible to combine this with the consumption as logged by emoncms to produce a daily cost?

If so any thought on the best/simplest way to achieve this?

I will continue to calculate the daily cost of the fixed tariff so we can see if the variable tariff does in fact save us money. We will do our best to make use of the lowest cost periods which will be predictable. I am already (with help from others) setting up a node red flow that will switch sonoff sockets and relays so we can run the dishwasher, washing machine and tumble dryer at least cost. We will also add in battery charging which will be added at some time as with solar charging and low tariff charging this becomes more attractive.

If any one else is thinking of switching to Octopus send me a PM and I can provide a link that gives £50 credit on sign up.

Hello @ian we are also interested in this here and while the current emoncms apps dont do this directly it is something we would like to improve support for. There is the time of use app that can explore the impact of variable price tariffs but it does not yet track the octopus api…

I’ve been developing an emoncms module for scheduling smartplugs, EV charging etc that has the option to use an agile octopus forecast, you can tell the module how long and by when you would like a schedule to run and it finds the best time. There’s more info here: Emoncms Demand Shaper module I need to update that thread with the latest developments.

Great, I will read through that. As luck would have it I am using the sonoff plugs and relays already. This may save me some work.

This link gives 404 error.


Thanks for spotting, I have updated it, its now on a different branch name:

Hi @TrystanLea

I am trying to install the demand shaper module but my attempt at cloning throws an error.

 git clone
Cloning into 'demandshaper'...
fatal: unable to access '': Could not resolve host:

Is this an incorrect link?
From installation instructions here:-

Hello Ian, sounds like your pi cant resolve the address, a DNS cache issue… Perhaps try rebooting the pi?

No luck with reboot.

This is a Pi with emonSD-30Oct18 image. I cloned to another Pi with no problem and then copied across.

14 posts were split to a new topic: emonESP sonoff

Not 100% relevant to today’s issue but over 20 years ago we used to do this with a UNIX MIPS Box for British Rail Intercity for the billing of power for the Overhead Line Electrification.

During some hours of the night we got paid to use energy but the bills still ran into the millions of pounds :frowning:


Hi @TrystanLea

I have just set up 2 smartplugs using wemos ESP’s as I cannot compile for the actual sonoff plugs at present.
I hard coded the port and node numbers.
The installation took a couple of minutes per plug (dummy plug) and they both came up as AP points instantly. I was able to setup MQTT and got an immediate connection.

I re installed demandshaper and everything went exactly as per instructions.
I set up my first schedules. This is going to do exactly what I require. In fact I will probably carry on using the wemos as all I need is a start output. I am building a couple of button pushers using servo’s to start the Dish Washer, Dryer & Washing Machine.

Excellent work, thank you.

The only enhancement I can think of is a way to have a virtual smartplug that in fact publishes an mqtt start and stop so demand shaper could easily be integrated into Node-Red which would allow complete flexibility.


Thanks @ian that’s great to hear, thank you for persisting!

That’s a nice idea to be able to create a virtual smartplug for integration with Node-Red, I will keep that in mind.

If you get a chance to document your button pushers for the appliances that would be really interesting.

Hey @ian did you ever manage to come up with a method for this? I’m just starting down the same path now. :smile:


Partially. I use mainly use demandshaper which gives prediction of lowest cost and switches sonoff plugs. The Octopus dashboard also shows prediction for the coming 2 days. The emoncms Agile app also works well to show historical Agile energy cost if you have emoncms monitoring.