I'm using node-red-contrib-aggregator (v1.5.0) to calculate the daily average ad a temperature value.
Node-RED v1.2.1
It is installed in an IOCage jail (FreeBSD 11.3-RELEASE-p14)
I expected that it would fire at 0:00 to show the average value of the last day.
But it starts at 0:59:59 that is (almost) 1 hour to late.
I already verified the time zone if the IOCage jail which is correct:
root@NodeRed:~ # date
Wed Jan 6 13:09:31 CET 2021
I also added the timezone to settings.js as suggested on several places process.env.TZ = 'Europe/Amsterdam';
just above module.exports = {
node-red-contrib-timerswitch does fire at the proper time so I'm kinda stuck now
Just in case I just upgraded the IOCage to Freebsd 12.1-RELEASE
And also updated Node-RED to 1.2.7 as for some reason I assumed there would be an update notice if a new version came out and I therefor missed the later releases
As a test I set the aggregater at 2 hours.
If I understand it correctly it should fire every even hours (2:00, 4:00, 6:00, 8:00 etc)
But, during this test it didn't fire at 14:00 but on 14:59:58 so again an hour to late.
In my opinion it looks like it is using utc time instead of CET, could this be the case?
And if so, how can I resolve this?
The timestamps in the debug pane are correct.
Also the timestamps shown in the flows (nodes that show a time(date) that is) are correct.
As for the version
root@NodeRed:~ # pkg info | grep node
node10-10.22.1 V8 JavaScript for client and server
npm-node10-6.14.8 Node package manager
root@NodeRed:~ # node -v
v10.22.1
This isn't the latest, but the 10.x is still supported and the changelogs don't show any interesting fixes.
None the less after the manual start test i can update it to the latetst LTS release available in the freebsd package manager (14.13.0) if that could be interesting?
Never restarted node-red manually (auto start with server) so I'm testing that now, will update this post as soon as I have an answer.
The time zone settings have never been changed, the iocage jail was created with the proper time zone settings.
I would run a test here to see if I can replicate the problem, but, being in the UK I am now on UTC and haven't got a spare system I can setup with a different timezone.
Though I think I might have found something that might be part of my issue.
I'm not sure yet as I still have to test it but am out of time for today.
The code of node-red-contrib-aggregator uses new Date().getTime()
This gives the time back as EPOCH which is as far as I know always UTC and the interpretor needs to convert it to something else if needed (for example to the correct time zone).
I haven't found anything in the code for aggregator to correct for the time zone, but i could've missed it.
Did you do it 'properly' by forking the git repository and modifying it on your fork? If so then others can install it direct from your fork by using npm install <your git id>/node-red-contrib-...
Just to clarify, the modified version can be installed by going to your .node-red folder and running npm install AcEIoXx/node-red-contrib-aggregator
then restart node-red.
If you ever want to revert to the standard one then npm remove node-red-contrib-aggregator npm install node-red-contrib-aggregator
Sorry, I wasn't intending to imply any criticism, that is why I put 'proper' in quotes. Often people make such changes by editing the file in node_modules. I had no way of knowing your experience level.
I took no offence, was in a hurry when I typed my reply and didn't meen to offend you.
everybody that wants to use my change..
It works, that's it, the code isn't as nice as I would want it, but I wanted it working will making as litle changes to the original code as possible.
The edit's could be made cleaner, but for me this works for now.