Node-RED triggers using UTC instead of local timezone

#1

running node red docker container latest v8, node red version 19.5.
I generated the container using docker-compose, and I have the volumes "/etc/localtime:/etc/localtime:ro" and
"etc/timezone:/etc/timezone:ro" set. I am located in UTC -5 (EST), but all my triggers show a timestamp with standard UTC time, 5 hours later than my local time.
The odd thing is that the timestamps for debug messages show the correct local time, as well if I run the "date" command inside the docker container. So the only thing that seems to have the time wrong timestamp is the triggers.
How can I fix this??? All research I have found is to setup the container with the "/etc/localtime:/etc/localtime:ro", and everything should work fine. But I'm already set up that way, and I've rebuilt the container multiple times and I'm having the same problem. What else can I do??

0 Likes

#2

I even went as far as to creating a flow that displays the date/time, and it displays the correct time.
It almost seems to be specifically a UI issue. I would hate to use this system if it can't display proper timestamps.
This is driving me insane!!!
Here's a link to what I am talking about specifically -

0 Likes

#3

I am on my phone and for some reason can't see your image clearly. What type is the node showing the wrong time?

0 Likes

#4

Urm, yes - that is not a trigger node as you said in your first post. Please let us know exactly what node that comes from. Most likely, this is an issue with the node. You might want to try a different scheduling node like BigTimer for example.

0 Likes

#5

it's the home assistant "call service" event, specifically "node-red-contrib-home-assistant-websocket", latest version (0.6.1). So I guess that it's an issue with the node itself. You're probably right. The actual event fired at the correct time this morning, the stamp was just wrong.

I am going to file a bug report with the author.

1 Like

#6

So I resolved this. If anyone else has this problem. It's not a node red issue, it's an issue specific to the home assistant node, and likely specific to that version of "node-red-contrib-home-assistant-websocket".

I installed nodered using a docker-compose file. So when defining the node red container, I found out I had to explicity define my timezone as an environment variable, like this:

  node-red:
    environment:
      - TZ=America/New_York

I re-built the container with the above change & the timestamps for the home assistant nodes are now correct. I worked with the devs for that node and they helped me find this solution.
I decided I'd post the resolution here in case anyone else runs into this issue.

1 Like