Homey Community Forum

Node Red: A widget based dashboard working with Homey trough MQTT

Energy page part 3/4

I need a reply to one of these posts before I can post part 4/4 according to community rules.

{"id":"2c319ac.1847166","type":"function","z":"7a3033ea.2f403c","name":"sorteerGrootverbruikers","func":"// sorteren grootverbruikers\n\n/*\nconst singers = [\n  { name: 'Steven Tyler', band: 'Aerosmith', born: 1948 },\n  { name: 'Karen Carpenter', band: 'The Carpenters', born: 1950 },\n  { name: 'Kurt Cobain', band: 'Nirvana', born: 1967 },\n  { name: 'Stevie Nicks', band: 'Fleetwood Mac', born: 1948 },\n]; \n*/\n\nvar grootverbruikers = new Map(global.get(\"GrootverbruikersMap\"));\n\nfunction compare(a, b) {\n  // Use toUpperCase() to ignore character casing\n  const powerA = a.value;\n  const powerB = b.value;\n\n  let comparison = 0;\n  if (powerA > powerB) {\n    comparison = 1;\n  } else if (powerA < powerB) {\n    comparison = -1;\n  }\n  return comparison *-1; // multiply with -1 for reverse sorting order\n}\n\n\n//\n\n\n\n/*\nconst iterator1 = grootverbruikers.entries();\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n    console.log(iterator1.next().value);\n*/\n\nvar gvbArray = Array.from(grootverbruikers, ([name, value]) => ({ name, value }));\n//console.log(gvbArray);\ngvbArray.sort(compare);\n//console.log(\"Sorted: \" + gvbArray);\n\n\nmsg.payload=gvbArray;\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":1740,"wires":[["66e2da5b.1f8d94"]]},{"id":"d51e14d5.87d178","type":"inject","z":"7a3033ea.2f403c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":1740,"wires":[["2c319ac.1847166"]]},{"id":"66e2da5b.1f8d94","type":"ui_template","z":"7a3033ea.2f403c","group":"fce2a100.6e2d6","name":"sortedGrootverbruikers","order":1,"width":6,"height":4,"format":"<span style=\"vertical-align:middle; font-size:15px; color: rgb(255, 255, 255); text-align: left; \" class=\"fr-class-transparency\">\n<span>\n    <table width=\"100%\">\n        <tr><td><B>{{msg.payload[0].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[0].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[1].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[1].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[2].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[2].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[3].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[3].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[4].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[4].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[5].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[5].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[6].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[6].value}}<b>&nbsp;[W]</b></span></td></tr>\n        <tr><td><B>{{msg.payload[7].name}}:</B></td><td width=\"30%\" align=\"right\"><span>{{msg.payload[7].value}}<b>&nbsp;[W]</b></span></td></tr>\n    </table></span>\n </span>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":760,"y":1740,"wires":[[]]},{"id":"137a6212.12756e","type":"function","z":"7a3033ea.2f403c","name":"resetDailyUtilityCounters","func":"msg.payload=\"reset\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":560,"wires":[["d602af21.7af74","428a0465.143c3c","27364ab1.89b806","6100b68e.f98c58","17391f8f.fe6ee","b6b7c2b8.e19bb"]]},{"id":"49d16998.b31af8","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"f0c86728.497088","order":1,"width":3,"height":3,"name":"verbruikElectriciteitActueel","icon":"fa-bolt","label":"Verbruik Actueel","unit":"W","layout":"radial","decimals":"0","differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-4000,"col":"#84ff42","t":"min","dot":0},{"val":0,"col":"#ffbf66","t":"sec","dot":0},{"val":750,"col":"#ff513d","t":"sec","dot":0},{"val":7500,"col":"#ff513d","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":900,"y":120,"wires":[]},{"id":"9afb87d6.dabd68","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"f0c86728.497088","order":2,"width":3,"height":3,"name":"productieElecticiteitActueel","icon":"fa-sun-o","label":"Productie Actueel","unit":"W","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#00aaff","t":"min","dot":0},{"val":4000,"col":"#8fff66","t":"sec","dot":0},{"val":5000,"col":"#8fff66","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1410,"y":180,"wires":[]},{"id":"d2e0e37c.0da69","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"f0c86728.497088","order":3,"width":3,"height":3,"name":"zonnepanelenProductieVandaag","icon":"fa-sun-o","label":"Productie Vandaag","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#3db5ff","t":"min","dot":0},{"val":30,"col":"#66ff6b","t":"sec","dot":0},{"val":45,"col":"#66ff6b","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1440,"y":500,"wires":[]},{"id":"9bc7e684.beb3a8","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"f0c86728.497088","order":4,"width":3,"height":3,"name":"gasVerbruikVandaag","icon":"fa-fire","label":"Gasverbruik","unit":"m3","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#a6ff00","t":"min","dot":0},{"val":2,"col":"#ffc766","t":"sec","dot":0},{"val":5,"col":"#fb5656","t":"sec","dot":0},{"val":10,"col":"#fb5656","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1360,"y":240,"wires":[]},{"id":"c9061773.347fb8","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":3,"width":3,"height":3,"name":"gasVerbruik","icon":"fa-fire","label":"Gasverbruik","unit":"m3","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#73ff00","t":"min","dot":0},{"val":500,"col":"#ffbf66","t":"sec","dot":0},{"val":1200,"col":"#ff674d","t":"sec","dot":0},{"val":2000,"col":"#ff674d","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":690,"y":960,"wires":[]},{"id":"4b972bc4.678054","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":1,"width":3,"height":3,"name":"electriciteitVerbruikPiek","icon":"fa-bolt","label":"Electriciteit [Piek]","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#73ff00","t":"min","dot":0},{"val":1000,"col":"#00ccff","t":"sec","dot":0},{"val":1500,"col":"#ffa53d","t":"sec","dot":0},{"val":2000,"col":"#ff6a38","t":"sec","dot":0},{"val":2500,"col":"#ff6a38","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":730,"y":1000,"wires":[]},{"id":"7209a170.9b32d","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":2,"width":3,"height":3,"name":"electriciteitVerbruikDal","icon":"fa-bolt","label":"Electriciteit [Dal]","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#73ff00","t":"min","dot":0},{"val":1000,"col":"#00ccff","t":"sec","dot":0},{"val":2000,"col":"#ffa53d","t":"sec","dot":0},{"val":3000,"col":"#ff6a38","t":"sec","dot":0},{"val":4500,"col":"#ff6a38","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":720,"y":1040,"wires":[]},{"id":"3abaa096.8bc77","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":5,"width":3,"height":3,"name":"electriciteitGeleverdDal","icon":"fa-bolt","label":"Geleverd [Dal]","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#00ccff","t":"min","dot":0},{"val":750,"col":"#66ff00","t":"sec","dot":0},{"val":1500,"col":"#66ff00","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":730,"y":1120,"wires":[]},{"id":"9e01b57f.3cc748","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":4,"width":3,"height":3,"name":"electriciteitGeleverdPiek","icon":"fa-bolt","label":"Geleverd [Piek]","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#00ccff","t":"min","dot":0},{"val":1500,"col":"#66ff00","t":"sec","dot":0},{"val":3000,"col":"#66ff00","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":730,"y":1080,"wires":[]},{"id":"732fbe6c.9c5fa","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":7,"width":9,"height":1,"name":"piekElectriciteitDelta","icon":"fa-balance-scale","label":"Subtotaal Piek","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-3000,"col":"#80ff00","t":"min","dot":0},{"val":-1000,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":1000,"col":"#ffa53d","t":"sec","dot":0},{"val":2000,"col":"#ff6347","t":"sec","dot":0},{"val":3000,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1660,"y":980,"wires":[]},{"id":"813aca75.526168","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":8,"width":9,"height":1,"name":"dalElectriciteitDelta","icon":"fa-balance-scale","label":"Subtotaal Dal","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-3000,"col":"#80ff00","t":"min","dot":0},{"val":-1000,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":1000,"col":"#ffa53d","t":"sec","dot":0},{"val":2000,"col":"#ff6347","t":"sec","dot":0},{"val":3000,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1650,"y":1020,"wires":[]},{"id":"f6df0d43.d555f","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":9,"width":9,"height":1,"name":"TotaalElectriciteitDelta","icon":"fa-balance-scale","label":"Totaal","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-3000,"col":"#80ff00","t":"min","dot":0},{"val":-1000,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":1000,"col":"#ffa53d","t":"sec","dot":0},{"val":2000,"col":"#ff6347","t":"sec","dot":0},{"val":3000,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1660,"y":1080,"wires":[]},{"id":"27364ab1.89b806","type":"function","z":"7a3033ea.2f403c","name":"resetElectriciteitVerbruikPiekMeterBeginVandaag","func":"const measurementStartToday = \"ElectriciteitVerbruikPiekMeterBeginVandaag\";\nconst measurementNow = \"ElectriciteitVerbruikPiekMeterNu\";\n\nvar todayMeterStart = global.get(measurementStartToday);\nvar currentMeter = global.get(measurementNow);\n\n//currentMeter = Number(msg.payload);\nglobal.set(measurementStartToday, currentMeter);\n\nmsg.payload=\"timer\";\nconsole.log(\"Reset daily Energy Consumption [\"+msg.payload)+\"]\";\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":700,"wires":[["ade9575b.150198"]]},{"id":"6100b68e.f98c58","type":"function","z":"7a3033ea.2f403c","name":"resetElectriciteitVerbruikDalMeterBeginVandaag","func":"const measurementStartToday = \"ElectriciteitVerbruikDalMeterBeginVandaag\";\nconst measurementNow = \"ElectriciteitVerbruikDalMeterNu\";\n\nvar todayMeterStart = global.get(measurementStartToday);\nvar currentMeter = global.get(measurementNow);\n\n//currentMeter = Number(msg.payload);\nglobal.set(measurementStartToday, currentMeter);\n\nmsg.payload=\"timer\";\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":740,"wires":[["b11ec81d.f147e8"]]},{"id":"b6b7c2b8.e19bb","type":"function","z":"7a3033ea.2f403c","name":"resetElectriciteitProductieDalMeterBeginVandaag","func":"const measurementStartToday = \"ElectriciteitProductieDalMeterBeginVandaag\";\nconst measurementNow = \"ElectriciteitProductieDalMeterNu\";\n\nvar todayMeterStart = global.get(measurementStartToday);\nvar currentMeter = global.get(measurementNow);\n\n//currentMeter = Number(msg.payload);\nglobal.set(measurementStartToday, currentMeter);\n\nmsg.payload=\"timer\";\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":820,"wires":[["30cc3293.8f2bee"]]},{"id":"17391f8f.fe6ee","type":"function","z":"7a3033ea.2f403c","name":"resetElectriciteitProductiePiekMeterBeginVandaag","func":"const measurementStartToday = \"ElectriciteitProductiePiekMeterBeginVandaag\";\nconst measurementNow = \"ElectriciteitProductiePiekMeterNu\";\n\nvar todayMeterStart = global.get(measurementStartToday);\nvar currentMeter = global.get(measurementNow);\n\n//currentMeter = Number(msg.payload);\nglobal.set(measurementStartToday, currentMeter);\n\nmsg.payload=\"timer\";\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":590,"y":780,"wires":[["d2ad40bc.39698"]]},{"id":"dcf92b23.579b88","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":3,"width":3,"height":3,"name":"gasVerbruik","icon":"fa-fire","label":"Gasverbruik","unit":"m3","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#a6ff00","t":"min","dot":0},{"val":2,"col":"#ffc766","t":"sec","dot":0},{"val":5,"col":"#fb5656","t":"sec","dot":0},{"val":10,"col":"#fb5656","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1070,"y":240,"wires":[]},{"id":"1c8dcdfd.89e8b2","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":1,"width":3,"height":3,"name":"electriciteitPiek","icon":"fa-bolt","label":"Electriciteit [Piek]","unit":"kWh","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#00ccff","t":"min","dot":0},{"val":5,"col":"#ffc766","t":"sec","dot":0},{"val":20,"col":"#fb5656","t":"sec","dot":0},{"val":50,"col":"#fb5656","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1080,"y":280,"wires":[]},{"id":"f5e08437.259918","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":2,"width":3,"height":3,"name":"electriciteitDal","icon":"fa-bolt","label":"Electriciteit [Dal]","unit":"kWh","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#00ccff","t":"min","dot":0},{"val":5,"col":"#ffc766","t":"sec","dot":0},{"val":20,"col":"#fb5656","t":"sec","dot":0},{"val":50,"col":"#fb5656","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1080,"y":320,"wires":[]},{"id":"e7359766.d01ab8","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":4,"width":3,"height":3,"name":"geleverdPiek","icon":"fa-bolt","label":"Geleverd [Piek]","unit":"kWh","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#0093b8","t":"min","dot":0},{"val":10,"col":"#00ccff","t":"sec","dot":0},{"val":30,"col":"#b9fb56","t":"sec","dot":0},{"val":50,"col":"#b9fb56","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1070,"y":360,"wires":[]},{"id":"e90f2f19.f46a4","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":5,"width":3,"height":3,"name":"geleverdDal","icon":"fa-bolt","label":"Geleverd [Dal]","unit":"kWh","layout":"radial","decimals":"2","differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#0093b8","t":"min","dot":0},{"val":10,"col":"#00ccff","t":"sec","dot":0},{"val":30,"col":"#b9fb56","t":"sec","dot":0},{"val":50,"col":"#b9fb56","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1070,"y":400,"wires":[]},{"id":"1311d27b.c95d2e","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":7,"width":9,"height":1,"name":"piekElectriciteitDeltaToday","icon":"fa-balance-scale","label":"Subtotaal Piek","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-50,"col":"#80ff00","t":"min","dot":0},{"val":-20,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":10,"col":"#ffa53d","t":"sec","dot":0},{"val":20,"col":"#ff6347","t":"sec","dot":0},{"val":50,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1650,"y":760,"wires":[]},{"id":"bbf7dc53.fc8e3","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":8,"width":9,"height":1,"name":"dalElectriciteitDeltaToday","icon":"fa-balance-scale","label":"Subtotaal Dal","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-50,"col":"#80ff00","t":"min","dot":0},{"val":-20,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":10,"col":"#ffa53d","t":"sec","dot":0},{"val":20,"col":"#ff6347","t":"sec","dot":0},{"val":50,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1650,"y":800,"wires":[]},{"id":"84e00858.87c448","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":9,"width":9,"height":1,"name":"TotaalElectriciteitDeltaToday","icon":"fa-balance-scale","label":"Totaal","unit":"kWh","layout":"linear","decimals":0,"differential":true,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":-50,"col":"#80ff00","t":"min","dot":0},{"val":-20,"col":"#00ccff","t":"sec","dot":0},{"val":0,"col":"#ffcd61","t":"sec","dot":0},{"val":10,"col":"#ffa53d","t":"sec","dot":0},{"val":20,"col":"#ff6347","t":"sec","dot":0},{"val":50,"col":"#ff6347","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"0","x":1660,"y":860,"wires":[]},{"id":"537252e5.cda48c","type":"inject","z":"7a3033ea.2f403c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1020,"y":1640,"wires":[["50366f1e.38aa3"]]},{"id":"21ca3fb.d1b59c","type":"persist in","z":"7a3033ea.2f403c","name":"begindagelectriciteitverbruikpiek","storageNode":"c675f72.471c008","x":1154,"y":1240,"wires":[]},{"id":"a217d94e.f75218","type":"persist in","z":"7a3033ea.2f403c","name":"begindagelectriciteitverbruikdal","storageNode":"eb8f6019.dec53","x":1154,"y":1280,"wires":[]},{"id":"66079f10.785ca","type":"persist in","z":"7a3033ea.2f403c","name":"begindagelectriciteitproductiepiek","storageNode":"9303dedb.b71ba","x":1164,"y":1320,"wires":[]},{"id":"ffbf5189.23e6","type":"persist in","z":"7a3033ea.2f403c","name":"begindagelectriciteitproductiedal","storageNode":"54c90b5e.88b804","x":1154,"y":1360,"wires":[]},{"id":"e3b9c2f5.ed3b3","type":"persist in","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitverbruikpiek","storageNode":"f1952deb.03f73","x":1154,"y":1400,"wires":[]},{"id":"366bd804.3e66b8","type":"persist in","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitverbruikdal","storageNode":"e43bb6a.5472648","x":1154,"y":1440,"wires":[]},{"id":"2f241aaf.24d716","type":"persist

Reply

Thank you :pray:

Energy page part 4/4

in","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitproductiepiek","storageNode":"4ff00333.6353ec","x":1164,"y":1480,"wires":[]},{"id":"b1a68ed7.435fb","type":"persist in","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitproductiedal","storageNode":"c77cf8e3.719928","x":1154,"y":1520,"wires":[]},{"id":"f6e7aa97.fbcab8","type":"persist out","z":"7a3033ea.2f403c","name":"begindagelectriciteitverbruikpiek","storageNode":"c675f72.471c008","x":470,"y":1240,"wires":[["769311ae.25123"]]},{"id":"b2c6ffa7.94dc5","type":"persist out","z":"7a3033ea.2f403c","name":"begindagelectriciteitverbruikdal","storageNode":"eb8f6019.dec53","x":470,"y":1280,"wires":[["fc4860b6.bfee6"]]},{"id":"72264479.962eec","type":"persist out","z":"7a3033ea.2f403c","name":"begindagelectriciteitproductiepiek","storageNode":"9303dedb.b71ba","x":480,"y":1320,"wires":[["ed4293a2.7c597"]]},{"id":"e9bd0c4.1ed6ff","type":"persist out","z":"7a3033ea.2f403c","name":"begindagelectriciteitproductiedal","storageNode":"54c90b5e.88b804","x":470,"y":1360,"wires":[["31b4173e.5f7e08"]]},{"id":"1e775c92.7bb113","type":"persist out","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitverbruikpiek","storageNode":"f1952deb.03f73","x":470,"y":1400,"wires":[["34972325.abb81c"]]},{"id":"7cd4f85a.9f37e8","type":"persist out","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitverbruikdal","storageNode":"e43bb6a.5472648","x":470,"y":1440,"wires":[["9cec09a1.56a068"]]},{"id":"c022ed80.432df","type":"persist out","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitproductiepiek","storageNode":"4ff00333.6353ec","x":480,"y":1480,"wires":[["62cfdb3f.a55b84"]]},{"id":"79ca65ad.ea962c","type":"persist out","z":"7a3033ea.2f403c","name":"beginjaarelectriciteitproductiedal","storageNode":"c77cf8e3.719928","x":470,"y":1520,"wires":[["61a7b994.57e658"]]},{"id":"770077a4.025558","type":"persist in","z":"7a3033ea.2f403c","name":"begindaggasmeter","storageNode":"49570503.4a64dc","x":1110,"y":1600,"wires":[]},{"id":"2e1158bd.28b6b8","type":"persist out","z":"7a3033ea.2f403c","name":"begindaggasmeter","storageNode":"49570503.4a64dc","x":430,"y":1600,"wires":[["b5386a7b.58c918"]]},{"id":"7d5f58f3.81d6f8","type":"function","z":"7a3033ea.2f403c","name":"storeBeginJaarGasMeter","func":"global.set(\"GasMeterBeginJaar\",Number(msg.payload));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":1560,"wires":[["47703d32.10efe4"]]},{"id":"47703d32.10efe4","type":"persist in","z":"7a3033ea.2f403c","name":"beginjaargasmeter","storageNode":"5f348123.be8d3","x":1110,"y":1560,"wires":[]},{"id":"fa8f36ea.aeaaa8","type":"persist out","z":"7a3033ea.2f403c","name":"beginjaargasmeter","storageNode":"5f348123.be8d3","x":430,"y":1560,"wires":[["7d5f58f3.81d6f8"]]},{"id":"a19fc044.59ce3","type":"function","z":"7a3033ea.2f403c","name":"","func":"msg.payload=\"2014\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":1200,"wires":[["7d5f58f3.81d6f8"]]},{"id":"de964f69.b9106","type":"inject","z":"7a3033ea.2f403c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":1200,"wires":[["a19fc044.59ce3"]]},{"id":"2b51c68c.8eeefa","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"82af3e44.028c","order":6,"width":3,"height":3,"name":"zonnepanelenProductieVandaagCumulatief","icon":"fa-sun-o","label":"Productie Vandaag","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#3db5ff","t":"min","dot":0},{"val":30,"col":"#66ff6b","t":"sec","dot":0},{"val":45,"col":"#66ff6b","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":1390,"y":600,"wires":[]},{"id":"a8597c53.5f397","type":"solaredge","z":"7a3033ea.2f403c","site":"2517b7a8.d06758","interval":900,"command":"overview","x":360,"y":1160,"wires":[["d9cf3949.db9818","30c8c464.c3186c","d8e8755c.0e90f8","e805470d.af6a58"]]},{"id":"d9cf3949.db9818","type":"function","z":"7a3033ea.2f403c","name":"yearAccumulatedGeneratedEnergy","func":"msg.payload=msg.payload.overview.lastYearData.energy;\nmsg.payload=Number(msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":1160,"wires":[["48e90a70.d65df4"]]},{"id":"48e90a70.d65df4","type":"ui_artlessgauge","z":"7a3033ea.2f403c","group":"e68a9ffb.7c55e","order":6,"width":3,"height":3,"name":"productieJaarCumulatief","icon":"fa-sun-o","label":"Geproduceerd","unit":"kWh","layout":"radial","decimals":0,"differential":false,"minmax":true,"colorTrack":"#555555","colorFromTheme":true,"property":"payload","sectors":[{"val":0,"col":"#66ff00","t":"min","dot":0},{"val":6000,"col":"#66ff00","t":"max","dot":0}],"lineWidth":"7","bgcolorFromTheme":true,"diffCenter":"","x":910,"y":1160,"wires":[]},{"id":"40597759.234878","type":"persist out","z":"7a3033ea.2f403c","name":"zonnepanelenproductie","storageNode":"98220ee9.291f","x":830,"y":440,"wires":[["68a67434.c0f6ec"]]},{"id":"31238c49.c9dee4","type":"persist in","z":"7a3033ea.2f403c","name":"zonnepanelenproductie","storageNode":"98220ee9.291f","x":1290,"y":440,"wires":[]},{"id":"68101c26.022004","type":"persist out","z":"7a3033ea.2f403c","name":"electriciteitchart","storageNode":"db19d8da.672838","x":570,"y":40,"wires":[["72f7623.9b5949c"]]},{"id":"d64fad4a.563f5","type":"persist in","z":"7a3033ea.2f403c","name":"electriciteitchart","storageNode":"db19d8da.672838","x":770,"y":80,"wires":[]},{"id":"30c8c464.c3186c","type":"function","z":"7a3033ea.2f403c","name":"todayGeneratedEnergy","func":"msg.payload=msg.payload.overview.lastDayData.energy;\nmsg.payload=Number(msg.payload/1000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":830,"y":600,"wires":[["d2e0e37c.0da69","2b51c68c.8eeefa"]]},{"id":"d8e8755c.0e90f8","type":"debug","z":"7a3033ea.2f403c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":640,"wires":[]},{"id":"e805470d.af6a58","type":"function","z":"7a3033ea.2f403c","name":"currentPower","func":"msg.payload=msg.payload.overview.currentPower.power;\nmsg.payload=Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1070,"y":160,"wires":[["9afb87d6.dabd68","68a67434.c0f6ec"]]},{"id":"91e88251.9a6fb","type":"mqtt-broker","z":"","name":"host mqtt broker","broker":"192.168.1.2","port":"1883","clientid":"nodered","usetls":false,"compatmode":true,"keepalive":"60","cleansession":false,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f0c86728.497088","type":"ui_group","z":"","name":"Energie Vandaag","tab":"9184a885.936cb8","order":1,"disp":true,"width":"18","collapse":false},{"id":"b9324735.956f98","type":"ui_group","z":"","name":"Meterstanden dit jaar [sinds meteropname]","tab":"9184a885.936cb8","order":4,"disp":true,"width":"12","collapse":false},{"id":"fce2a100.6e2d6","type":"ui_group","z":"","name":"Grootverbruikers","tab":"9184a885.936cb8","order":5,"disp":true,"width":"6","collapse":true},{"id":"e68a9ffb.7c55e","type":"ui_group","z":"","name":"Energie Lopend Jaar Cumulatief","tab":"9184a885.936cb8","order":3,"disp":true,"width":9,"collapse":false},{"id":"82af3e44.028c","type":"ui_group","z":"","name":"Energie Vandaag Cumulatief","tab":"9184a885.936cb8","order":2,"disp":true,"width":9,"collapse":false},{"id":"c675f72.471c008","type":"persist-store","z":"","filename":"begindagelectriciteitverbruikpiek.json","interval":"3600"},{"id":"eb8f6019.dec53","type":"persist-store","z":"","filename":"begindagelectriciteitverbruikdal.json","interval":"3600"},{"id":"9303dedb.b71ba","type":"persist-store","z":"","filename":"begindagelectriciteitproductiepiek.json","interval":"3600"},{"id":"54c90b5e.88b804","type":"persist-store","z":"","filename":"begindagelectriciteitproductiedal.json","interval":"60"},{"id":"f1952deb.03f73","type":"persist-store","z":"","filename":"beginjaarelectriciteitverbruikpiek.json","interval":"3600"},{"id":"e43bb6a.5472648","type":"persist-store","z":"","filename":"beginjaarelectriciteitverbruikdal.json","interval":"3600"},{"id":"4ff00333.6353ec","type":"persist-store","z":"","filename":"beginjaarelectriciteitproductiepiek.json","interval":"60"},{"id":"c77cf8e3.719928","type":"persist-store","z":"","filename":"beginjaarelectriciteitproductiedal.json","interval":"3600"},{"id":"49570503.4a64dc","type":"persist-store","z":"","filename":"begindaggasmeter.json","interval":"3600"},{"id":"5f348123.be8d3","type":"persist-store","z":"","filename":"beginjaargasmeter.json","interval":"3600"},{"id":"2517b7a8.d06758","type":"solaredge-site","z":0,"siteid":"---","apikey":"----"},{"id":"98220ee9.291f","type":"persist-store","z":"","filename":"zonnepanelenproductie.json","interval":"900"},{"id":"db19d8da.672838","type":"persist-store","z":"","filename":"electriciteitchart.json","interval":"900"},{"id":"9184a885.936cb8","type":"ui_tab","z":"","name":"Energie","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

Thank you for sharing.
I have added 3496 lines of JSON to a new Node-RED project and everything looks fine.

I’m also notice already a few nice settings you have used and some thing I can learn from.
Need to install some dependencies to get the graphical dashboard to show up.
I wil give it a try later.

Thank you very much!

If anyone is running a Node Red dashboard via an Android device, FYI I created a Homey App so you control your device via Homey. For info see topic.

2 Likes

Maybe you followed the guide in the first post as I did, and I noticed there is a small ‘error’ in the JSON you copy. Check if the topic names are correct after you use find/replace to put in your own names. One entry is different from the rest (if I recall correct it is the name of a light in the MQTT input block) so that one isn’t replaced properly.

You’re welcome! Have fun :smiley:

Hi @Satoer,

Did you describe anywhere how you mounted the tablet? With hidden cables etc.?
Or are you aware of a good resource regarding this topic?

Thanks, Roger

Looking great!

I just started experimenting with Node-red, I love it. It not only gives you a dashboard but way more control. I am Tuya Converting my plugs and switches(which are capatible) and installed node-red en MQTT broker on my Pi. Working great with MQTT Client and Tasmota MQTT.

Would it not be great to have node-red installed on Homey? So you can have flow only for standard users and flows/node-red for Tinkers and experienced users.

Hi, today I succesfully imported your very nice energy dashboard page. I would like to share the things I had to do to fire it up, for the benefit of other users. I use a plugwise energie monitor and my solarpanel inverter is from Goodwe. I use the homey SolarPanels (Zonnepanelen) app and the Plugwise Smile app.

On import I had to remove the Solar input node and connect the switch outputs for solar panel readings to the two solar panel input functions.

The first run delivered some errors in functions in the debugwindow. Caused by:

  • retrieving global variables that do not exist
  • Use Mqtt input instead of the solar module in the input functions
  • persistent storage json files that cannot be found.

The solution to the first is quite simple. If you add the code ||0 (or zero) to the global.get statements in the variable declarations in the functions, the variables resolve to zero in case the variable does not exist yet. Now the variables resolved to “undefined” which causes the functions to fail.
The second error was caused by the two solarpanel input functions, I commented out the first line which reads a fancy msg object, the mqtt input from the homey app is just a simple payload string.

I still have to figure out how to create the persistent storage json files.

I also had to set my initial meter readings and the start year of the gasmeter in two functions to initialize current values. And change the input switch functions to listen to my own mqtt server and the right homey topics.

Some fintuning needed, but it works fine. Thanks for sharing.

Hi, I would like to create a heating modes for my z-wave radiator valves in my Node red dashboard.
I have a Eurotronic z-wave valves, which has a 5 MQTT “modes”:
Heat (in Homey app: Comfortable),
Energy save heat (in Homey app: Economic),
FULL POWER (in Homey app: Boost),
MANUFACTURER SPECIFC (in Homey app: Manual)
and Off (in Homey app: Off).

How can i create a buttons in red node which set a mode in my valves?
When i set a valve by Homey app to Comfortable, MQTT Client says:

20201021-17:32:02 SendMessageToTopic called
20201021-17:32:02 SendMessageToTopic: {“qos”:0,“retain”:“1”,“mqttTopic”:“homie/homey-xxx/bedroomvalve/eurotronic-mode-spirit”,“mqttMessage”:“Heat”}
20201021-17:32:02 publish_options: {“qos”:0,“retain”:true}
20201021-17:32:02 send Heat on topic homie/homey-xxx/bedroomvalve/eurotronic-mode-spirit
20201021-17:32:02 OnMessage called
20201021-17:32:02 received ‘Heat’ on ‘homie/homey-xxx/bedroomvalve/eurotronic-mode-spirit’
20201021-17:32:02 Trigger generic card for homie/homey-xxx/bedroomvalve/eurotronic-mode-spirit
20201021-17:32:02 send message to listeners via realtime api
20201021-17:32:02 homie/homey-xxx/bedroomvalve/eurotronic-mode-spirit: Heat

I use some global variables to set device power readings that I can then use in various flows. These global vars may indeed not exist in your environment.

Thanks for sharing your learnings as well about missing variables.

For creating the persistent storage files, I used the help info from the component - all necessary info is there… (node-red-contrib-persist)… The file is created when data is received into the file.

can you share this dash?

hi @Satoer i don’t know if I’m stupid but I’m new in this a did everything by the book but still my lights not working? maybe i need a raspberry PI? right now only used a router and Homey.

some solutions? or maybe im out my mind?

a got a respons 2020-10-27 06:34:20node: Output debughomie/homey-topic/fönstervardagsrum/onoff : msg.payload : boolean

true

2020-10-27 06:34:20node: Output debughomie/homey-topic/fönstervardagsrum/onoff : msg.payload : boolean

true

2020-10-27 06:34:22node: Output debughomie/homey-topic/fönstervardagsrum/onoff : msg.payload : boolean

false

2020-10-27 06:34:22node: Output debughomie/homey-topic/fönstervardagsrum/onoff : msg.payload : boolean

false

Hi guys, help me please. I have a Homey with MQTT and Node-red. I would like to save and stored a graph data to some file or database to preserve graphs after restart of my raspberry pi. Can you help me please how can i do that?

Save info via node-red into an influxdb (running on the same host as node-red).
And then create a dashboard with information from influxdb

Or use the app influxdb app on the homey to export insight data direcly to influx and then use node-red or grafana to create the dashboards.

1 Like

Thanks for your help. Grafana looks beautiful but doesn’t work with my iPad mini 1 (2012). :frowning:

can you share the sensors flow please