question

Eli Hunter avatar image
Eli Hunter asked

Node-Red timezone

I thought it might be helpful for others in the Venus OS extended image I found time based flows were all in UTC time even though I set the time zone in the Venus menu. i ended up linking my timezone to /etc/localtime from the command line and time worked as expected in Node-Red after a reboot. Might be good for Victron developers to make this link when the timezone is set in the Venus interface?


Update:

I've changed this to set the timezone in Node-Red instead of setting system wide

edit ~/.node-red/settings.js and this right above the module.exports = { line

process.env.TZ = 'America/Los_Angeles';


Node-RED
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
jeroen avatar image
jeroen answered ·

No, that is not a good idea to set in general, since it is system-wide setting. That will make debugging really hard.. if the logs etc are in the local time zone, vrm webserver has its own time zone and the database has its own timezone, and the user his browser has its own timezone.

Instead everything is in UTC, until it is shown to the end user. So the environmental variable TZ should be set instead for node-red I guess.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Eli Hunter avatar image Eli Hunter commented ·

Thanks Jeroen, I've updated the post to set this in Node-Red settings.js instead so it's not system wide. It didn't seem to affect log timestamps in VRM but definitely safer this way.

0 Likes 0 ·
mrhappy avatar image
mrhappy answered ·

I did this, and now node-red can not read the settings file, what do I have to do to correct it?


*** Starting node-red ***

Error loading settings file: /home/root/.node-red/settings.js

root@raspberrypi2:~# cd /home/root/.node-red/

root@raspberrypi2:~/.node-red# ls -la settings.js

-rwxr-xr-x 1 root root 12305 Sep 5 06:54 settings.js



2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mrhappy avatar image mrhappy commented ·
Update: I deleted the settings file altogether and node-red started up. Luckily I had exported my flow so I could import it again....
0 Likes 0 ·
mrhappy avatar image mrhappy commented ·

Updating again for anyone who might have the problem in my above post, as I have succeeded to set the node-red time-zone as described but with a minor difference.

Firstly, when the problem was created, I had edited the settings with nano while ssh'ed into the RasPi. This time instead, I used the command "scp" to copy the file to my computer, edit it and then send it back with that command.

Secondly, in the end of the line in the instruction as per @Eli Hunter, there is a semicolon. I changed that to just a comma, as that is what the rest of the file seems to have in the ends of their instruction-lines.

Restarted venusOS through the console and violá, the time in node-red is correct.

0 Likes 0 ·
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi all, FYI: the next Venus OS large build fixes this issue; and links the node-red timezone to the timezone configured in the GX UI.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Mark avatar image Mark ♦♦ commented ·
Excellent!
0 Likes 0 ·