Dashboard chart will only display last few minutes

#1

RPI 3b+
NPM V 1.4.21
Node-RED version: v0.19.4
Node.js version: v8.11.1
Linux 4.14.98-v7+ arm LE
Dashboard version 2.9.4

I have had a flow controlling my greenhouse for over a year now and the temperature chart was working fine.
I changed sensor's from a DHT11 to a DS18B20 and tried to implement storing the chart data into a DB.
Somehow after this (I put the DB storage on the back burner till I get the chart figured out) I managed to break the chart. I have tried making a new chart as well as several different x axis changes all with the same affect.
Any guidance here would be greatly appreciated!
The temperature chart is the one not working, the humidity chart is lacking a sensor at the moment. :slight_smile:
Cheers,
Jon!
Screenshot%20from%202019-04-07%2008-11-51|690x388

[{"id":"993877f1.f3fa68","type":"ui_text","z":"703220a0.a620a","group":"f8030058.e1e44","order":1,"width":0,"height":0,"name":"DateTime","label":"","format":"{{payload | date:\"yyyy-MM-dd HH:mm\"}}","layout":"row-center","x":343.5,"y":37.599998474121094,"wires":[]},{"id":"f7dd3c96.bf098","type":"delay","z":"703220a0.a620a","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":473.18750762939453,"y":379.4663791656494,"wires":[["7cc57f79.ec46c"]]},{"id":"e6a66c18.729e2","type":"ui_gauge","z":"703220a0.a620a","name":"Temperature","group":"f8030058.e1e44","order":2,"width":"5","height":"4","gtype":"gage","title":"temp","label":"C","format":"{{value | number: 1}}","min":"-50","max":"60","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":472.2143669128418,"y":140.7142858505249,"wires":[]},{"id":"c7c44d7d.57588","type":"ui_chart","z":"703220a0.a620a","name":"Humidity Chart","group":"f8030058.e1e44","order":5,"width":"5","height":"4","label":"Humidity Chart","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"48","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":629.5000076293945,"y":264.80001640319824,"wires":[[],[]]},{"id":"8d112433.654dd8","type":"ui_chart","z":"703220a0.a620a","name":"Temperature Chart","group":"f8030058.e1e44","order":3,"width":"5","height":"4","label":"Temperature","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"invalid data","dot":false,"ymin":"-18","ymax":"45","removeOlder":"3","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":671.5000076293945,"y":189.7999930381775,"wires":[[],[]]},{"id":"6257b2ab.2ee58c","type":"rpi-gpio out","z":"703220a0.a620a","name":"","pin":"35","set":"","level":"0","freq":"","out":"out","x":819.2143592834473,"y":371.142972946167,"wires":[]},{"id":"829f1798.f7d1c8","type":"function","z":"703220a0.a620a","name":"Temperature","func":"msg.payload.value = msg.payload;\n\n\nreturn msg;","outputs":1,"noerr":0,"x":274.2142791748047,"y":190.71429443359375,"wires":[["9377859c.ac9998","e6a66c18.729e2"]]},{"id":"6001717d.db97f","type":"bigtimer","z":"703220a0.a620a","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","lat":"43.621433","lon":"-80.345693","starttime":"660","endtime":"1080","startoff":0,"endoff":0,"offs":0,"outtext1":"false","outtext2":"true","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":289.00000762939453,"y":459.00001335144043,"wires":[[],[],["972245d9.182218"]]},{"id":"972245d9.182218","type":"delay","z":"703220a0.a620a","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":452.0120086669922,"y":461.54085540771484,"wires":[["f3c367c4.74c3b8"]]},{"id":"521a9dbc.1c8b24","type":"function","z":"703220a0.a620a","name":"exhaustFanControl","func":"// see if its hot enough to run the exhaust fan\nvar tmpSetpoint = 30; //what temp to actuate exhaust fan\nvar tmp = msg.payload;\nvar result;\ncontrolExhaustFan();\nfunction controlExhaustFan(){\n  //  node.warn(tmp);\nif(tmp > tmpSetpoint)\n{\n    result = \"auto\";\n    msg.payload = result;\n    node.send(msg);\n}\nelse{\nresult = \"off\";\nmsg.payload = result;\nnode.send(msg);\n//node.warn(msg.payload);\n}\n}\nreturn null;\n","outputs":1,"noerr":0,"x":112.00001525878906,"y":383.3333349227905,"wires":[["242e1dd3.a25412"]]},{"id":"5243c13f.4174b","type":"inject","z":"703220a0.a620a","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":"1","x":88.5,"y":35.80000305175781,"wires":[["993877f1.f3fa68"]]},{"id":"f3c367c4.74c3b8","type":"ui_switch","z":"703220a0.a620a","name":"Fan","label":"Fan","group":"f8030058.e1e44","order":9,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"str","onicon":"","oncolor":"","offvalue":"true","offvalueType":"str","officon":"","offcolor":"","x":589,"y":457.5715055465698,"wires":[["509455df.50468c"]]},{"id":"c72f2f13.7acd1","type":"function","z":"703220a0.a620a","name":"Humidity","func":"msg.payload = msg.humidity\nreturn msg;","outputs":1,"noerr":0,"x":253.2142791748047,"y":262.71429443359375,"wires":[["4e73e706.d55318","bba32093.7a1f1"]]},{"id":"bba32093.7a1f1","type":"aggregator","z":"703220a0.a620a","name":"","topic":"","intervalCount":1,"intervalUnits":"h","submitIncompleteInterval":true,"aggregationType":"mean","x":459.0120391845703,"y":263.0023994445801,"wires":[["c7c44d7d.57588"]]},{"id":"1aafe04e.0a669","type":"ui_switch","z":"703220a0.a620a","name":"Drip System","label":"Drip System","group":"f8030058.e1e44","order":7,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"str","onicon":"","oncolor":"","offvalue":"true","offvalueType":"str","officon":"","offcolor":"","x":483,"y":521.5714998245239,"wires":[["e979059a.f52018"]]},{"id":"b1875c23.7eaac","type":"ui_switch","z":"703220a0.a620a","name":"Mist","label":"Mist","group":"f8030058.e1e44","order":8,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"str","onicon":"","oncolor":"","offvalue":"true","offvalueType":"str","officon":"","offcolor":"","x":460.00006103515625,"y":583.5715017318726,"wires":[["f15a8aa8.c1bd68"]]},{"id":"e979059a.f52018","type":"rpi-gpio out","z":"703220a0.a620a","name":"","pin":"37","set":"","level":"0","freq":"","out":"out","x":759.0000190734863,"y":521.5715007781982,"wires":[]},{"id":"509455df.50468c","type":"rpi-gpio out","z":"703220a0.a620a","name":"","pin":"40","set":"","level":"0","freq":"","out":"out","x":760.0000610351562,"y":462.57154655456543,"wires":[]},{"id":"242e1dd3.a25412","type":"bigtimer","z":"703220a0.a620a","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","lat":"43.621433","lon":"-80.345693","starttime":"5000","endtime":"1305","startoff":0,"endoff":0,"offs":0,"outtext1":"false","outtext2":"true","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":299.500057220459,"y":379.50008392333984,"wires":[[],[],["f7dd3c96.bf098"]]},{"id":"61b574e5.57620c","type":"bigtimer","z":"703220a0.a620a","outtopic":"","outpayload1":"","outpayload2":"","name":"Big Timer","lat":"43.621433","lon":"-80.345693","starttime":"570","endtime":"585","startoff":0,"endoff":0,"offs":0,"outtext1":"false","outtext2":"true","timeout":1440,"sun":true,"mon":true,"tue":false,"wed":false,"thu":true,"fri":false,"sat":true,"jan":false,"feb":false,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":false,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":285.00000381469727,"y":524.0000152587891,"wires":[[],[],["1aafe04e.0a669"]]},{"id":"4e73e706.d55318","type":"ui_gauge","z":"703220a0.a620a","name":"Humidity","group":"f8030058.e1e44","order":4,"width":"5","height":"4","gtype":"gage","title":"hum","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":469.2142791748047,"y":316.71429443359375,"wires":[]},{"id":"be123910.15e8d8","type":"function","z":"703220a0.a620a","name":"mistControl","func":"//gets the temp and humidity reading from the DHT11\nvar hum = msg.humidity;\nvar tmp = msg.payload;\nvar result;\n//node.warn('timer');\nsetInterval(function(){\n// node.warn('timer');\n    var hour = new Date().getHours();\n    if (hour >= 8 && hour < 10) {\n        controlMister(); \n    }\n    //else{\n         //set the switch default to off\n    //msg.payload = \"true\";\n    //node.warn(msg.payload);\n    //return msg;\n        \n   // }\n} , 1000*60);\nfunction controlMister(){\nif(hum < 10 && tmp > 40)\n{\n    result = \"false\";\n}\n    else\n{\n        result = \"true\";\n}\n//node.warn(result);\n//return msg;\nmsg.payload = result;\nnode.send(msg);\n//node.warn(msg.payload);\n}\n\n//msg.payload = result;\nreturn null;\n","outputs":1,"noerr":0,"x":124.50000762939453,"y":586.8000659942627,"wires":[["b1875c23.7eaac"]]},{"id":"7cc57f79.ec46c","type":"ui_switch","z":"703220a0.a620a","name":"Exhaust Fan","label":"Exhaust Fan","group":"f8030058.e1e44","order":6,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"str","onicon":"","oncolor":"","offvalue":"true","offvalueType":"str","officon":"","offcolor":"","x":642.2143402099609,"y":372.2858009338379,"wires":[["6257b2ab.2ee58c"]]},{"id":"5951ebea.c7eef4","type":"inject","z":"703220a0.a620a","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":104.21427917480469,"y":103.57144165039062,"wires":[["62f5d775.4bf288"]]},{"id":"f15a8aa8.c1bd68","type":"rpi-gpio out","z":"703220a0.a620a","name":"","pin":"38","set":"","level":"0","freq":"","out":"out","x":757.0000114440918,"y":577.5715007781982,"wires":[]},{"id":"9377859c.ac9998","type":"aggregator","z":"703220a0.a620a","name":"","topic":"","intervalCount":1,"intervalUnits":"m","submitIncompleteInterval":true,"aggregationType":"mean","x":461.50240325927734,"y":185.47114753723145,"wires":[["8d112433.654dd8"]]},{"id":"f5c06d02.0df5c","type":"rpi-dht22","z":"703220a0.a620a","name":"","topic":"rpi-dht11","dht":"11","pintype":"0","pin":"17","x":65,"y":192.00000286102295,"wires":[[]]},{"id":"62f5d775.4bf288","type":"rpi-ds18b20","z":"703220a0.a620a","topic":"","array":false,"name":"","x":500.50000762939453,"y":79.00000286102295,"wires":[["521a9dbc.1c8b24","829f1798.f7d1c8"]]},{"id":"13957e9f.b3d471","type":"file","z":"703220a0.a620a","name":"","filename":"/home/pi/Downloads/chart.log","appendNewline":true,"createDir":true,"overwriteFile":"false","x":1331.3999633789062,"y":284,"wires":[[]]},{"id":"775380b.1e3a28","type":"file in","z":"703220a0.a620a","name":"","filename":"/home/pi/Downloads/chart.log","format":"utf8","sendError":true,"x":1119.3999633789062,"y":422.00001335144043,"wires":[["70a3b472.7ef91c"]]},{"id":"90bead2a.fbff9","type":"json","z":"703220a0.a620a","name":"","property":"payload","action":"","pretty":false,"x":1271.3999633789062,"y":124,"wires":[["aef79578.510d78"]]},{"id":"53098fd.b96597","type":"json","z":"703220a0.a620a","name":"","property":"payload","action":"","pretty":false,"x":1480.399917602539,"y":361.0000114440918,"wires":[[]]},{"id":"aef79578.510d78","type":"function","z":"703220a0.a620a","name":"","func":"//if (msg.topic === \"save\") {\n//    msg.payload = context.last;\nmsg.payload = msg.payload;\n    return msg;\n//}\n//else {\n  //  context.last = msg.payload;\n//}\n//return null;","outputs":1,"noerr":0,"x":1011.3999633789062,"y":284,"wires":[["13957e9f.b3d471"]]},{"id":"74bcfabd.c9d704","type":"inject","z":"703220a0.a620a","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":902.5000228881836,"y":422.00001335144043,"wires":[["775380b.1e3a28"]]},{"id":"70a3b472.7ef91c","type":"debug","z":"703220a0.a620a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1168.5000305175781,"y":493.0000162124634,"wires":[]},{"id":"f8030058.e1e44","type":"ui_group","z":"","name":"Herons Greenhouse","tab":"2be2b3e4.c80b5c","disp":true,"width":"10","collapse":true},{"id":"2be2b3e4.c80b5c","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
0 Likes

#2

So what temperature range are you displaying on the graph?

0 Likes

#3

-18C to 45C
Its not the range that is the problem it is the time, it only shows me the last few minutes rather than days or hours or whatever the x axis is set to.
Cheers,
Jon

0 Likes

#4

The screenshot isn't showing for me.

0 Likes

#5


Not sure what went wrong there...
Cheers,
Jon

0 Likes

#6

What have you set the X-axis time period to in the Chart node settings?

chart

0 Likes

#7

Have you put a debug node watching what is going to the chart and made sure that data keeps coming?
As new data comes in is it being shifted off to the left so the x axis stays at just a few minutes?

0 Likes

#8

It doesn't matter what its set to the result is the same. On the code I posted above I believe it was set for 3 days.
Cheers,
Jon

0 Likes

#9

I have the input to the chart coming from an aggregator which is supplying the temperature every 1 minute and it is working as it should.

0 Likes

#10

0 Likes

#11

You didn't answer the question, if you leave it running does new data get shifted off to the left, as if the chart range was set to a few minutes?

0 Likes

#12

If you disconnect the aggregator node, and replace it with an inject node, set to repeat every minute, does that display in the chart ok.

0 Likes

#13

I am not sure I understand your question.
The data points disappear to the left as if the x axis was set to only show a few minutes. This is the whole problem.
Jon

0 Likes

#14

I can try that though the aggregator has worked fine for over a year in the same setup.
It works without the aggregator too but it slows the pi down when doing this.
Jon

0 Likes

#15

It may seem obvious that you have already said that, but you would be surprised how often there are questions where something that seems obvious to the asker are interpreted differently by the receiver.
So, just to make absolutely certain, the graph is working exactly as it should, the graph moves left and off the edge as normal, and the only issue is that a new value that appears on the right shifts across and off the left in a few minutes whatever value you put in for the time range?
What happens if you put a small range, say 2 minutes, in the chart?
Also can you show us the node red startup log (from the Welcome message). You can get that using

node-red-stop
node-red-start
0 Likes

#16

I tried that, still no joy.
Cheers,
Jon

0 Likes

#17

Well at least that has ruled out any problems with your flow leading up to the chart node....

0 Likes

#18

Agreed!

So, just to make absolutely certain, the graph is working exactly as it should, the graph moves left and off the edge as normal, and the only issue is that a new value that appears on the right shifts across and off the left in a few minutes whatever value you put in for the time range?

Precisely.

I will try that and see.

pi@raspberrypi:~ $ node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.1.7:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
8 Apr 14:14:56 - [info]
Welcome to Node-RED
===================
8 Apr 14:14:56 - [info] Node-RED version: v0.19.4
8 Apr 14:14:56 - [info] Node.js  version: v8.11.1
8 Apr 14:14:56 - [info] Linux 4.14.98-v7+ arm LE
8 Apr 14:14:59 - [info] Loading palette nodes
8 Apr 14:15:05 - [info] Dashboard version 2.9.4 started at /ui
8 Apr 14:15:05 - [info] Settings file  : /home/pi/.node-red/settings.js
8 Apr 14:15:05 - [info] HTTP Static    : /home/pi/Pictures
8 Apr 14:15:05 - [info] Context store  : 'default' [module=memory]
8 Apr 14:15:05 - [info] User directory : /home/pi/.node-red
8 Apr 14:15:05 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
8 Apr 14:15:05 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
8 Apr 14:15:05 - [info] Server now running at http://127.0.0.1:****/
8 Apr 14:15:06 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
8 Apr 14:15:06 - [info] Starting flows
8 Apr 14:15:06 - [info] Started flows

Thanks to everyone trying to help me out here!
Cheers,
Jon

0 Likes

#19

Just noticed that your dashboard is quite old - v2.9.4 (25th May 2018)
The current version is v2.14
Can you try updating? There has been 150 commits since that version, so maybe something has changed which affects the Chart node (despite the semantic versioning suggests no breaking changes :wink:)

Also, the current node-RED version is v0.20.5 and you are running v0.19.4

It may be worthwhile running the RasPi update script -
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

0 Likes

#20

Thanks for that I updated everything and still no joy.
Colin: It works fine for 2 and 5 and 15 minutes, then I jumped to 50 min's and it failed.
Very odd...
Cheers,
Jon

0 Likes