Monitoring House Energy Consumption With An Energy Meter And Node-Red

I have been wanting to monitor my energy consumption for a long time but never seemed to gain the enthusiasm to “wire” all the bits together such as getting the values. sending them to a web page etc.

Well Hello Node-Red 🙂

and a big thank you to Marc for reminding me how exciting this is.

Now I will use a currentcost energy meter, send the output to node-red and let it do 95% of the work.

First things first, grab a current cost energy meter of ebay (too expensive on Amazon), make sure you get one that includes the USB cable and that will connect to the raspberry PI.

I see them as low as £16 on ebay.

currentcost

Next install node-red on a raspberry pi (and here is a great blog on how to do it) 🙂

https://wherethingsareborn.wordpress.com/2016/07/16/how-to-install-node-red-on-a-raspberry-pi/

Now setup your currentcost meter and when its displaying the energy consumption on the currentcost meter screen, plug in the usb cable to the raspberry pi

Now,select the following flow in your clipboard and then in in Node-Red go the menu at the top right and select import / clipboard and import

[{“id”:”cfde4374.1259″,”type”:”ui_tab”,”z”:”c4eda00b.869a6″,”name”:”CurrentCost Energy Meter”,”icon”:”dashboard”,”order”:”1″},{“id”:”e7ec08ba.f18798″,”type”:”serial-port”,”z”:””,”serialport”:”/dev/ttyUSB0″,”serialbaud”:”57600″,”databits”:”8″,”parity”:”none”,”stopbits”:”1″,”newline”:”\\n”,”bin”:”false”,”out”:”char”,”addchar”:false},{“id”:”f96bcc62.f4584″,”type”:”serial in”,”z”:”c4eda00b.869a6″,”name”:”CurrentCost Envir”,”serial”:”e7ec08ba.f18798″,”x”:145,”y”:249,”wires”:[[“7854b269.22549c”]]},{“id”:”ba6fd84a.c804b8″,”type”:”function”,”z”:”c4eda00b.869a6″,”name”:”extract Values”,”func”:”/* sample message\n(Object) {\n \”msg\”: {\n  \”src\”: [\”CC128-v0.11\”],\n  \”dsb\”: [\”00600\”],\n  \”time\”: [\”19:04:49\”],\n  \”tmpr\”: [\”18.3\”],\n  \”sensor\”: [\”0\”],\n  \”id\”: [\”02902\”],\n  \”type\”: [\”1\”],\n  \”ch1\”: [{\”watts\”: [\”00023\”]}]\n }\n}\n*/\n\nvar reading = msg.payload;\n\n//ignore if history packet\nif(reading.msg.hist){return null;}\n\nmsg.payload = {};  \nmsg.payload.sensor = reading.msg.sensor[0]*1;  \n// This is the temperature of the EnviR base station, not the sensor.\nmsg.payload.temperature = reading.msg.tmpr[0]*1;  \nmsg.payload.watts = reading.msg.ch1[0].watts[0]*1;\nvar cost=(msg.payload.watts/1000)*17.9*1/100;\nmsg.payload.cost = cost.toFixed(2);\nreturn msg;  “,”outputs”:”1″,”noerr”:0,”x”:482,”y”:249,”wires”:[[“2524e034.1a483″,”fd61a125.4fa91″,”2bcb7ae.b3f7c86”]]},{“id”:”7854b269.22549c”,”type”:”xml”,”z”:”c4eda00b.869a6″,”name”:””,”x”:313.5,”y”:249,”wires”:[[“ba6fd84a.c804b8”]]},{“id”:”92fdefe4.dd3a3″,”type”:”ui_gauge”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Temperature Gauge”,”group”:”Temp”,”order”:”1″,”format”:”{{value}} °C”,”min”:0,”max”:”30″,”x”:944,”y”:108,”wires”:[]},{“id”:”c524c68f.d4f2e8″,”type”:”ui_gauge”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Watts Gauge”,”group”:”Watts”,”order”:”1″,”format”:”{{value}} “,”min”:0,”max”:”5000″,”x”:908,”y”:251,”wires”:[]},{“id”:”92cc0c56.519e7″,”type”:”debug”,”z”:”c4eda00b.869a6″,”name”:””,”active”:false,”console”:”true”,”complete”:”payload”,”x”:907,”y”:41,”wires”:[]},{“id”:”b94403a4.8aa12″,”type”:”ui_gauge”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Hourly Cost Gauge £”,”group”:”Hourly Cost”,”order”:”1″,”format”:”{{value}}”,”min”:0,”max”:”1″,”x”:923,”y”:416,”wires”:[]},{“id”:”24b6d7fd.5abb38″,”type”:”ui_chart”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Watts Chart”,”group”:”Watts”,”order”:”2″,”interpolate”:”linear”,”nodata”:”No Data”,”removeOlder”:1,”removeOlderUnit”:”86400″,”x”:913,”y”:295,”wires”:[[],[]]},{“id”:”2524e034.1a483″,”type”:”function”,”z”:”c4eda00b.869a6″,”name”:”Get Temp”,”func”:”var newMsg = { payload: msg.payload.length };\nnewMsg.payload=msg.payload.temperature;\nreturn newMsg;”,”outputs”:1,”noerr”:0,”x”:681,”y”:205,”wires”:[[“92fdefe4.dd3a3″,”37d42f89.b9eda”]]},{“id”:”fd61a125.4fa91″,”type”:”function”,”z”:”c4eda00b.869a6″,”name”:”Get Watts”,”func”:”var wMsg = { payload: msg.payload.length };\nwMsg.payload=msg.payload.watts;\nreturn wMsg;”,”outputs”:”1″,”noerr”:0,”x”:680,”y”:250,”wires”:[[“c524c68f.d4f2e8″,”24b6d7fd.5abb38”]]},{“id”:”2bcb7ae.b3f7c86″,”type”:”function”,”z”:”c4eda00b.869a6″,”name”:”Get Cost”,”func”:”var cMsg = { payload: msg.payload.length };\ncMsg.payload=msg.payload.cost;\nreturn cMsg;”,”outputs”:1,”noerr”:0,”x”:678,”y”:296,”wires”:[[“92cc0c56.519e7″,”b94403a4.8aa12″,”340c37fe.5140a8”]]},{“id”:”37d42f89.b9eda”,”type”:”ui_chart”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Temperature Chart”,”group”:”Temp”,”order”:”2″,”interpolate”:”linear”,”nodata”:”No Data”,”removeOlder”:1,”removeOlderUnit”:”86400″,”x”:934,”y”:159,”wires”:[[],[]]},{“id”:”340c37fe.5140a8″,”type”:”ui_chart”,”z”:”c4eda00b.869a6″,”tab”:”cfde4374.1259″,”name”:”Hourly Cost Chart”,”group”:”Hourly Cost”,”order”:”2″,”interpolate”:”linear”,”nodata”:”No Data”,”removeOlder”:1,”removeOlderUnit”:”86400″,”x”:921,”y”:473,”wires”:[[],[]]},{“id”:”a6517c63.1a531″,”type”:”comment”,”z”:”c4eda00b.869a6″,”name”:”Comment”,”info”:”This node is the serial node that takes input from the currentcost meter”,”x”:114,”y”:198,”wires”:[]},{“id”:”e3bc8e26.57d42″,”type”:”comment”,”z”:”c4eda00b.869a6″,”name”:”Comment”,”info”:”The XML node converts the output to xml format”,”x”:314,”y”:201,”wires”:[]},{“id”:”24f78db0.2198e2″,”type”:”comment”,”z”:”c4eda00b.869a6″,”name”:”Comment”,”info”:”The xtract values function create the msg format and inserts  \nworks out the hourly cost \n(I used 17,9p per KWH for mine)”,”x”:460,”y”:197,”wires”:[]},{“id”:”2c40f9da.bb3e16″,”type”:”comment”,”z”:”c4eda00b.869a6″,”name”:”Comment”,”info”:”Here I break the output into seperate numbers \n(as gauges seem to take a number rather than the\nfull message)”,”x”:674,”y”:160,”wires”:[]},{“id”:”719b3ef8.82e07″,”type”:”comment”,”z”:”c4eda00b.869a6″,”name”:”Comment”,”info”:”I create a gaugue and a chart for each value”,”x”:1173,”y”:254,”wires”:[]}]

If you have done this you should see the following:

nodered3

Now switch to the UI page (which is the same page as the node red URL but ends in /UI)

and you will see this

currentcostUI

Yes that’s tight, it shows gauges and charts for the hourly cost.

but I know you are a sceptical bunch so as usual here is a small video

 

WhereThingsAreBorn 🙂

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s