Node-Red Flow Samples/Sharing

I just did bug report also, yours sounds better. Agree on accuracy though.

2 Likes

I've also recently noticed a dif between the "delay" node and "countdown"

In this sequence the delay always ends 28 seconds before the countdown.

image

Thought it was me, and have not had time to look until I saw this post. Wonder if anyone else has seen time offset between "delay" and "countdown" nodes?

1 Like

I wonder if that means it's a Node-RED issue? Interesting.

I tried comparing nautical dawn time using the cron-plus node v/s the sun-position node.

For the cron-plus node, nautical dawn is 5:38:17 CST
For sun-position node, nautical dawn is 5:39:18 CST

So they disagree by 1 minute and 1 second. FWIW, I tried this using the system TZ configuration, or by configuring each of them using the exact same lat/lon - the difference persists.

Interestingly, neither of those times matches with the nautical twilight times I get for my location from:

Nautical dawn for Feb 27th is 5:36AM CST as per timeanddate.com

1 Like

@erktrek - this is weird. While there is a difference in the sunrise/nautical dawn/civil dawn times between the cron-plus and sun-position nodes, they are both exactly the same time for civil dusk, and nautical dusk.

I think the error arises from differences in internal solartime calculations between these nodes.

So I don't think this is the same issue reported by @TechMedX. I'm going to test that next using three timer nodes.

1 Like

@TechMedX and @erktrek

I setup the simple test shown below using these three nodes:

  1. built-in delay node
  2. stoptimer-varidelay
  3. mytimeout

The output from all three nodes was sent to the simpletime node, and then to three debug nodes that indicate the time in hh:mm:ss:millis that the incoming was received by the simpletime node.

For a 2 minute timer, there is a 1 millisecond difference between the built-in delay timer and stoptimer-varidelay. However, there is a 730 ms difference between the mytimeout node and the others. If this simple setup shows a close to 1 second difference after a 2 minute timer, it seems reasonable that @TechMedX saw a 28 second difference after a 9 minute timer.

This difference suggests there are issues processing within the mytimeout node, rather than a general node-red issue. If this node isn't written efficiently, it seems it would be more susceptible to server load than either of the other two nodes I tested.

I'll try a 9 minute timer for S & G a little later.

2 Likes

@TechMedX

After 9 minutes this is what happened:

Screen Shot 2022-02-26 at 13.03.07

With the load the my node-red server is under, I see a difference of ~2.5 seconds. That is quite a lot. I would not recommend the use of the mytimeout node for any timer sensitive operations.

2 Likes

This is my last note on this - I promise :joy:

I increased server load on purpose by running a counter that increased the value of msg.payload by 1 every 0.1 ms.

After just 60 seconds, there is now a clear 1.1 second difference between the mytimeout node and both the other nodes.

So that mytimeout node's performance is definitely very server load dependent.

3 Likes

I suspect it would also be influenced by the overall performance of your NR host.

Interestingly, I get the same time for cron-plus and sun-position enhanced inject. But still see the difference between the sun-position nodes enhanced-inject & within-time.

image

The differences you are seeing between NR and timeanddate.com is due to coordinate differences.

I used the same lat and long for everything: lat: 29.59; long: -90.09

The red box indicates the time for February 27th because next day is selected by default in the configuration for that node.

The blue box is for February 26th.

@erktrek - this is probably the issue in your example as well. And in my previous tests.

Agreed for that example dawn to dusk. But I actually had the within-time node configured as dusk to dawn when I noticed it.

As show below. So by your thinking in the example in green box civil dawn is for 26th and not 27th? Even though it would seem that the between time is today --> tomorrow.

image

2 Likes

I can't try that yet. But I did verify the previous example was a day issue. I'll be back at my computer in a little bit and dig deeper into your second example.

It would seem so, but at least on my phone, it is definitely giving the times for today and not the next day. That's an error in that node that should be reported.

1 Like

I did as well as @erktrek

However according to the FAA Sunrise / Sunset Calculator - FAA Aviation Weather Cameras the only accurate time is sunset end. Civil dusk is close. :man_shrugging:

image
image

timeanddate has below which is within a minute of FAA times
civil dawn 6:32
sunrise 7:00
sunset 6:11
civil dusk 6:39

And as for today, below would seem to bear out @aaiyar thinking the within-time node as show below is showing times for the 26th (within 1 -2 minutes) and that civil dawn is not the next day but the current day even though the time frame would logically be tonite through tomorrow morning

