Skip to content

Instantly share code, notes, and snippets.

@jpwsutton

jpwsutton/README.md Secret

Created May 15, 2016
Embed
What would you like to do?
Getting Energy Readings from a CurrentCost EnviR Home Energy Monitor

This flow listens to a CurrentCost EnviR that is connected via the USB Serial cable included with the base station. Parses the incoming XML feed and outputs the live energy usage readings from all sensors as they are received by the base station.

[{"id":"5dd2be7.fa22d4","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"57600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"5d9f1647.8da548","type":"serial in","z":"d1767f1.cc1968","name":"CurrentCost Envir","serial":"5dd2be7.fa22d4","x":298,"y":161,"wires":[["2e38cccb.02c6b4"]]},{"id":"1656c54c.43f1eb","type":"function","z":"d1767f1.cc1968","name":"extract watts","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;\n\nreturn msg; ","outputs":1,"noerr":0,"x":625,"y":161,"wires":[["d8e625b9.46a778"]]},{"id":"d8e625b9.46a778","type":"debug","z":"d1767f1.cc1968","name":"","active":false,"complete":false,"x":805.5,"y":161,"wires":[]},{"id":"2e38cccb.02c6b4","type":"xml","z":"d1767f1.cc1968","name":"","x":466.5,"y":161,"wires":[["1656c54c.43f1eb"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment