I am new to Node-Red and to this Forum.
I am collecting data from a ESPCAM32 via MQTT. The data comes in two parts one just the Value and the other with object info: value, error, rate.
I make use of a small function and then pass the data to influxdb.
I graph this data then in a node red graph as well as in grafana but here is the difference.
Node-Red ignores the bad data (sensor error or connection etc) but grafana / influxdb records this and my graph is not consistent.
I was hoping to use the 'difference function' within grafana to show 'today' vs 'yesterday' or 'this week' vs 'last week' etc. But i think because of my bad data this is not working.
Here is my Flow:
[{"id":"85b96703.91b2e8","type":"tab","label":"Get Water Data","disabled":false,"info":""},{"id":"e4b4bcc7.75523","type":"comment","z":"85b96703.91b2e8","name":"Get Water Meter info and Write into DB","info":"","x":190,"y":60,"wires":[]},{"id":"b038946c.786728","type":"influxdb out","z":"85b96703.91b2e8","influxdb":"22e779f5.7dee06","name":"to InfluxDB","measurement":"Data","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":930,"y":220,"wires":[]},{"id":"a4727018.fa0fc","type":"mqtt in","z":"85b96703.91b2e8","name":"","topic":"#","qos":"2","datatype":"auto","broker":"3b267256.a4deae","nl":false,"rap":true,"rh":0,"x":170,"y":220,"wires":[["e49b0f69.bac13","c62ff07c.d3b6b"]]},{"id":"e49b0f69.bac13","type":"json","z":"85b96703.91b2e8","name":"","property":"payload","action":"","pretty":false,"x":410,"y":220,"wires":[["5b68ed04.2297b4","a6ac87dd.11c9f8"]]},{"id":"5b68ed04.2297b4","type":"debug","z":"85b96703.91b2e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":160,"wires":[]},{"id":"a6ac87dd.11c9f8","type":"function","z":"85b96703.91b2e8","name":"","func":"msg.payload = msg.payload.value;\n\n//Update the Status with current timestamp\n\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() +1) : (now.getMonth() +1); //getMonth() is zero-based\nvar dd = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ?\"0\" + now.getHours() : now.getHours();\nvar mmm = now.getMinutes() < 10 ?\"0\" + now.getMinutes() : now.getMinutes();\nvar ss = now.getSeconds() < 10 ?\"0\" + now.getSeconds() : now.getSeconds();\nnode.status({fill:\"blue\",shape:\"ring\", text:\"Last update: \"+ dd + \".\" + mm + \".\" + yyyy + \" \" + hh + \":\" + mmm + \":\" + ss});\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":220,"wires":[["adf7974.5b25c68","b038946c.786728","bac5d02c.682b9","324e8646.0c567a"]]},{"id":"adf7974.5b25c68","type":"debug","z":"85b96703.91b2e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":160,"wires":[]},{"id":"c62ff07c.d3b6b","type":"debug","z":"85b96703.91b2e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":430,"y":160,"wires":[]},{"id":"bac5d02c.682b9","type":"ui_text","z":"85b96703.91b2e8","group":"27c3d951.18a4e6","order":0,"width":"4","height":"1","name":"","label":"OCR Read","format":"{{msg.payload}}","layout":"row-spread","x":940,"y":300,"wires":[]},{"id":"324e8646.0c567a","type":"ui_chart","z":"85b96703.91b2e8","name":"Water Meter","group":"27c3d951.18a4e6","order":1,"width":"25","height":"8","label":"Water usage ","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Value","dot":false,"ymin":"","ymax":"","removeOlder":"4","removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":940,"y":360,"wires":[[]]},{"id":"22e779f5.7dee06","type":"influxdb","hostname":"influxdb","port":"8086","protocol":"http","database":"data","name":"","usetls":false,"tls":"","influxdbVersion":"1.x","url":"","rejectUnauthorized":false},{"id":"3b267256.a4deae","type":"mqtt-broker","name":"","broker":"192.168.178.154","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"27c3d951.18a4e6","type":"ui_group","name":"Water Meter","tab":"156af96f.f8fd27","order":2,"disp":true,"width":"25","collapse":false},{"id":"156af96f.f8fd27","type":"ui_tab","name":"Home","icon":"home","order":"1"}]
Any suggestions would be very welcome.
Thank you
regards
Dieter