npm install node-red-contrib-simpletime
[{
"id": "9b114162.97a71",
"type": "tab",
"label": "流程1",
"disabled": false,
"info": ""
}, {
"id": "a30a6c48.6e8f",
"type": "ui_tab",
"z": "",
"name": "Temp",
"icon": "dashboard"
}, {
"id": "4c107418.fdb2bc",
"type": "inject",
"z": "9b114162.97a71",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 290,
"y": 200,
"wires": [
["759d788a.a96ee8"]
]
}, {
"id": "759d788a.a96ee8",
"type": "simpletime",
"z": "9b114162.97a71",
"name": "",
"x": 290,
"y": 300,
"wires": [
["647d6b91.8fb724"]
]
}, {
"id": "647d6b91.8fb724",
"type": "function",
"z": "9b114162.97a71",
"name": "DateTime",
"func": "var payload=msg; //get payload\nmsg.payload=\"写入文件时间\"\nmsg.payload=msg.payload+payload.mydate\nmsg.payload=msg.payload+\" \"+payload.mytimes\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 300,
"y": 380,
"wires": [
["e5cf364c.673c28"]
]
}, {
"id": "b2b83e19.728db",
"type": "debug",
"z": "9b114162.97a71",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"x": 310,
"y": 540,
"wires": []
}, {
"id": "e5cf364c.673c28",
"type": "file",
"z": "9b114162.97a71",
"name": "保存时间文件",
"filename": "/home/pi/file/test.txt",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"encoding": "GBK",
"x": 320,
"y": 460,
"wires": [
["b2b83e19.728db"]
]
}]