csuermann / node-red-contrib-presence-faker

Node-RED node that fakes presence in a smart home by switching devices (e.g. lights) on and off at random times.
MIT License
24 stars 2 forks source link

Starting time has 1h offset #26

Closed Robosoc11 closed 3 years ago

Robosoc11 commented 3 years ago

Dear Cornelius,

I seem to have troubles with the clock in my system. I am new to Node-RED and your presence-faker and I was just doing initial tests. First I wanted to post, that my presence-faker-node would not send messages - although successfully deployed and enabled. But then I was distracted for a while by a business call, which was good, because 1h hour later I learned, that the presence-faker was doing its job, but with 1h delay. But why ?

image

In the debugging window you see what I find odd: Node-RED is putting the correct timestampt for this message (my local time was 10:17:00 AM when that alert appeared). So I would say that my system is set up correctly. However, as you see within the debug-message the time-window for the faker was set to 09:17 AM thought.

Any recommendations on where to look at or what to do?

As you and I are both from Germany, I do not expect that this is a bug in your code, but rather a wrong setting on my server...But on the other hand since Node-RED uses the correct time, I don't know what to do. Of cause I do know, that I could consider a offset time of 1 hour when setting up the faker, but that seems to be a lousy workaround.

BR, Sven

csuermann commented 3 years ago

Hi @Robosoc11,

Could you please share the debug output generated by this simple flow?

[{"id":"bc3d8224.38cea","type":"inject","z":"7ecdfb0b.fa7794","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":810,"y":860,"wires":[["f528217.ce14ae"]]},{"id":"f528217.ce14ae","type":"function","z":"7ecdfb0b.fa7794","name":"now","func":"const now = new Date()\n\nreturn {\n payload: {\n now_utc: now.toISOString(),\n now_local: now.toString()\n }\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":970,"y":860,"wires":[["dc36b050.b9127"]]},{"id":"dc36b050.b9127","type":"debug","z":"7ecdfb0b.fa7794","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1130,"y":860,"wires":[]}]

Robosoc11 commented 3 years ago

Thank you for the extrem quick response! Sure, here it is:

1/19/2021, 12:00:32 PMnode: dc36b050.b9127 msg.payload : Object object now_utc: "2021-01-19T11:00:32.101Z" now_local: "Tue Jan 19 2021 11:00:32 GMT+0000 (Coordinated Universal Time)"

csuermann commented 3 years ago

Thanks, I think that confirms my hypothesis of your server setting being set to the UTC timezone

This is the output of the test flow on my system: image

Is your Node-RED running on the same machine as your browser or a different one?

Robosoc11 commented 3 years ago

Thank you so far.

My NR is running on a linux based Timberwolf server (home automation server) and my browser is on a windows system. Within the servers time setting there is a page saying following (Server = Timberwolf, client = Windows Browser) image

Robosoc11 commented 3 years ago

so I guess the mistake may be in the deployment of my Node-Red container process...maybe I need to set some environment differently.

csuermann commented 3 years ago

That would be my guess, too. Let me know if you managed to solve it somehow. Could be interesting for others, too.

Robosoc11 commented 3 years ago

Problem solved... I found the solution in the Timberwolf-Forum, but it my occure on other Docker-Installations as well, so here is what I did:

Duplicate Container with additional ENV-Variable name=TZ value=Europe/Amsterdam And after deployment I deleted the "old" container...all settings, bindings and panels alived :-)