EmonSD and time in Node Red?

I’m running the EmonSD 3/5/16 release in an RPi2.
By default, it seems to run on UTC, so I’ve set the timezone to London, and now ‘date’ in the terminal works as expected.
However, In NodeRed when I do -

** var now = new Date(); **
** var hour = now.getHours();**

The hour still seems to be UTC (an hour behind), as shown here in the debug output -

06/07/2016, 09:21:50Debug
msg.payload : Object
{ “d”: “20160706”, “t”: “08:21”, …

where t is the time, built like this -

msg.payload = {“d”:year+month+day,“t”:hour+’:’+minute, …

Any thoughts?

Lee - London time is one hour ahead of UTC so it seems correct to me.

If you ssh into the RPI2 and type in Date , what do you see? This is what I see and it is correct for me (I live near Chicago).

[email protected]:~ $ date
Wed Jul  6 08:20:27 CDT 2016
[email protected]:~ $ 

I have a this javascript code within one of my Node-Red Function nodes that add a timestamp in CDT and in epoch (unix time in milliseconds):

var now = new Date();
msg.payload = now.toString() + "\t" + now.valueOf() + "\t" + msg.payload;

And it outputs a payload like this:

Wed Jul 06 2016 08:51:10 GMT-0500 (CDT)	1467813070211	 gallons:28353.05,delta_gallons:0.09

There are two locations to set the timezone within the emonSD-03May16 Release image. Are both correct for your location?

Hi Jon,

My ‘date’ from the console shows the correct time, it’s the time NodeRed generates is still UTC.

I set the timezone with -

dpkg-reconfigure tzdata

as I’ve done in Debian/Ubuntu for years. Where’s the second place?

on the web side. Go to Setup > My Account

Then under My Profile look for Timezone.

1 Like

Jon,

Thanks for that! Yes, that’s what I was missing. A quick change and a reboot later, the NodeRed time is fixed!

Now to see if that fixes my flow issues…