[
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "Zeiterfassung",
"disabled": false,
"info": ""
},
{
"id": "b26933f958ba08fa",
"type": "loxone-miniserver",
"host": "192.168.180.4",
"port": "80",
"enctype": "0",
"active": true,
"keepalive": "30000"
},
{
"id": "b39c4dabe029faa7",
"type": "ftp",
"host": "192.168.180.2",
"port": "",
"secureOptions": "",
"user": "admin",
"connTimeout": "",
"pasvTimeout": "",
"keepalive": ""
},
{
"id": "55e6eda6553de71e",
"type": "ftp",
"host": "192.168.180.4",
"port": "",
"secureOptions": "",
"user": "admin",
"connTimeout": "",
"pasvTimeout": "",
"keepalive": ""
},
{
"id": "ab58071fd90377e1",
"type": "loxone-control-in",
"z": "f6f2187d.f17ca8",
"name": "Zeiterfassung Loxone",
"miniserver": "b26933f958ba08fa",
"control": "1b91dde5-0091-d0d2-ffffcadbda335bbc",
"state": "1b91dde5-0091-d0d2-ffffcadbda335bbc",
"x": 160,
"y": 180,
"wires": [
[
"e47484bdc1f8edf6"
]
]
},
{
"id": "8ffc98013db68e3c",
"type": "file",
"z": "f6f2187d.f17ca8",
"name": "Zeiterfassung",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": true,
"overwriteFile": "false",
"encoding": "none",
"x": 1140,
"y": 180,
"wires": [
[
"06a74048ccdaae96"
]
]
},
{
"id": "06a74048ccdaae96",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Zeiterfassung",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 180,
"wires": []
},
{
"id": "e47484bdc1f8edf6",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Create filename and prepare data to send.",
"func": "var Header = "Mitarbeiter;Datum;Arbeitsanfang;Pause_Anfang;Pause_Ende;Arbeitsende;Gesamtstunden;Pausenzeit;";\nvar date = global.get("date");\nmsg.filename = "/home/Zeiterfassung/Zeiterfassung-" + date + ".csv";\nglobal.set("filename", msg.filename);\nif (msg.payload === "Keine neue Meldung")\n{\n node.status({ fill: "red", shape: "ring", text: "No write to Logfile"});\n}\nelse if (msg.payload === "Create Header")\n{\n msg.payload = Header;\n node.status({ fill: "yellow", shape: "ring", text: "Send: " + msg.payload + " to " + msg.filename });\n return msg;\n}\n\nelse\n{\n let oldstring = msg.payload\n let newstring = oldstring.replace(" ", ";");\n var message = newstring;\n var array_message = message.split(';');\n var messageTyp = array_message[1];\n var sendMessage;\n switch (messageTyp) {\n case "Arbeitsanfang":\n sendMessage = array_message[0] + ";" + array_message[2] + ";" + array_message[3] + ";" + "" + ";" + "" + ";" + "" + ";";\n break;\n case "Pause_Anfang":\n sendMessage = array_message[0] + ";" + array_message[2] + ";" + "" + ";" + array_message[3] + ";" + "" + ";" + "" + ";";\n break;\n case "Pause_Ende":\n sendMessage = array_message[0] + ";" + array_message[2] + ";" + "" + ";" + "" + ";" + array_message[3] + ";" + "" + ";";\n break;\n case "Arbeitsende":\n sendMessage = array_message[0] + ";" + array_message[2] + ";" + "" + ";" + "" + ";" + "" + ";" + array_message[3] + ";";\n break;\n default:\n console.log('Message not correct!');\n }\n //msg.payload =messageTyp;\n msg.payload = sendMessage;\n node.status({ fill: "green", shape: "ring", text: "Send: " + msg.payload + " to " + msg.filename});\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 800,
"y": 180,
"wires": [
[
"8ffc98013db68e3c"
]
]
},
{
"id": "365eed40b0ad1c22",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Create date",
"func": "// Create Date\nfunction getDate() {\n var date;\n date = new Date();\n date = (date.getFullYear() + '-' +\n ('00' + (date.getMonth() + 1)).slice(-2) + '-' +\n ('00' + date.getDate()).slice(-2)); // + " " +\n //('00' + date.getHours()).slice(-2) + ':' +\n //('00' + date.getMinutes()).slice(-2) + ':' +\n //('00' + date.getSeconds()).slice(-2));\n return date;\n}\nglobal.set("date", getDate());\nmsg.payload = global.get("date");\nnode.status({ fill: "blue", shape: "ring", text: "Date:" + msg.payload });\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1130,
"y": 280,
"wires": [
[
"a3393e884408e6b6"
]
]
},
{
"id": "ed642fa2801e5c59",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "01 00 * * *",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 280,
"wires": [
[
"365eed40b0ad1c22",
"c9417d9c03da30e1"
]
]
},
{
"id": "a3393e884408e6b6",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Create file",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1350,
"y": 280,
"wires": []
},
{
"id": "a8c160c43ca89b82",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Create a date every night",
"info": "",
"x": 170,
"y": 240,
"wires": []
},
{
"id": "17154cade8693194",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Write message to csv file",
"info": "",
"x": 490,
"y": 140,
"wires": []
},
{
"id": "b889615733d11296",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Delete not longer used files",
"info": "",
"x": 170,
"y": 780,
"wires": []
},
{
"id": "130ab3cb7a8f399b",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": " /home/Zeiterfassung/Zeiterfassung-date1.csv",
"payloadType": "str",
"x": 130,
"y": 820,
"wires": [
[
"764d86174c871be2"
]
]
},
{
"id": "99425c3973701dba",
"type": "exec",
"z": "f6f2187d.f17ca8",
"command": "cp",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Delete old files",
"x": 660,
"y": 820,
"wires": [
[
"b00a6602272558f2"
],
[
"b00a6602272558f2"
],
[
"b00a6602272558f2"
]
]
},
{
"id": "b00a6602272558f2",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Delete file",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1340,
"y": 820,
"wires": []
},
{
"id": "764d86174c871be2",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Delete last month",
"func": "msg.payload = global.get("filename") + " /home/ZeiterfassungBackup/"; \nnode.status({ fill: "blue", shape: "ring", text: "Filename: " + msg.payload });\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 820,
"wires": [
[
"99425c3973701dba"
]
]
},
{
"id": "56c3930778c0b9c6",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Send file to Loxone via ftp push",
"info": "",
"x": 190,
"y": 340,
"wires": []
},
{
"id": "5c46346c370c92ef",
"type": "ftp in",
"z": "f6f2187d.f17ca8",
"d": true,
"ftp": "55e6eda6553de71e",
"operation": "put",
"filename": "",
"localFilename": "",
"name": "FTP push",
"x": 900,
"y": 380,
"wires": [
[
"9946757f06525702"
]
]
},
{
"id": "9946757f06525702",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "FTP push",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1340,
"y": 380,
"wires": []
},
{
"id": "efb680522d1a3c15",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "59 23 * * *",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 380,
"wires": [
[
"6835290c993b3f95"
]
]
},
{
"id": "6835290c993b3f95",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Prepare file to send via ftp",
"func": "var date = global.get("date");\nmsg.localFilename = "/home/Zeiterfassung/Zeiterfassung-" + date + ".csv";\nmsg.filename = "/log/Zeiterfassung-" + date + ".csv";\nnode.status({ fill: "green", shape: "ring", text: "Send file " + msg.filename + " to Loxone"});\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 380,
"wires": [
[
"5c46346c370c92ef"
]
]
},
{
"id": "03f2466aa9064ecc",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "ToDo delete old files",
"info": "",
"x": 150,
"y": 740,
"wires": []
},
{
"id": "9f6b78c8079eb7e5",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Credentials are used in: LOXONE node & FTP node",
"info": "",
"x": 530,
"y": 40,
"wires": []
},
{
"id": "fea06156f46aa34a",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Miniserver Online",
"info": "",
"x": 140,
"y": 40,
"wires": []
},
{
"id": "e025a05ea34e3448",
"type": "loxone-online",
"z": "f6f2187d.f17ca8",
"name": "Miniserver online test",
"miniserver": "b26933f958ba08fa",
"x": 160,
"y": 80,
"wires": [
[
"a661c7be0cb3d2c7"
]
]
},
{
"id": "065887afe4a49d88",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Zeiterfassung",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 80,
"wires": []
},
{
"id": "a661c7be0cb3d2c7",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Miniserver status",
"func": "if (msg.payload === true) \n{\n node.status({ fill: "green", shape: "dot", text: "Miniserver state: ONLINE" });\n}\nelse\n{\n node.status({ fill: "red", shape: "dot", text: "Miniserver state: OFFLINE"});\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 80,
"wires": [
[
"065887afe4a49d88"
]
]
},
{
"id": "0e1d30c4b550f981",
"type": "loxone-control-out",
"z": "f6f2187d.f17ca8",
"name": "Send live bit",
"miniserver": "b26933f958ba08fa",
"control": "1916ba08-0024-b9bf-ffff8171435a2295",
"x": 1350,
"y": 600,
"wires": []
},
{
"id": "a7be47ac10c75ffa",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Timer keep alive",
"func": "var time = 2; // Minutes Timer\ntime = time + 1;\nvar delay = 1000; // (1000 = 1 Second)\nfunction getDate() {\n var date;\n date = new Date();\n date = (\n ('00' + date.getHours()).slice(-2) + ':' +\n ('00' + date.getMinutes()).slice(-2) + ':' +\n ('00' + date.getSeconds()).slice(-2));\n return date;\n}\nif (msg.payload === 1) \n{\n timer();\n sendMessage();\n}\n\nfunction timer() {\n time = time - 1;\n setTimeout(function () {\n if (time > 0 ) {\n timer();\n }\n }, delay);\n if (time > 0) {\n node.status({ fill: "green", shape: "ring", text: "Send live bit " + time + " seconds" });\n }\n if (time === 0) {\n node.status({ fill: "yellow", shape: "dot", text: "Pause" });\n msg.payload = 0;\n sendMessage();\n }\n}\n// Send Json Object\nfunction sendMessage() {\n node.send(msg);\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 600,
"wires": [
[
"0e1d30c4b550f981"
]
]
},
{
"id": "fe1afb0cf8e75c81",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "6",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 130,
"y": 600,
"wires": [
[
"a7be47ac10c75ffa"
]
]
},
{
"id": "ddf8b91a8a6a41f7",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Send to Loxone a live bit",
"info": "",
"x": 170,
"y": 560,
"wires": []
},
{
"id": "50e97338aa0af223",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Username Passwort Loxone eintragen",
"info": "",
"x": 870,
"y": 340,
"wires": []
},
{
"id": "a3caa7ef312b56b6",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Username Passwort Loxone eintragen",
"info": "",
"x": 210,
"y": 140,
"wires": []
},
{
"id": "459c58ac4d938079",
"type": "e-mail",
"z": "f6f2187d.f17ca8",
"server": "smtp.strato.de",
"port": "465",
"authtype": "BASIC",
"saslformat": true,
"token": "oauth2Response.access_token",
"secure": true,
"tls": false,
"name": "[email protected]",
"dname": "",
"x": 1390,
"y": 480,
"wires": []
},
{
"id": "1dba840fd641b6f9",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Email Client",
"info": "",
"x": 130,
"y": 440,
"wires": []
},
{
"id": "8af62cd6296b4dd4",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "59 23 * * *",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 480,
"wires": [
[
"243c0a6aa4d22a7a"
]
]
},
{
"id": "76c2eb11112a3e1e",
"type": "file in",
"z": "f6f2187d.f17ca8",
"name": "get file",
"filename": "filename",
"filenameType": "msg",
"format": "",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 650,
"y": 480,
"wires": [
[
"4f5f117e54b04806"
]
]
},
{
"id": "4f5f117e54b04806",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "write email",
"func": "var file = msg.filename; // create local file variable for convenient reference\nvar d = new Date(); // create current date object for the time string\nvar tstring = d.toString().substring(0,4) + d.toString().substring(15,21);\n//msg.cc = "[email protected]";\n//msg.cc = "[email protected]"\nmsg.attachments =\n { filename : file.substring(file.lastIndexOf('/')+1,file.length),\n content : msg.payload }; // content should be a file binary buffer\n \nmsg.topic = "Tagesdbericht der Zeiterfassung vom: " + tstring; // email subject\n\nmsg.payload = "Dateianhang: \" + msg.attachments.filename + \""; // email body\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 850,
"y": 480,
"wires": [
[
"459c58ac4d938079",
"59ea733acce673ef"
]
]
},
{
"id": "243c0a6aa4d22a7a",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Create file name",
"func": "msg.filename = global.get("filename");\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 480,
"wires": [
[
"76c2eb11112a3e1e"
]
]
},
{
"id": "59ea733acce673ef",
"type": "e-mail",
"z": "f6f2187d.f17ca8",
"server": "smtp.strato.de",
"port": "465",
"authtype": "BASIC",
"saslformat": true,
"token": "oauth2Response.access_token",
"secure": true,
"tls": false,
"name": "[email protected]",
"dname": "",
"x": 1390,
"y": 540,
"wires": []
},
{
"id": "c9417d9c03da30e1",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Create Headline",
"func": "msg.payload = "Create Header";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 240,
"wires": [
[
"e47484bdc1f8edf6"
]
]
}
]
Content type
Image
Digest
sha256:89dfaf83e…
Size
152.9 MB
Last updated
almost 3 years ago
docker pull wagopfc/rme-zeiterfassung:1.0.0