image
image

Just for S&G here's from the US Naval Observatory first column is date and last 2 columns are Feb start and end civil twilight.
image

In conclusion, if it's that important buy an atomic clock. :grinning:

1 Like

@kuzenkohome, @aaiyar - Just heard back from a sun-position dev - as we suspected...

Hello,

This is an expected behavior.

The time-inject node always shows the next timestamp - the timestamp of the next inject, whereas the within-time node always shows the timestamps for the current day.

The reason for this is that the within-time node determines the start and end time for the current day and then checks whether the current time is within this period. These determined times are simply output as status. The inject node always determines the next time and outputs this as status.

The function to determine the time is also not in the nodes themselves, but in the configuration node. As long as both nodes use the same configuration-node, it is 100% sure that they use the same time. Since both nodes use the same function for the determination of the time and this function the determined times even internally cached by day - that means, the times are not recalculated each time, but all nodes with the same configuration node use the same time. To thus differences in times can arise only by times for different days or configuration nodes.

Is this here a feature request, because to change in such a way that the within-time node after expiration of the time period outputs the next time period?

regards

1 Like

Yup.

However, what @TechMedX noticed is definitely a bug. The mytimeout node is too sensitive to system load. I hope some user of that node reports it.

1 Like

I have not used that node but it looks cool. I can also see why it might be impacted by system load depending on how the calculations are handled..

1 Like

This is an update to the Speedtest sequence that I posted in this thread ~2 years ago. There are two versions of the speedtest node:

  1. node-red-contrib-speedtest. On flows.nodered.org, this is at version 1.0.1.
  2. node-red-contrib-speedtest-updated. This is derived from node-red-contrib-speedtest, and on flows.nodered.org, this is at version 2.0.2.

Both of these use v1 of the speedtest client. However, #1 was updated on Github to use v2 of the speedtest client, which is substantially better. The Github version is now 1.1.0, and that is the version used in my updated sequence.

The download/upload Mbits/sec will now exactly match what is seen using Ookla Speedtest.

There is also one minor update to what is displayed on the Dashboard. The name/identity of the speedtest host is now clickable, and will open a new tab with the original results from speedtest.net (see screenshots below)

Installing this new sequence is a bit of chore because version 1.1.0 of the speedtest node has to be installed using npm (It is not available via the palette manager).

Here are command line instructions that must be run from within the node-red directory.

npm uninstall --save node-red-contrib-speedtest-updated
npm install --save node-red-contrib-speedtest

And then replace the original sequence with this one:

