Openweather node and dates

Hi,

I'm new in Node red.

I'am trying to transform a date coming from the openweather node (sunset and sunrise) in text in order to display it using a texte node . I tried the comment node, and a lot of java script functions , but no success until now.

Help will be welcome.

jean-Louis - Paris France.

Welcome.

You try to display something in a text node. Is this the dashboard text node ?

The comment node is only used to display a comment in the editor.
Did you read the documentation on how to work with messages ?

The dashboard- text-node (by default) accepts msg.payload as input. Although I don't know what the openweather node produces in its output, the goal should be to produce msg.payload with the value you want. This can be done with the change node. The documentation explains how to do this.

Start by feeding the weather node into a debug node to see what the format of the data is. Then, having read the documentation pointed to by @bakman2 you will probably be able to use a Change node to pick out the data you want and put it in msg.payload for the Text node.

Hi Bakman2,

Thanks for you quick answer. Yes it is the dashboard text node

Sorry, it was the moment node I was talking about.

The open weather node produces on top of many others two dates and time - sunset and sunrise. these dates are in Unix format I think (number of milliseconds since the 1st of January 1970). I just want to convert these dates in a human readable format, may be by using the change node.

Thanks.

Hi Colin

Can you have a look at the response I did to bakman2.

Thanks.

Bakman,

Here is the value of the date sent by open weather :slight_smile:

sunrise: 1572936226

sunset: 1572971108

As you had already worked out I think the moment node would be one way of converting them to human readable form. You will need to use a Change node to move the data you want into the right place in the message for the moment node. Have you read the documentation you were pointed to? Look at the info tab of the moment node to see how it expects the data.