I just spent ages debugging issue with theSunCalc module used in Node-Red-Contrib–BigTimer.
It turns out that the getMoonTimes module doesn’t seem to handle the alwaysUp and alwaysDown methods the way one might expected – these do not return FALSE if not TRUE – they return undefined – that took some figuring out.
I started with try-catch but that failed also. Simply checking as follows did the trick:
if (typeof moons.rise===’undefined’)
moonrise=1440;
else
{
date2=moons.rise; moonrise = (date2.getHours() * 60) +
date2.getMinutes();
}
if (typeof moons.set===’undefined’)
moonset=0;
else
{
date3=moons.set; moonset = (date3.getHours() * 60) +
date3.getMinutes();
}
I’m pretty sure this is now fixed as of BigTimer 2.1.7
Thanks to Aidan Ruff for his help in this one.
I tested this by setting the time to “disaster time” which is midnight 11 feb 0 hour! That’s when my NR stopped recording data to sqlite. var now= new Date(2019,1,11,0,0,0) temporarily.
2.1.7 finally gets around the issue with the moon not always rising and setting in one day.
Update to latest version – works fine now
Dear Peter, to what version should we go back to get rid of indefinite loop when restarting Node-RED?
Leo – read blog updates
The browser is not updating automatically, so I missed change on blog.