[{"id":"38287a9c.ed6b16","type":"tab","label":"Speedtest","disabled":false,"info":""},{"id":"26548c9f.0a8ae4","type":"speedtest","z":"38287a9c.ed6b16","name":"Speedtest","maxTime":"120000","serverId":"","acceptLicense":true,"acceptGdpr":true,"x":510,"y":500,"wires":[["396bf742.f9d9","6acde784.b9637","de54e40c.adbb6","106aee5e.e0264a","aa97e078d434bb68"]]},{"id":"106aee5e.e0264a","type":"simpletime","z":"38287a9c.ed6b16","name":"","mydate":true,"myymd":true,"myyear":true,"mymonth":true,"mymonthn":true,"mydom":true,"mydoy":true,"myday":true,"myhourpm":true,"myhour":true,"mytime":true,"mytimes":true,"myminute":true,"myminutes":true,"mysecond":true,"mymillis":true,"myepoch":true,"myrawdate":true,"mypm":true,"x":510,"y":560,"wires":[["c3381fddc96e1bfe","8e794ac3deed5f26"]]},{"id":"396bf742.f9d9","type":"change","z":"38287a9c.ed6b16","name":"download","rules":[{"t":"set","p":"topic","pt":"msg","to":"Download","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$round((payload.download.bandwidth)/125002, 2)","tot":"jsonata"},{"t":"set","p":"download","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":440,"wires":[["5e653827.8785","5f6cea04.d3fee4"]]},{"id":"6acde784.b9637","type":"change","z":"38287a9c.ed6b16","name":"upload","rules":[{"t":"set","p":"topic","pt":"msg","to":"Upload","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$round((payload.upload.bandwidth)/125002, 2)","tot":"jsonata"},{"t":"set","p":"upload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":480,"wires":[["e9d19890.e768","5f6cea04.d3fee4"]]},{"id":"de54e40c.adbb6","type":"change","z":"38287a9c.ed6b16","name":"ping","rules":[{"t":"set","p":"topic","pt":"msg","to":"Ping","tot":"str"},{"t":"set","p":"ping","pt":"flow","to":"payload.ping.latency","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"ping","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":560,"wires":[["7be6dd65.0679a4","246ebc72.ad1ffc"]]},{"id":"5e653827.8785","type":"ui_gauge","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":7,"width":0,"height":0,"gtype":"gage","title":"Download Speed","label":"Download Mbits","format":"{{value}}","min":0,"max":"175","colors":["#ff002d","#e4b400","#03f81f"],"seg1":"30","seg2":"70","className":"","x":1050,"y":440,"wires":[]},{"id":"5f6cea04.d3fee4","type":"ui_chart","z":"38287a9c.ed6b16","name":"","group":"6dbda234.52c8cc","order":2,"width":12,"height":6,"label":"Performance Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1050,"y":240,"wires":[["fd9f742c.8b63c8"]]},{"id":"e9d19890.e768","type":"ui_gauge","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":8,"width":0,"height":0,"gtype":"gage","title":"Upload Speed","label":"Upload MBits","format":"{{value}}","min":0,"max":"15","colors":["#ff002d","#ffed36","#03f81f"],"seg1":"2","seg2":"7","className":"","x":1040,"y":480,"wires":[]},{"id":"7be6dd65.0679a4","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":4,"width":0,"height":0,"name":"","label":"Ping Time","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","className":"","x":1020,"y":560,"wires":[]},{"id":"246ebc72.ad1ffc","type":"ui_chart","z":"38287a9c.ed6b16","name":"","group":"6dbda234.52c8cc","order":4,"width":12,"height":6,"label":"Latency Chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1040,"y":360,"wires":[["d699828f.59d9d8"]]},{"id":"c6ceb4b4.b89518","type":"json","z":"38287a9c.ed6b16","name":"","x":1270,"y":180,"wires":[["5f6cea04.d3fee4"]]},{"id":"fd9f742c.8b63c8","type":"file","z":"38287a9c.ed6b16","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1300,"y":240,"wires":[[]]},{"id":"d699828f.59d9d8","type":"file","z":"38287a9c.ed6b16","name":"Speed Test Data Save","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1300,"y":320,"wires":[[]]},{"id":"75617693.7c66f","type":"json","z":"38287a9c.ed6b16","name":"","x":1270,"y":420,"wires":[["246ebc72.ad1ffc"]]},{"id":"d6650ca2.aff488","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":6,"width":0,"height":0,"name":"","label":"Last Speedtest","format":"<font color=\"cyan\">{{msg.payload}}</font>","layout":"col-center","className":"","x":1040,"y":520,"wires":[]},{"id":"746fb82b.bef8","type":"file in","z":"38287a9c.ed6b16","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestData.json","format":"utf8","x":1310,"y":280,"wires":[["c6ceb4b4.b89518"]]},{"id":"6facbb75.c62ad4","type":"file in","z":"38287a9c.ed6b16","name":"Speed Test Data Restore","filename":"/home/odroid/.node-red/data/speedtest/speedtestDataPD.json","format":"utf8","x":1310,"y":360,"wires":[["75617693.7c66f"]]},{"id":"1122ef5f.e68229","type":"inject","z":"38287a9c.ed6b16","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"restore","payloadType":"str","x":1040,"y":300,"wires":[["746fb82b.bef8","6facbb75.c62ad4"]]},{"id":"215587eb.e0e4a8","type":"ui_button","z":"38287a9c.ed6b16","name":"","group":"2a046f7e.21973","order":3,"width":0,"height":0,"label":"SpeedTest Now!","color":"","icon":"","payload":"","payloadType":"date","topic":"","x":290,"y":480,"wires":[["26548c9f.0a8ae4"]]},{"id":"22197e6c.d3e35a","type":"comment","z":"38287a9c.ed6b16","name":"Speedtest (once an hour)","info":"","x":290,"y":100,"wires":[]},{"id":"232191e0.aa6446","type":"cronplus","z":"38287a9c.ed6b16","name":"Every 6 hours","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Every 6 hours","topic":"Every 6 hours","payloadType":"str","payload":"start","expressionType":"cron","expression":"5 */6 * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":300,"y":520,"wires":[["26548c9f.0a8ae4"]]},{"id":"9c6301a1.640288","type":"switch","z":"38287a9c.ed6b16","name":"down < 70","property":"download","propertyType":"flow","rules":[{"t":"lt","v":"70","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":640,"wires":[["596bab8b.4e19dc"]]},{"id":"596bab8b.4e19dc","type":"change","z":"38287a9c.ed6b16","name":"Speed Test","rules":[{"t":"set","p":"topic","pt":"msg","to":"Speed Test","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":640,"wires":[["8ce20f27.8481e8"]]},{"id":"8ce20f27.8481e8","type":"template","z":"38287a9c.ed6b16","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Internet speed was {{flow.download}}/{{flow.upload}} (down/up Mbits/s) at {{mytimes}} on {{mymonthn}}/{{mydom}}. Speedtest server was {{payload.server.sponsor}}.","output":"str","x":1190,"y":640,"wires":[["be415b8c.8405f"]]},{"id":"be415b8c.8405f","type":"link out","z":"38287a9c.ed6b16","name":"SMS-out","links":["67fd4532.52d0e4","f90b7520.2bca38"],"x":1295,"y":640,"wires":[]},{"id":"c3381fddc96e1bfe","type":"change","z":"38287a9c.ed6b16","name":"time","rules":[{"t":"set","p":"lasttest","pt":"flow","to":"$.mydate &\" \" &  $.mytimes","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"lasttest","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":520,"wires":[["d6650ca2.aff488"]]},{"id":"66b92f1745c51496","type":"inject","z":"38287a9c.ed6b16","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"Download","payload":"download","payloadType":"flow","x":845,"y":220,"wires":[["5e653827.8785"]],"l":false},{"id":"d8fb2ee91d981d93","type":"inject","z":"38287a9c.ed6b16","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.2","topic":"Upload","payload":"upload","payloadType":"flow","x":845,"y":260,"wires":[["e9d19890.e768"]],"l":false},{"id":"804d689b26f1a9de","type":"inject","z":"38287a9c.ed6b16","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.4","topic":"Ping","payload":"ping","payloadType":"flow","x":845,"y":340,"wires":[["7be6dd65.0679a4"]],"l":false},{"id":"e470fef7a4ddf502","type":"inject","z":"38287a9c.ed6b16","name":"","props":[{"p":"payload"},{"p":"link","v":"link","vt":"flow"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.6","topic":"ISP","payload":"isp","payloadType":"flow","x":845,"y":380,"wires":[["c2ce63457ba135e1"]],"l":false},{"id":"e7d166b8ceab0c22","type":"inject","z":"38287a9c.ed6b16","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.3","topic":"Time","payload":"lasttest","payloadType":"flow","x":845,"y":300,"wires":[["d6650ca2.aff488"]],"l":false},{"id":"8e794ac3deed5f26","type":"delay","z":"38287a9c.ed6b16","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":715,"y":640,"wires":[["9c6301a1.640288"]],"l":false},{"id":"aa97e078d434bb68","type":"change","z":"38287a9c.ed6b16","name":"ISP","rules":[{"t":"set","p":"isp","pt":"flow","to":"payload.server.name","tot":"msg"},{"t":"set","p":"link","pt":"flow","to":"payload.result.url","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"isp","tot":"flow"},{"t":"set","p":"link","pt":"msg","to":"link","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":600,"wires":[["c2ce63457ba135e1"]]},{"id":"c2ce63457ba135e1","type":"ui_text","z":"38287a9c.ed6b16","group":"2a046f7e.21973","order":2,"width":0,"height":0,"name":"","label":"Hosted By","format":"<a href=\"{{msg.link}}\" target=\"_blank\" rel=\"noopener noreferrer\"><font color=\"cyan\">{{msg.payload}}</font></a>","layout":"col-center","className":"","x":1030,"y":600,"wires":[]},{"id":"2a046f7e.21973","type":"ui_group","name":"Graphs","tab":"929d3236.90d2","order":1,"disp":false,"width":"6","collapse":false},{"id":"6dbda234.52c8cc","type":"ui_group","name":"Charts","tab":"929d3236.90d2","order":2,"disp":false,"width":"12","collapse":false},{"id":"929d3236.90d2","type":"ui_tab","name":"Internet Speed","icon":"dashboard","order":2,"disabled":false,"hidden":false}]
2 Likes