Node-red-contrib-dashboard-bar-chart-data

Hi

Does anyone have any experience with persisting with this node? The documentation makes it sound pretty straightforwad. Just inject the output back to the input to refresh the data on restart. I just can't get it to work.

The graph is taking MQTT data of energy usage and displaying it per minute.

I'm running this on the IBM cloud which makes the persist node tricky so have created a cloudant database to store the array.

Here's a copy of the flow. Any help is really appreciated.

[{"id":"a722016e.33b0e","type":"inject","z":"96de733e.0e177","name":"read energy1hour value on startup","topic":"","payload":"{\"_id\":\"energy1hourtest\"}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":240,"y":180,"wires":[["e20e5a7.bb108a8"]]},{"id":"e20e5a7.bb108a8","type":"cloudant in","z":"96de733e.0e177","name":"","cloudant":"","database":"barcharts","service":"data-cloudantNoSQLDB","search":"_id_","design":"","index":"","x":500,"y":180,"wires":[["fdcae0f2.86715"]]},{"id":"a73cf47.d88a408","type":"bar-chart-data","z":"96de733e.0e177","name":"bar-chart-data","x_interval":"minutes","x_size":"60","unit":"","precision":"0","is_meter_reading":"False","agg_by":"sum","x":1040,"y":180,"wires":[["2920c45b.beb85c","7fcfa63e.7570c8"]]},{"id":"2920c45b.beb85c","type":"ui_chart","z":"96de733e.0e177","name":"","group":"ebed513f.a81d6","order":5,"width":0,"height":0,"label":"TEST GRAPH","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":true,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1300,"y":180,"wires":[[]]},{"id":"fdcae0f2.86715","type":"change","z":"96de733e.0e177","name":"Strip out data and set topic","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Energy/Watts/Minute","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":180,"wires":[["a73cf47.d88a408"]]},{"id":"8dbeb6ba.0a4aa8","type":"mqtt in","z":"96de733e.0e177","name":"","topic":"Energy/Watts/Minute","qos":"2","datatype":"auto","broker":"480d4a78.59ed84","x":630,"y":260,"wires":[["a73cf47.d88a408"]]},{"id":"b18b13cc.000a2","type":"cloudant in","z":"96de733e.0e177","name":"","cloudant":"","database":"barcharts","service":"data-cloudantNoSQLDB","search":"_id_","design":"","index":"","x":740,"y":580,"wires":[["498884e4.55e0cc"]]},{"id":"5ca8813d.8a568","type":"change","z":"96de733e.0e177","name":"Update existing value","rules":[{"t":"set","p":"payload.data","pt":"msg","to":"newdata","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1180,"y":580,"wires":[["79479d29.4fab14"]]},{"id":"79479d29.4fab14","type":"cloudant out","z":"96de733e.0e177","name":"","cloudant":"d4f21423.21adb8","database":"barcharts","service":"data-cloudantNoSQLDB","payonly":true,"operation":"insert","x":1440,"y":580,"wires":[]},{"id":"22313429.66e17c","type":"function","z":"96de733e.0e177","name":"set msg.topic to ID and save payload","func":"msg.newdata = msg.payload\n\nmsg.payload = {\"_id\":msg.topic}\n\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":580,"wires":[["b18b13cc.000a2"]]},{"id":"498884e4.55e0cc","type":"switch","z":"96de733e.0e177","name":"if record found","property":"payload","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"true","repair":false,"outputs":2,"x":920,"y":580,"wires":[["540bf559.c577ec"],["5ca8813d.8a568"]]},{"id":"540bf559.c577ec","type":"function","z":"96de733e.0e177","name":"format for new record","func":"\nvar message = {\"_id\":msg.topic,\"data\":msg.newdata}\nmsg.payload = message\nreturn msg;","outputs":1,"noerr":0,"x":1180,"y":500,"wires":[["79479d29.4fab14"]]},{"id":"7fcfa63e.7570c8","type":"change","z":"96de733e.0e177","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"energy1hourtest","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":580,"wires":[["22313429.66e17c"]]},{"id":"ebed513f.a81d6","type":"ui_group","z":"","name":"Electricity use","tab":"ee433665.71d8e8","order":1,"disp":true,"width":"6","collapse":false},{"id":"480d4a78.59ed84","type":"mqtt-broker","z":"","name":"MQTT","broker":"mqtt.com","port":"10902","clientid":"IBMCloud_Node_Red","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d4f21423.21adb8","type":"cloudant","z":"","host":"2e8ac18e-55eb-4581-95ba-f23e7b9b4038-bluemix.cloudant.com","name":""},{"id":"ee433665.71d8e8","type":"ui_tab","z":"","name":"House status","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.