Accumulate daily energy costs? (From Octopus API)

Hello chaps!

As per the title I’m trying to get a daily cost of electricity I’ve used into EmonCMS.
Using some Python I’ve written (yes, I need to put it up on Github ASAP), I have a input of kWh’s, unit price & cost of half hour, coming in from the Octopus API.
What I can’t work out is how to add those HH prices into a daily total. Any ideas?

Hello @Vster if your posting the half hourly values to emoncms inputs you could try using the accumulator input process - this will create an cumulative total.

Then you can use the approach described here to show daily totals in a graph Calculating Daily kWh - Guide | OpenEnergyMonitor

Hello again,
@TrystanLea was correct (ovbiously!) about using the Accumulator process to create a cumulative total of all the Agile Half Hour costs from the Octopus API.
However, after discovering a slight glitch in my maths, I’ve rerun the Python program (though a huge bash harness) to download all the data from Octopus again and rewrite the feed. In doing this I’m getting a glitch in the data, primarily whenever the data input is started again the Accumulator processes running total jumps to a much higher value for a while before dropping back to where it should be. The “data curve” at the top of glitch is correct, the data being feed is the same, it seems to be the act of resubmitting it is upsetting something in the accumulation?

Any ideas?

Hello @Vster i think this might be resulting from some kind of timing issue with difference between redis cache and actual data in the feed data file.

Are you reposting the data via the input api?

can you post in the source feed pre accumulation and then use the post processor to recompile the accumulated running total?

Hi

I would be interested in your code when you get it running.

Regards

Ian

No problem, it seems to have been running fine for months, it’s the processing in the EmonCMS input I messed up, so I thought I’d reload the all the data, and then this happens. Typical!

@TrystanLea I’m posting the data to the Pi with a HTTP call, like this -

http://10.0.0.44/emoncms/input/bulk.json?apikey=XXXXXX&data=[[1572534000,3,0.014,7.14,0.099,0.21]]&time=0 2019-10-31T15:00:00 200

The 1572534000 is the time, the 3 is node, the 0.014 is the kW used in the HH, 7.14 is the Agile unit price, the 0.099 is the Agile cost for that HH and the 0.21 is the ‘Normal’ price for that HH.

The processing is simply -

There is a one second delay in the code between HTTP calls.

So, the prices that go into the accumulation are there in the feeds, so I’ll give the Post Processor a go tonight! Thanks.

1 Like

Duh! It’s going to one of those days.
So, running the background process “postprocess_run.php” results in this…

PHP Notice:  Undefined variable: settings in /home/pi/postprocess/postprocess_run.php on line 9
PHP Notice:  Undefined variable: settings in /home/pi/postprocess/postprocess_run.php on line 37
ERROR: Redis is not enabled

Looking the php it seem “settings” is not defined and REDIS is not enabled. However, the process_settings.php is there in /var/www/emoncms and so is the settings.php which has all the secuirty info in it. Also, Redis is there and running!?

The only thing I can think is that I’m still running the previous version of EmonCMS, and the PostProcessing module is too new maybe? Or have I goofed elsewhere? Any ideas?

That looks like your using the latest version of the post process module but an older emoncms core? Are you able to do a full system update?