Hi guys.... So I've added
contextStorage: {
default: {
module: "localfilesystem"
}
}
To bottom of my settings.js file and rebooted node-red.
The data stored in the flow is still reset on reboot. Leaving the count back at 0.
Any tips?
Heres the flow so far:
[{"id":"64d121c6.a5d788","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"eac55f79.66c4c8","type":"change","z":"64d121c6.a5d788","name":"Delete Context Store","rules":[{"t":"delete","p":"waterpulse","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":460,"wires":[[]]},{"id":"e92d8702.0a56","type":"inject","z":"64d121c6.a5d788","name":"Reset the store","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":460,"wires":[["eac55f79.66c4c8"]]},{"id":"4137d385.337b24","type":"debug","z":"64d121c6.a5d788","name":"Set","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":180,"wires":[]},{"id":"d7f692eb.5c92e8","type":"inject","z":"64d121c6.a5d788","name":"Inject pulse at boot","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"11","x":170,"y":240,"wires":[["b9debb4a.a3cc4"]]},{"id":"575c606f.1ad49","type":"change","z":"64d121c6.a5d788","name":"","rules":[{"t":"set","p":"waterpulse","pt":"flow","to":"$flowContext(\"waterpulse\")+payload\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":180,"wires":[["4137d385.337b24"]]},{"id":"b9debb4a.a3cc4","type":"switch","z":"64d121c6.a5d788","name":"","property":"waterpulse","propertyType":"flow","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":180,"wires":[["575c606f.1ad49"],["9ba93b30.489928"]]},{"id":"9ba93b30.489928","type":"change","z":"64d121c6.a5d788","name":"set 0 if flow.pulse does not exist","rules":[{"t":"set","p":"waterpulse","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":240,"wires":[[]]},{"id":"4a23c523.06fb2c","type":"inject","z":"64d121c6.a5d788","name":"60 Sec inject","topic":"","payload":"waterpulse","payloadType":"flow","repeat":"60","crontab":"","once":true,"onceDelay":0.1,"x":160,"y":340,"wires":[["24a7a485.310394","c0d6b244.dde638"]]},{"id":"24a7a485.310394","type":"debug","z":"64d121c6.a5d788","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":438.5714416503906,"y":388.571533203125,"wires":[]},{"id":"8a9d435a.fdb878","type":"link out","z":"64d121c6.a5d788","name":"","links":["5e0c1af.06430e4"],"x":623.5714416503906,"y":328.571533203125,"wires":[]},{"id":"f9f5110a.f4fb28","type":"change","z":"64d121c6.a5d788","name":"Publish","rules":[{"t":"set","p":"topic","pt":"msg","to":"sensor/water_meter_encoder/stored","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":528.5714416503906,"y":328.571533203125,"wires":[["8a9d435a.fdb878"]]},{"id":"c0d6b244.dde638","type":"function","z":"64d121c6.a5d788","name":"Convert","func":"msg.payload = ((msg.payload)).toFixed(2);\nreturn msg;\n","outputs":1,"noerr":0,"x":388.5714416503906,"y":328.571533203125,"wires":[["f9f5110a.f4fb28"]]},{"id":"3eebf212.83aa66","type":"comment","z":"64d121c6.a5d788","name":"Publish totals to MQTT","info":"","x":160,"y":300,"wires":[]},{"id":"621a998d.6e6c68","type":"comment","z":"64d121c6.a5d788","name":"Reset the counter","info":"","x":150,"y":420,"wires":[]},{"id":"1e4a0142.545cd7","type":"comment","z":"64d121c6.a5d788","name":"MQTT Liters into counter","info":"","x":170,"y":140,"wires":[]},{"id":"14c03aa4.94bf35","type":"inject","z":"64d121c6.a5d788","name":"MQTT Input","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":180,"wires":[["b9debb4a.a3cc4"]]}]
Cheers!