Octopus Agile as a feed/input

I have a dashboard created to run on an old android mobile ( in the kitchen) as shown below:

It is an attempt to guide the household as to when to do things - washing machine/tumble dryer/ charge the car ( I have a BMW i3 REX). The star changes colour depending on the comparison between solar and import - giving a visual indication of when we can use electricity. Red we are importing, Amber - stick on one more machine , yellow we can charge the car etc. The graph below shows what we have used when and as it is winter solar is not making much of an impression. Although in this case it might have been better to charge the car over lunch.

I am using Agile from Octopus hence the charging of the car overnight during the winter. I should really go for a charger which allows me to charge when it is best for me - I need to save some money to purchase it. Currently we use a 13 amp charger and it works great for us. However it would be best if the decision to charge was automatic and we didn’t have to visit the car to change charging times. However I know the answer for this - just need the money to buy it.

I would like to take the Agile cost and lay it on top of the graph rather like the excellent Octopus App. Then we could make a conscious decision to use electricity in the high usage parts rather than remembering it is between 16:00 and 19:00.

So my question is:
Has anyone taken a feed from Octopus and created an input/feed in EmonCMS? I can see it is possible as the Octopus App does but wondered if anyone has guidance or instructions how to do it before I try and work it out. I was imagining copying the BMSi3 input code and changing it to point to Octopus but it seems more complicated from a timing point of view.

So any guidance/advice would be most welcome.

1 Like

Can i ask how you are getting the data from the BMW? are you using the inbuilt module?


Yes we are. We have no issues with it apart from every now and then it does not report. We then notice the BMW apps don’t either.

I’ve asked this in the Octopus Agile app thread, this data is currently not available to rest of emonCMS. :frowning:

I’ve gotten around it, but for you, it may be a very very long winded way:

  1. I’ve got Home Assistant for my home automation, this guide shows how to set up Agile pricing sensor
  2. Use emonCMS history integration to feed data into emonCMS as Input

After you’ve set up Home Assistant, you can easily set up a prettier dashboard :wink:

Hi there is a app in the emonpi that gives you the Tarif prediction and it showed your power use
Would this be a basis for what you want .
I am in the same boat looking at the demand shaper but at present does not give me the control I want though I believe it could be made too . Just I have so many other things I am programming have not had time to try and get to grips with this as yet

I will take a look thanks for the advice

Yes I know but it is an app. I only want the graph and also with the incoming tariff only. Not the outgoing tariff.

In Spain we have a similar tariff called PVPC that changes prices every hour. We can download them the day before around 21:00 from the electric regulator through an API call (provided you have your own token)

Guess Portugal has similar tariff system with 720 prices/month

I was also looking a way to feed emonCMS with those data as I already download them through a Script

I just use Home Assistant too… if the inbuilt HA Lovelace dashboards aren’t your thing you can always take a look at Appdaemon… bascially pulls your Home Assistant sensor data and displays it differently.

This is on a cheap Fire HD8.


Yes I’m using HADashboard as well (on a Lenovo Tab) but via an App called Fully Kiosk (I need to buy a license!) which switches off the screen, reacts to presence to come alive etc.

Same here… need to buy a license… but I can’t get Fully Kiosk to always stay asleep and stop the screen saver kicking in a couple of times a day… no bit deal, just a quick swipe up.

Will keep poking about.

If anyone has followed my various attempts to get this data reliably, I have created a Node-Red node that will pull the Agile pricing data in and give you various size minimum price blocks. Feed this into MQTT and EmonCMS will pick it up.

Very rough for now but works. Not exhaustively tested mind you…

Documentation is minimal right now :grinning:.

Install as any other node but use

npm install https://github.com/borpin/node-red-contrib-octopus.git

You might need to use --save.

I’m using NR within Home Assistant - it is just too easy not to - I can add this command within the config from HA.


Hi Brian,

I would like to give this a try, but in reponse to

npm install https://github.com/borpin/node-red-contrib-octopus.git

I get this error log, Sorry, do you know ehere i am going wrong?

Best Regards


0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'install',
1 verbose cli   'https://github.com/borpin/node-red-contrib-octopus.git'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose config Skipping project config: /home/pi/.npmrc. (matches userconfig)
5 verbose npm-session ad6d68bb836573a7
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 info lifecycle [email protected]~prepack: [email protected]
9 silly fetchPackageMetaData error for git+https://github.com/borpin/node-red-contrib-octopus.git premature close
10 timing stage:rollbackFailedOptional Completed in 2ms
11 timing stage:runTopLevelLifecycles Completed in 2486ms
12 verbose stack Error: premature close
12 verbose stack     at PassThrough.onclose (/usr/lib/node_modules/npm/node_modules/end-of-stream/index.js:47:67)
12 verbose stack     at PassThrough.emit (events.js:323:22)
12 verbose stack     at emitCloseNT (internal/streams/destroy.js:69:8)
12 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:83:21)
13 verbose cwd /home/pi
14 verbose Linux 4.19.75-v7l+
15 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "https://github.com/borpin/node-red-contrib-octopus.git"
16 verbose node v12.16.1
17 verbose npm  v6.13.4
18 error premature close
19 verbose exit [ 1, true ]

Short answer is no :slight_smile:. I have only tried to install it into a Node-Red inside Home Assistant. I presume this is outside that.

Did you try the --save?

You might be better asking on the Node-Red forum. If you @ me in I’ll see the question and if there is anything I need to do I can try and sort that out.

Hi Brian,

Thanks for the quick reply! I did try the --save, and also with sudo, which resulted in a permissions error oddly enough.

I have just installed node red on my emonpi so its a bare install, I think i will have quick go with HA if thats the known working route!

Kind Regards


If you have HA installed somewhere, then it is definitely the best route assuming you are either using HASSIO or the Supervised version. You can add NR in as an add-on as well as InfluxDB and Grafana. All this can then get automatically backed up.

I am becoming more and more impressed with HA as a full system - all the bits just seem to work seamlessly together.

Hi Brian,

I have HA and the node red add on installed and working. Next daft question?

There do i runn your install command from? If i run from a ssh shell i get

npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN saveError ENOENT: no such file or directory, open ‘/home/james/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/home/james/package.json’
npm WARN james No description
npm WARN james No repository field.
npm WARN james No README data
npm WARN james No license field.

So it evidently doesnt know where to put everything, and its not apearing as a node.

“I can add this command within the config from HA.” Sorry for being daft, I have no experience of HA or Node red, I can i run this from the GUI somewhere?

Best Regards



Found it :slight_smile:

Sorry for the daft question.

Best regards


I tell folk there is no such thing

I use as below


You can also load a specific branch


One issue I have found is that as I prevent the node running too often, this is a pain when testing! I need to add a specific inject message to force update :slight_smile:

1 Like

Good Morning Brian,

I have been playing with this sucessfully for a while, but yesterday its seems to have broken.

Node red doesnt seem to like you package anymore, did you change something? Is your build still ok?

[07:36:13] INFO: Starting installation of custom NPM/Node-RED packages…
npm ERR! Invalid tag name “:”: Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-17T06_36_15_858Z-debug.log
[07:36:15] FATAL: Failed to install a specified npm package

Best Regards