Servus,
ich will gerade in einem Dashboard ein Datum und eine Zeit auswählen können und ein cron-plus-Node soll an diesem Zeitpunkt eine Message schicken. Gestartet habe ich da mit cron-plus Beispiel "dashboard schedules". Ein Dashboard-text input-Node habe ich in den datetimepicker Mode geschalten und der Spuckt mir jetzt einen Timestamp aus, den ich über einen funktion-Node an den cron-Plus weitergebe. Cron-Plus ist die Zeitzone auf Berlin eingestellt. Cron-Plus übernimmt den Timestamp aber nur mit zwei Stunden Versatz:
Für mich schaut das so aus, als würde der text input Node den Timestamp nicht als UTC ausspucken, sondern lokale Zeit. Cron-Plus würde aber einen UTC-Timestamp erwarten und rechnet den auf lokal um. Ich müsste also in den Funktion-Node den nicht-UTC-Timestamp in einen UTC-umwandeln. Geht das irgendwie?
BTW:
Code Funktions-Node:
msg.payload = {
"command":"add",
"name":"DynamicDates",
"topic":"DynamicDates",
"expression" : msg.payload,
"type":"default"
}
return msg;
Der komplette flow:
Spoiler anzeigen
[
{
"id": "ae22daa47651c088",
"type": "tab",
"label": "Flow 7",
"disabled": false,
"info": "",
"env": []
},
{
"id": "2f8ea9ba.cc26d6",
"type": "comment",
"z": "ae22daa47651c088",
"name": "Demonstrating fixes times as schedule",
"info": "",
"x": 350,
"y": 120,
"wires": []
},
{
"id": "7cbe8cdf.a5b3d4",
"type": "debug",
"z": "ae22daa47651c088",
"name": "time",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 790,
"y": 280,
"wires": []
},
{
"id": "298086f6.37939a",
"type": "inject",
"z": "ae22daa47651c088",
"name": "Get status-all",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "status-all",
"payload": "",
"payloadType": "date",
"x": 290,
"y": 320,
"wires": [
[
"c5be61bb.16781"
]
]
},
{
"id": "a5cda63.977e558",
"type": "function",
"z": "ae22daa47651c088",
"name": "create payload to add 2 dates",
"func": "//let nowPlus30s = (new Date()).addSeconds(30);\n//let nowPlus1min = (new Date()).addSeconds(60);\nlet StartTime = new Date(msg.payload);\nmsg.payload = {\n \"command\":\"add\",\n \"name\":\"DynamicDates\",\n \"topic\":\"DynamicDates\",\n \"expression\" : msg.payload,\n \"type\":\"default\"\n}\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 220,
"wires": [
[
"c5be61bb.16781",
"0f3e8b0a6883e23f"
]
]
},
{
"id": "c5be61bb.16781",
"type": "cronplus",
"z": "ae22daa47651c088",
"name": "Date Sequence and CRON",
"outputField": "payload",
"timeZone": "Europe/London",
"storeName": "file",
"commandResponseMsgOutput": "output2",
"defaultLocation": "",
"defaultLocationType": "default",
"outputs": 2,
"options": [],
"x": 540,
"y": 320,
"wires": [
[
"7cbe8cdf.a5b3d4"
],
[
"fdc49d895c57a6f0"
]
]
},
{
"id": "d90befd2cd71c41d",
"type": "ui_text_input",
"z": "ae22daa47651c088",
"name": "",
"label": "EndTime",
"tooltip": "",
"group": "6d01ec93.b1d374",
"order": 2,
"width": 0,
"height": 0,
"passthru": true,
"mode": "datetime-local",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 180,
"y": 160,
"wires": [
[
"762ea256c0423a27",
"a5cda63.977e558"
]
]
},
{
"id": "762ea256c0423a27",
"type": "debug",
"z": "ae22daa47651c088",
"name": "debug 95",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 400,
"y": 160,
"wires": []
},
{
"id": "0f3e8b0a6883e23f",
"type": "debug",
"z": "ae22daa47651c088",
"name": "debug 97",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 740,
"y": 220,
"wires": []
},
{
"id": "fdc49d895c57a6f0",
"type": "debug",
"z": "ae22daa47651c088",
"name": "cmd Out",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 800,
"y": 320,
"wires": []
},
{
"id": "6d01ec93.b1d374",
"type": "ui_group",
"name": "Datepicker",
"tab": "d4b7c567cab2a428",
"order": 2,
"disp": true,
"width": "12",
"collapse": false,
"className": ""
},
{
"id": "d4b7c567cab2a428",
"type": "ui_tab",
"name": "Datepicker_test",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]