Solved / Wrong timezone in Node Red / Correct time in Hass & in docker container

I solved this way.
From Portainer I entered into the container console as root and I did this, in my case,

TZ=Europe/Rome

Then rebooted the container and now all is OK

1 Like

Doesn’t work for me. I installed Node Red as a Hassio Add-on, It’s not a container but an image, so I don’t get the option to go into console in portainer.

Any ideas?

Strange, because I have several addon, like Configurator, seen as additional container, and I can enter in the console

31

For me the only one that gets added as a container is dasshio. All the others (Node-Red, Configurator, ADB Config Bridge and so on) are showed as “images” only.

I guess I’ll never understand this container thing :thinking:

An image is what gets pulled from repos or local builds to run a container.

You did something really wrong

Sorry, I was messing things up (Like I said, I just don’t understand it)
Dasshio = container
all others = images
I installed all of them via the Hassio UI.

I can’t find a setting to change the timezone for images

EVERY docker container running is a container. An image is what is downloaded to run. If it’s running, it’s a container.

fyi, i had this issue on my raspberry pi dockers.

you have to add:

-v /etc/localtime:/etc/localtime:ro

Which you can’t do with HassIO

Yeah, it was my bad. I had to follow the two steps mentioned here (only did step 1) to see all containers. By default for the hassio add-ons only the images are displayed.

For changing the timezone: using TZ=Europe/Rome in console didn’t work because it was passed as environment variable in the container settings.
So for anyone who runs into the same problem:

  1. open the portainer addon
  2. click on the node red container
  3. click Duplicate/Edit
  4. Go to the Env Tab
  5. there is a variable called TZ, it was set to UTC for me. Change it to your timezon (eg. Europe/Rome)
  6. Hit deploy and accept the warning (you will override your old settings)
    -> wait for the addon to start. should be working now!
2 Likes

Hello,

I’ve been with the same problem and capstan1 procedure solves the problem, at least temporarily.
What I’m noticing is that when I reboot or restart Hassio the TZ variable is reseted to UTC on node rede container.

I’ve tried to set it permanently on portainer by generating a new image and to create a new node red container with it but with no results, what ever I do the container is recreated with the original settings.

Any recommendations?

Regards

The work around did not work for me, my container is set to EET same as my Hassio setup, however node-red is still using UTC, except for in the debug window.

The work around did not work for me, my container is set to EET same as my Hassio setup, however node-red is still using UTC, except for in the debug window.

Me too. TZ is correct on portainer’s container enviroment, but nodered still uses UTC. Did anyone manage to solve it?

image

Hi,

i have the same issue here. Ist there any solution? If not, I maybe would add a bug notification to the plugin.

Attached a Foto of a timestamp inject going directly to a debug node. Timestamp of debug node is correct, timestamp of the timestamp inject is not.

Bildschirmfoto 2021-01-28 um 08.02.14

… ok, the time zone in Home Assistant itself was set to Paris, not Berlin. I’m sorry for the confusion.

I had the issue and solved it according to the documentation of the Node-RED Add-on:

Time zone configuration

The addon will use the configured time zone of the underlying operating system. If this is incorrect (for example with the Home Assistant Operating System it will be UTC), this can be configured in the /config/node-red/settings.js file.

To do so, open the file with a text editor and add the following above the module.exports = { line.

process.env.TZ = "America/Toronto";

The time zone will need to reflect your environment.

Save the file and restart the Node-RED add-on.

Worked well.

4 Likes

Thanks, I have this issue also right now so i googled it and found this thread.

Question: I am running HA OS, and the text you quote say the OS is running in UTC. Is this “by design”, or can i maybe just change the OS timezone to reflect my timezone?

Where can I find the settings.js file in home assistant?

It’s outside of the file editors reach now. It’s one level up where the /media folder is. There is another folder labeled addon_configs. In there you’ll find a node red folder.

Modifying the settings.js file worked for me! Thanks!