Help with "openweathermap" node

I am playing with this node and have found a bump in my desire.

The node puts out a nice message with a lot of data. Not a problem.

It has things like "Sunrise" and "Sunset" times as numbers. Again: Fair enough.
What I am failing to find/see is the "now" timestamp in the same format as the sunrise/set times.

Why?

Well, to be adventurous I am wanting to change the icons (where possible) between day and night.

I was going to do complicated stuff but then noticed the sunrise/set times in the message.
But! No "now".

Am I missing any elephants?

What is the format of the sunrise/set times, can you post an example.

Sorry.

Sunrise: 1603998077

One of those magic numbers.

I'm now looking for a now value in the message which I can use to compare.

eg code:

if ((now > sunrise) && (now < sunset))
{
   //  it is daytime
}
else
//  it is night time

But that will need a now part of the message, which I am not able to resolve - if it exists at all.

This is the entire output - example:

{"_msgid":"b6f65f3.c6627a","payload":{"id":804,"weather":"Clouds","detail":"overcast clouds","icon":"04d","tempk":282.15,"tempc":9,"temp_maxc":9,"temp_minc":9,"humidity":100,"pressure":1011,"maxtemp":282.15,"mintemp":282.15,"windspeed":2.6,"winddirection":30,"location":"Cooma","sunrise":1603998077,"sunset":1604046769,"clouds":90,"description":"The weather in Cooma at coordinates: -36.23, 149.13 is Clouds (overcast clouds)."},"topic":"","_event":"node:f9c0e98d.a5a3c","icon":"<i class=\"fa fa-refresh fa-spin\"></i>","background":"#333333","font":"red","location":{"lon":149.13,"lat":-36.23,"city":"Cooma","country":"AU"},"data":{"coord":{"lon":149.13,"lat":-36.23},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"stations","main":{"temp":282.15,"feels_like":280.11,"temp_min":282.15,"temp_max":282.15,"pressure":1011,"humidity":100},"visibility":2000,"wind":{"speed":2.6,"deg":30},"clouds":{"all":90},"dt":1604006093,"sys":{"type":1,"id":9520,"country":"AU","sunrise":1603998077,"sunset":1604046769},"timezone":39600,"id":2170577,"name":"Cooma","cod":200},"time":"2020-10-29T21:14:53.000Z","title":"Current Weather Information","description":"Current weather information at coordinates: -36.23, 149.13"}

Well that timestamp is in seconds, so if you are comparing it with a timestamp from for example simpletime (which is in milliseconds), then multiply it by 1000, so it becomes 1603998077000

well, ok. That's good to know.

What is (now) confusing me is there is a clouds.dt field which I suspect is now.

But I am at a loss which node will convert it to a human readable value to confirm this.

Because if that is true - is the now time, I can use those three numbers.

I get the message (eg: the one I posted) and put it through the moment node and I see the time now - local format.

But I am not getting anywhere when I try to convert the sunrise and sunset numbers to a human readable time format. And I know it should be easy peasy.

I can't see a clouds.dt field in the data that you posted...

data.dt sorry.

(This is not going to be a good day)

But when I put it through the moment node I only get the number I injected back out.

I can't see that either!

Hmmmm......

Screenshot from 2020-10-30 08-34-35

I click on the top copy icon and I hope to get the entire message.

Screenshot from 2020-10-30 08-42-22

Yes, it appears to be a recent timestamp, again, in seconds.
Have you checked the openweathermap api docs, to see what that timestamp relates to, ie - observation time, etc

I think it is the expiration time: 23:55.

I'll go away and read them now. I was just looking at the message/s being sent out and looking for the values.

You are right, I probably should have read the docs first. But I guess I was only at a reconecence level of getting this done.

The timestamp of the request is

   payload.data.dt

I believe.

So why is it I only get data.dt when I copy the path? and not payload.data.dt

Because i copied it from you example, which was set in msg.payload/

The field is "Time of data calculation"

(That wasn't meant against you. It was a sort of rhetorical question)

I just copied the path and pasted it in the field of the moment node.

I'm working on it now.

It doesn't work.

Input property, msg.payload.data.dt, does NOT exist. Output has been set to NOW.

so it is msg.data.dt.

Don't worry. I'll keep trying.

I would of thought that they provide the sunrise for the lat and long location using UTC

Just found it.

data.dt is the time of publishing. So it isn't now. It is 23:33:28 (repeatedly.)

So I am still looking for a now timestamp in the message - if it exists.
Otherwise I guess I will have to create one on the message sent.

The sunrise timestamp is a UTC time stamp. Just return your time in UTC

I think I got it working. Or at least: It seems to be.

Before the node I put a change node and set msg.now as timestamp.

Out of the node I have this:

Example.

[{"id":"5cdd808a.0d6db8","type":"switch","z":"10fde8b5.a8a82f","name":"","property":"now","propertyType":"msg","rules":[{"t":"lt","v":"payload.sunrise","vt":"msg"},{"t":"gt","v":"payload.sunset","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":1420,"y":750,"wires":[["c125972d.f52058"],["c125972d.f52058"],["8eb3fc7c.41e288"]]},{"id":"c125972d.f52058","type":"change","z":"10fde8b5.a8a82f","name":"Darksky cloudy (night)","rules":[{"t":"set","p":"payload","pt":"msg","to":"<i class=\"wi-darksky-partly-cloudy-night\"></i>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1620,"y":730,"wires":[[]]},{"id":"8eb3fc7c.41e288","type":"change","z":"10fde8b5.a8a82f","name":"Darksky cloudy","rules":[{"t":"set","p":"payload","pt":"msg","to":"<i class=\"wi wi-darksky-cloudy\"></i>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1600,"y":770,"wires":[[]]}]

The switch node is repeated for all the different types of output so I have a day and night icon used.

Thanks to all who participated.
Sorry folks. As I have said many time: I sometimes need to discuss it with others so I can see things better.

That's not to say the help wasn't useful. It showed me a couple of mistakes I always seem to make.

So, now all is good for now.

(I can paste a bigger version of the code if you want.)
Or a screen shot.

Maybe you should consider buying a rubber duck (or something similar).