Skip to content

Instantly share code, notes, and snippets.

@fcgdam fcgdam/flow.js
Created Jul 25, 2019

Embed
What would you like to do?
Node-Red flow for PowerMeter
[{"id":"c69b35de.5b1288","type":"tab","label":"Power Meter Dash","disabled":false,"info":"Power Meter DashBoard"},{"id":"11b29614.713a5a","type":"mqtt in","z":"c69b35de.5b1288","name":"PM Telemetry","topic":"iot/device/ESP8266_PowerMeter/telemetry","qos":"2","datatype":"auto","broker":"2a552b3c.de8d2c","x":140,"y":60,"wires":[["4f01e095.a6b468"]]},{"id":"4f01e095.a6b468","type":"json","z":"c69b35de.5b1288","name":"To JSON","property":"payload","action":"","pretty":false,"x":350,"y":60,"wires":[["3afc46aa.19ff9a","b4966155.90ad9","4e1496c4.95576","2cdca24.0a446de","3c7e559f.3df0ea","db4513ed.467ef8"]]},{"id":"3afc46aa.19ff9a","type":"function","z":"c69b35de.5b1288","name":"Voltage (V)","func":"msg.payload = Number(msg.payload.V);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":60,"wires":[["c2e720c3.2121d","f13ac150.bfe46"]]},{"id":"b4966155.90ad9","type":"function","z":"c69b35de.5b1288","name":"Current (I)","func":"msg.payload = Number(msg.payload.I);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":120,"wires":[["880f974.d4d29e8","b4e96359.2356"]]},{"id":"4e1496c4.95576","type":"function","z":"c69b35de.5b1288","name":"Power (W)","func":"msg.payload = Number(msg.payload.P);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":180,"wires":[["a86d0454.7060e","926dfc32.8b45f"]]},{"id":"2cdca24.0a446de","type":"function","z":"c69b35de.5b1288","name":"Energy (E)","func":"msg.payload = Number(msg.payload.E);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":240,"wires":[["c1a24f6d.1f1c98","9dc65db8.01578","c9d8a4b2.56abf8"]]},{"id":"c2e720c3.2121d","type":"ui_gauge","z":"c69b35de.5b1288","name":"Voltage","group":"ba196e43.b35398","order":0,"width":0,"height":0,"gtype":"gage","title":"Voltage","label":"V","format":"{{value}}","min":0,"max":"250","colors":["#e6e600","#00b500","#ca3838"],"seg1":"215","seg2":"230","x":880,"y":60,"wires":[]},{"id":"f13ac150.bfe46","type":"ui_chart","z":"c69b35de.5b1288","name":"Voltage/Time","group":"ba196e43.b35398","order":0,"width":0,"height":0,"label":"Voltage/Time","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":890,"y":120,"wires":[[],[]]},{"id":"880f974.d4d29e8","type":"ui_gauge","z":"c69b35de.5b1288","name":"Current","group":"ab1cea3.a296a98","order":0,"width":0,"height":0,"gtype":"gage","title":"Current","label":"Amps","format":"{{value}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"7","seg2":"10","x":880,"y":180,"wires":[]},{"id":"b4e96359.2356","type":"ui_chart","z":"c69b35de.5b1288","name":"Current/Time","group":"ab1cea3.a296a98","order":0,"width":0,"height":0,"label":"Current/Time","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":890,"y":240,"wires":[[],[]]},{"id":"a86d0454.7060e","type":"ui_gauge","z":"c69b35de.5b1288","name":"Power","group":"c3488338.d22af","order":0,"width":0,"height":0,"gtype":"gage","title":"Power","label":"W","format":"{{value}}","min":0,"max":"4000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"3900","seg2":"3950","x":870,"y":300,"wires":[]},{"id":"926dfc32.8b45f","type":"ui_chart","z":"c69b35de.5b1288","name":"Power Consumption","group":"c3488338.d22af","order":0,"width":0,"height":0,"label":"Power Consumption","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":920,"y":360,"wires":[[],[]]},{"id":"c1a24f6d.1f1c98","type":"ui_gauge","z":"c69b35de.5b1288","name":"Energy","group":"22202c3a.4ce5e4","order":0,"width":0,"height":0,"gtype":"donut","title":"Energy","label":"Wh","format":"{{value}}","min":0,"max":"9999","colors":["#00b500","#e6e600","#ca3838"],"seg1":"49000","seg2":"49500","x":880,"y":420,"wires":[]},{"id":"9dc65db8.01578","type":"ui_chart","z":"c69b35de.5b1288","name":"Energy/Time","group":"22202c3a.4ce5e4","order":0,"width":0,"height":0,"label":"Energy/Time","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":890,"y":480,"wires":[[],[]]},{"id":"c9d8a4b2.56abf8","type":"ui_text","z":"c69b35de.5b1288","group":"22202c3a.4ce5e4","order":0,"width":0,"height":0,"name":"Energy","label":"","format":"<font size=\"+12\">{{msg.payload}} Wh","layout":"col-center","x":880,"y":540,"wires":[]},{"id":"3c7e559f.3df0ea","type":"function","z":"c69b35de.5b1288","name":"Power Factor","func":"var power = 0.0;\nvar current = 0.0;\nvar voltage = 0.0;\n\ncurrent = Number(msg.payload.I);\nvoltage = Number(msg.payload.V);\npower = Number(msg.payload.P);\n\nif ( power > 0.0 ) \n msg.payload = Math.floor(power/(voltage * current)*100)/100;\nelse \n msg.payload = 1.0;\n\nreturn msg;","outputs":1,"noerr":0,"x":580,"y":300,"wires":[["33a63786.6e5268","db4513ed.467ef8"]]},{"id":"33a63786.6e5268","type":"ui_text","z":"c69b35de.5b1288","group":"c3488338.d22af","order":0,"width":0,"height":0,"name":"Power Factor","label":"","format":"<font size=\"+12\">PF: {{msg.payload}}","layout":"row-center","x":900,"y":600,"wires":[]},{"id":"db4513ed.467ef8","type":"debug","z":"c69b35de.5b1288","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":620,"y":400,"wires":[]},{"id":"2a552b3c.de8d2c","type":"mqtt-broker","z":"","broker":"192.168.1.17","port":"1883","clientid":"NodeRed","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"iot/devices/NodeRed/attributes","birthQos":"0","birthPayload":"[{\"active\":true}, {\"web\":\"http://192.168.1.17:1880\"}]","willTopic":"iot/devices/NodeRed/attributes","willQos":"0","willPayload":"[{\"active\":false}, {\"web\":\"http://192.168.1.17:1880\"}]"},{"id":"ba196e43.b35398","type":"ui_group","z":"","name":"Voltage","tab":"6f0d0a75.3994fc","disp":true,"width":"6"},{"id":"ab1cea3.a296a98","type":"ui_group","z":"","name":"Current","tab":"6f0d0a75.3994fc","order":2,"disp":true,"width":"6"},{"id":"c3488338.d22af","type":"ui_group","z":"","name":"Power","tab":"6f0d0a75.3994fc","order":3,"disp":true,"width":"6"},{"id":"22202c3a.4ce5e4","type":"ui_group","z":"","name":"Energy","tab":"6f0d0a75.3994fc","order":4,"disp":true,"width":"6"},{"id":"6f0d0a75.3994fc","type":"ui_tab","z":"","name":"Power Meter","icon":"dashboard"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.