Node-red time mismatch

I have my node-red and Home assistant installed as containers in Docker on my Synology NAS.

My node-red time is 4 hrs behind my Home Assistant time.

How can I rectify this as it makes executing automations based on time difficult???

You need to change the timezone in the settings.js.

i.e.: process.env.TZ = "Europe/Brussels";

Thanks. Where shall I paste this in my setting.js and in what format. Kindly guide as I didn’t find any TZ timezone mentioned in my settings.js.

Solved. As mentioned by @AlmostSerious. Thanks a ton

where exactly did you paste the code?

I am wondering too, how do you add this to the settings.js ? No luck so far

If you installed the NodeRed Addon via the HA Addon Store then simply go to the config folder (the folder where your configuration.yaml sits) find the node-red folder and inside you will see the settings.js

Hi Marcus,

Yes, I knew that, sorry should have mentioned. However wherever I add that line in the settings.js file I get an error when I start the plugin again. So for example at the end of the file:

};
// change time zone (ikke)
process.env.TZ = “Europe/Brussels”;

I get for example:

Error loading settings file: /etc/node-red/config.js
/config/node-red/settings.js:195
process.env.TZ = “Europe/Brussels”;
                 
SyntaxError: Invalid or unexpected token
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/etc/node-red/config.js:1:16)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)

Same when I put it at the begin or inside modules.first.

What am I missing ?

Try to add it like this:

 * If you like to change those settings, some are available via the add-on
 * settings/option in the Hass.io panel in Home Assistant.
 */
process.env.TZ = "Europe/Brussels";
module.exports = {
1 Like

At first it did not work. I copied and pasted in the file editor plugin like before. On a hunch I deleted it and typed by hand. Works now ! Thanks. I must have had some codes copied in there.