Hi,
I'm new with node-red and I'm struggling with sunset / sunrise from openweathermap.
I getting sunset / sunrise from openweathermap and via a function node, I convert the epoch to a more readable format (just our date/time notation). These sunset / sunrise times are correct.
(the function node flows to the debug node) When I however display the same values (or so I think) in the dashboard, they give another time ??? (function node also flows to dashboard text) What is wrong here ??
The flow
[
{
"id": "ce663cc18e6dc677",
"type": "debug",
"z": "af5f49817f279b04",
"name": "Sunrise",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.sunrise",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 20,
"wires": []
},
{
"id": "4ba3d5599ab1f01b",
"type": "function",
"z": "af5f49817f279b04",
"name": "",
"func": "msg.payload.sunrise = new Date(1000*msg.payload.sunrise);\nmsg.payload.sunset = new Date(1000*msg.payload.sunset);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 500,
"y": 60,
"wires": [
[
"ce663cc18e6dc677",
"25046fb302401236",
"425820baaa357571",
"01a7855bb7f39b06"
]
]
},
{
"id": "25046fb302401236",
"type": "debug",
"z": "af5f49817f279b04",
"name": "Sunset",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.sunset",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 120,
"wires": []
},
{
"id": "e0e72015ad303d02",
"type": "openweathermap",
"z": "af5f49817f279b04",
"name": "Weer Wommelgem",
"wtype": "current",
"lon": "4.53",
"lat": "51.2",
"city": "",
"country": "",
"language": "en",
"credentials": {},
"x": 310,
"y": 60,
"wires": [
[
"4ba3d5599ab1f01b"
]
]
},
{
"id": "49594c6e8af5fda4",
"type": "inject",
"z": "af5f49817f279b04",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 60,
"wires": [
[
"e0e72015ad303d02"
]
]
},
{
"id": "01a7855bb7f39b06",
"type": "ui_text",
"z": "af5f49817f279b04",
"group": "4ad74a636bd61949",
"order": 2,
"width": 0,
"height": 0,
"name": "lbl sunrise",
"label": "SunRise",
"format": "{{msg.payload.sunrise}}",
"layout": "row-spread",
"className": "",
"x": 860,
"y": 40,
"wires": []
},
{
"id": "425820baaa357571",
"type": "ui_text",
"z": "af5f49817f279b04",
"group": "4ad74a636bd61949",
"order": 3,
"width": 0,
"height": 0,
"name": "lbl sunset",
"label": "SunSet",
"format": "{{msg.payload.sunset}}",
"layout": "row-spread",
"className": "",
"x": 860,
"y": 80,
"wires": []
},
{
"id": "4ad74a636bd61949",
"type": "ui_group",
"name": "Temperature",
"tab": "8f8146e562ec77a5",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "8f8146e562ec77a5",
"type": "ui_tab",
"name": "Monitoring",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
Any help greatly appreciated.
Tkx !
Leo