Node-red-contrib-graphs and historical flow

I have the node-red-contrib-graphs working but it is a little kludgy. I want to direct the data to a file at the same time so that if it does refresh or the flows have to restart they pull back the historical data. Before I start I am looking for flows to build this from if you folks have anything you might think helpful. I am pulling data from openweather and add it as an example later. Been away for a while but I see a lot of improvement in the dashboard in general. It would be awesome if I could find a way to merger node-red-contrib-graphs into node-red-dashboard. I remember that in dashboard you can add links so I will tie it that way for now.

Hope you are all well... I got my patent published 2/11/2021 so it should finalize in October. So Officially I have done more work with the least energy ever recorded...

Working with DIN rail and Jerry at Pi-Plates has new improved DIN Plates to help me out so check him out. GJ on the new dashboard code :slight_smile:

[{"id":"7e13168b.d9445","type":"openweathermap in","z":"847fbaba.2e7b88","name":"San Andreas","wtype":"current","lon":"","lat":"","city":"San Andreas","country":"USA","language":"en","x":90,"y":740,"wires":[["84f0f316.d6f728"]]},{"id":"84f0f316.d6f728","type":"function","z":"847fbaba.2e7b88","name":"Openweather Dashboard Function","func":"var msg1 = { payload:msg.payload.temp_maxc };\nmsg1.topic = \"Max\";\nvar msg2 = { payload:msg.payload.tempc };\nmsg2.topic = \"Current\";\nvar msg3 = { payload:msg.payload.temp_minc };\nmsg3.topic = \"Min\";\nvar msg4 = { payload:msg.payload.description};\nvar msg5 = { payload:msg.payload.icon};\nvar msg6 = { payload:msg.payload.pressure};\nvar msg7 = { payload:msg.payload.humidity};\nvar msg8 = { payload:msg.payload.clouds};\nvar msg9 = { payload:msg.payload.windspeed};\nvar msg10 = { payload:msg.payload.winddirection};\nvar msg11 = { payload:msg.payload.sunrise};\nvar msg12 = { payload:msg.payload.sunset};\nvar msg13 = { payload:msg.location};\nreturn [ msg1, msg2, msg3, msg4, msg5, msg6, msg7, msg8, msg9, msg10, msg11, msg12, msg13 ];","outputs":13,"noerr":0,"x":340,"y":740,"wires":[[],["b44bea5d.ed11c"],[],[],[],[],[],[],[],[],[],[],[]],"outputLabels":["Temp Max","Current Temp","Temp Min","Description","Weather icon","Pressure","Humidity","Clouds","Wind Speed","Wind Direction","Sunrise","Sunset","Location"]},{"id":"b44bea5d.ed11c","type":"unit-converter","z":"847fbaba.2e7b88","category":"temperature","inputUnit":"C","outputUnit":"F","inputField":"payload","outputField":"payload","inputFieldType":"msg","outputFieldType":"msg","name":"","x":600,"y":660,"wires":[["c793ded1.ad6f18"]]},{"id":"c793ded1.ad6f18","type":"function","z":"847fbaba.2e7b88","name":"","func":"var now = ( new Date() ).getTime();\nvar value=msg.payload;\nmsg.payload = {\n tstamp: now,\n data: value\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":660,"wires":[["6bcf6594.eaa3b4"]]},{"id":"6bcf6594.eaa3b4","type":"change","z":"847fbaba.2e7b88","name":"","rules":[{"t":"change","p":"topic","pt":"msg","from":"Current","fromt":"str","to":"","tot":"str"},{"t":"delete","p":"_msgid","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":660,"wires":[["ecb63e4c.d0f7c"]]},{"id":"ecb63e4c.d0f7c","type":"iot-datasource","z":"847fbaba.2e7b88","name":"Outdoor Temperature","tstampField":"tstamp","dataField":"data","disableDiscover":false,"x":1140,"y":660,"wires":[[]]},{"id":"d85919cd.908c78","type":"function","z":"847fbaba.2e7b88","name":"","func":"var now = ( new Date() ).getTime();\nvar value=msg.payload;\nmsg.payload = {\n tstamp: now,\n data: value\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800,"y":600,"wires":[["1321cc47.7dffd4"]]},{"id":"1321cc47.7dffd4","type":"change","z":"847fbaba.2e7b88","name":"","rules":[{"t":"delete","p":"_msgid","pt":"msg"},{"t":"delete","p":"filename","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":600,"wires":[["5254cc54.c3502c"]]},{"id":"5254cc54.c3502c","type":"iot-datasource","z":"847fbaba.2e7b88","name":"CPU Temperature - F","tstampField":"tstamp","dataField":"data","disableDiscover":false,"x":1180,"y":600,"wires":[[]]},{"id":"1b364fef.62e0c8","type":"calculator","z":"847fbaba.2e7b88","name":"","inputMsgField":"payload","outputMsgField":"payload","operation":"div","constant":"1000","x":650,"y":600,"wires":[["d85919cd.908c78"]],"info":"msg.payload = [\n \"system.cpu.temp\",\n msg.payload\n]"},{"id":"17a1a805.79ee6","type":"file in","z":"847fbaba.2e7b88","name":"thermal_zone0_temp","filename":"/sys/class/thermal/thermal_zone0/temp","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":480,"y":600,"wires":[["1b364fef.62e0c8"]]},{"id":"f74b62d9.f68e6","type":"function","z":"847fbaba.2e7b88","name":"","func":"msg.filename=\"/sys/class/thermal/thermal_zone0/temp\";\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":600,"wires":[["17a1a805.79ee6"]]},{"id":"def78aaf.529ae","type":"inject","z":"847fbaba.2e7b88","name":"","repeat":"15","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":600,"wires":[["f74b62d9.f68e6"]]}]

That hasn't been updated in 5 and a half years! I'm amazed that it works at all!

Dashboard has lots of options for charting I think. There are other options too and I've included lots of charting examples for uibuilder using different charting tools.

If you need some thoughts on caching of data for your charts, uibuilder has an example that lets you use a function node to cache data. I know that this is designed for uibuilder with it's cache replay feature but Dashboard has a similar capability so that you can detect when a new client connects or reloads the page.

I see what you've been working on, do you have anything as a flow as a starting point?

Install node-red-dashboard, then see if the Chart node does what you need.

I have charts, they are limited. I want to add historical data too. What would be nice is to go 12-18 months back for weather data and have the graphs scale. NOAA data is worthless since the historical Highs and Lows are not accurate. I want the graphs to use in my vineyard over time. The current system paps the temperature to the pump operations. It will predict watering based on the 10 day forecast which isn't the norm now.

For such an application I highly recommend using influxdb for keeping the data and grafana for displaying it. That will give you vastly more sophisticated graphs than you will get using using node-red for the graphs.

I don't want it to keep connected to the internet and its only 1 sample per minute. Morons at NOAA cant keep that granularity and you now can only get data to 2010 because it exposes their climate fallacy. Oldest data in USA is in BOSTON and the API refuses to expose it. Spent months showing them their API is broken.

Does that comment have some relevance to my suggestion?

My suggestion would be to put all of that data into InfluxDB if it isn't already. It is specifically designed to handle such historic timeseries data.

You can then very easily use Grafana to produce your charts. It has a query builder that makes it easy to get specific data and summarise it however you want.

I realise that this isn't Node-RED but for working on complex historic data like that, it is hard to beat InfluxDB and Grafana. You can always translate the chart into a Dashboard or uibuilder chart once you have got exactly what you want - though I suspect that you will not bother.

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