Takes serial input from a CurrentCost energy monitor, and based on a user-programmable threshold (in the switch node), turns a LEDborg (multi-colour LED display) green, amber or red. Works particularly well with a cut-out ping-pong ball over the LEDborg as a diffuser.
-
-
Save andysc/272c008524eb44a4cd78 to your computer and use it in GitHub Desktop.
CurrentCost to LEDborg energy monitor "orb"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"60ae8c7c.1ff6bc","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"57600","newline":"\\n","addchar":"false"},{"id":"c0bb7710.1646f","type":"serial in","name":"CurrentCost in","serial":"60ae8c7c.1ff6bc","x":92,"y":230,"z":"a7da7b08.56417","wires":[["a2b64899.b8b4b"]]},{"id":"a2b64899.b8b4b","type":"xml2js","useEyes":false,"name":"","x":156.99993896484375,"y":288.0001220703125,"z":"a7da7b08.56417","wires":[["3667a75.534f8d8"]]},{"id":"3667a75.534f8d8","type":"function","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 anything other than the main screen sensor (0)\nif (reading.msg.sensor[0] != \"0\") { return null; }\n\nmsg.payload = reading.msg.ch1[0].watts[0]*1;\n\nreturn msg;","outputs":1,"x":228.00003051757812,"y":343,"z":"a7da7b08.56417","wires":[["22a4d32f.173d74"]]},{"id":"22a4d32f.173d74","type":"switch","name":"select colour","property":"payload","rules":[{"t":"lt","v":"20"},{"t":"lt","v":"80"},{"t":"else"}],"checkall":"false","outputs":3,"x":457,"y":341,"z":"a7da7b08.56417","wires":[["4e159bf.12bcd64"],["fb6a4916.22a7d"],["532835a.33d37cc"]]},{"id":"4e159bf.12bcd64","type":"function","name":"green","func":"// set LED to green\nmsg.payload = \"020\";\nreturn msg;","outputs":1,"x":614,"y":305,"z":"a7da7b08.56417","wires":[["1b0bdf14.67a029"]]},{"id":"fb6a4916.22a7d","type":"function","name":"amber","func":"// set LED to amber\nmsg.payload = \"210\";\nreturn msg;","outputs":1,"x":614,"y":340,"z":"a7da7b08.56417","wires":[["1b0bdf14.67a029"]]},{"id":"532835a.33d37cc","type":"function","name":"red","func":"// set LED to red\nmsg.payload = \"200\";\nreturn msg;","outputs":1,"x":613,"y":374,"z":"a7da7b08.56417","wires":[["1b0bdf14.67a029"]]},{"id":"43dc37b4.c22f9","type":"inject","name":"","topic":"","payload":"40","repeat":"","crontab":"","once":false,"x":116,"y":523,"z":"a7da7b08.56417","wires":[["22a4d32f.173d74"]]},{"id":"69b16228.690634","type":"inject","name":"","topic":"","payload":"100","repeat":"","crontab":"","once":false,"x":114,"y":560,"z":"a7da7b08.56417","wires":[["22a4d32f.173d74"]]},{"id":"66d941cf.90e4c","type":"inject","name":"","topic":"","payload":"10","repeat":"","crontab":"","once":false,"x":116,"y":483,"z":"a7da7b08.56417","wires":[["22a4d32f.173d74"]]},{"id":"1b0bdf14.67a029","type":"ledborg","name":"","x":780,"y":341,"z":"a7da7b08.56417","wires":[]},{"id":"375c5f52.cf9fc","type":"comment","name":"CurrentCost to LEDborg power orb","info":"By @andysc","x":155,"y":181,"z":"a7da7b08.56417","wires":[]},{"id":"c3a8478c.e33d6","type":"comment","name":"Inject test values","info":"","x":110,"y":440,"z":"a7da7b08.56417","wires":[]}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment