[ { "id": "inject_start_auth", "type": "inject", "z": "a1adc89a7a1ee0f9", "name": "Start Auth Request", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "3", "topic": "", "payload": "", "payloadType": "date", "x": 150, "y": 60, "wires": [ [ "prepare_auth_payload", "de3df9768f466b04" ] ] }, { "id": "prepare_auth_payload", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Prepare Auth Start Payload", "func": "// Importiere crypto-js aus dem globalen Kontext\nconst crypto = global.get('cryptojs');\n\n// Erstelle ein zufälliges 12-Byte nonce und wandle es in Base64 um\nconst nonce = Buffer.from(crypto.lib.WordArray.random(12).toString(crypto.enc.Base64)).toString('base64');\n\n// Bereite den Payload für den /auth/start Request vor\nmsg.payload = {\n payload: {\n username: \"user\",\n nonce: nonce\n }\n};\n\n// Speichere nonce temporär, um es später zu nutzen\nglobal.set('clientNonce', nonce);\n\nreturn msg;\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 60, "wires": [ [ "13afbbee146e4b5b" ] ] }, { "id": "process_auth_response", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Process Auth Start Response", "func": "global.set('transactionId', msg.payload.transactionId);\nglobal.set('serverNonce', msg.payload.nonce);\nglobal.set('salt', msg.payload.salt);\nglobal.set('rounds', msg.payload.rounds);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 980, "y": 60, "wires": [ [ "prepare_auth_finish_payload" ] ] }, { "id": "prepare_auth_finish_payload", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Prepare Auth Finish Payload", "func": "// Hole die notwendigen Module aus dem globalen Kontext\nconst crypto = global.get('cryptojs'); \nconst nodeCrypto = global.get('nodeCrypto');\n\n// Werte aus globalen Variablen abrufen\nconst clientNonce = global.get('clientNonce');\nconst serverNonce = global.get('serverNonce');\nconst transactionId = global.get('transactionId');\nconst salt = global.get('salt');\nconst rounds = global.get('rounds');\n\n// Passwort (muss ersetzt werden durch das echte Passwort)\nconst password = \"PASSWORD\"; // Beispiel-Passwort (ersetzen!)\n\n\n// Berechnung des PBKDF2 Hashes mit den empfangenen Werten\nconst saltBytes = Buffer.from(salt, 'base64'); // Salt dekodieren\nconst key = nodeCrypto.pbkdf2Sync(password, saltBytes, rounds, 32, 'sha256'); // PBKDF2 mit SHA-256 und 32-Byte Key\n\n// Berechnung des Client Key und Server Key\nconst clientKey = nodeCrypto.createHmac('sha256', key).update(\"Client Key\").digest();\nconst serverKey = nodeCrypto.createHmac('sha256', key).update(\"Server Key\").digest();\n\n\n// Berechnung des Stored Key (Hash des Client Keys)\nconst storedKey = nodeCrypto.createHash('sha256').update(clientKey).digest();\n\n\n// Erstelle den Auth-String basierend auf den erhaltenen Werten\nconst authMessage = `n=user,r=${clientNonce},r=${serverNonce},s=${salt},i=${rounds},c=biws,r=${serverNonce}`;\n\n\n// Berechne Client Signature (Stored Key + Auth-String)\nconst clientSignature = nodeCrypto.createHmac('sha256', storedKey).update(authMessage).digest();\n\n\n// Berechnung des `proof` durch XOR des Client Keys und Client Signature\nconst proofBytes = Buffer.alloc(clientKey.length);\nfor (let i = 0; i < clientKey.length; i++) {\n proofBytes[i] = clientKey[i] ^ clientSignature[i];\n}\nconst proof = proofBytes.toString('base64');\n\n\n// Berechnung des Protocol Keys (Session Key) basierend auf dem Stored Key, Auth-Message und Client Key\nconst sessionKeyHmac = nodeCrypto.createHmac('sha256', storedKey).update(\"Session Key\");\nsessionKeyHmac.update(authMessage); // Füge `authMessage` zur Berechnung hinzu\nsessionKeyHmac.update(clientKey); // Füge `clientKey` zur Berechnung hinzu\nconst protocolKey = sessionKeyHmac.digest();\n\n\n// Speichere den Protocol Key für den nächsten Schritt (auth/create_session)\nglobal.set('protocolKey', protocolKey);\n\n// Erstelle den Payload für den /auth/finish Request\nmsg.payload = {\n payload: {\n transactionId: transactionId,\n proof: proof\n }\n};\n\n// Gebe die berechneten Werte in Debug-Nodes aus\nreturn msg;\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 120, "wires": [ [ "6649fbbd23f5d4db" ] ] }, { "id": "process_auth_finish_response", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Process Auth Finish Response", "func": "// Speichere den token und signature in globalen Variablen\nglobal.set('sessionToken', msg.payload.token);\nglobal.set('serverSignature', msg.payload.signature);\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 990, "y": 120, "wires": [ [ "prepare_create_session_payload" ] ] }, { "id": "13afbbee146e4b5b", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "auth", "keepAuth": false, "operationData": { "id": "post_auth_start", "hasOperationId": true, "path": "/auth/start", "method": "post" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "payload body": { "name": "payload", "isActive": true, "required": true, "type": "editor:payload", "collapsed": false, "parameters": { "username": { "name": "username", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.username" }, "nonce": { "name": "nonce", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.nonce" } }, "in": "body" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 4, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "400", "text": "Invalid user" }, { "code": "403", "text": "User is locked" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [], "_version": "2.1.3", "x": 640, "y": 60, "wires": [ [ "process_auth_response" ], [], [], [] ] }, { "id": "6649fbbd23f5d4db", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "auth", "keepAuth": false, "operationData": { "id": "post_auth_finish", "hasOperationId": true, "path": "/auth/finish", "method": "post" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "payload body": { "name": "payload", "isActive": true, "required": true, "type": "editor:payload", "collapsed": false, "parameters": { "transactionId": { "name": "transactionId", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.transactionId" }, "proof": { "name": "proof", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.proof" } }, "in": "body" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 2, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "400", "text": "Authentication failed" } ], "responseAsPayload": false, "debugMode": false, "headers": [], "_version": "2.1.3", "x": 640, "y": 120, "wires": [ [ "process_auth_finish_response" ], [] ] }, { "id": "prepare_create_session_payload", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Prepare Auth Create Session Payload", "func": "// Hole die notwendigen Module aus dem globalen Kontext\nconst nodeCrypto = global.get('nodeCrypto');\n\n// Werte aus globalen Variablen abrufen\nconst transactionId = global.get('transactionId');\nconst sessionToken = global.get('sessionToken');\nconst protocolKey = global.get('protocolKey');\n\n// Prüfe, ob der protocolKey verfügbar ist\nif (!protocolKey) {\n node.error(\"Protocol Key ist nicht definiert. Stelle sicher, dass dieser korrekt berechnet wurde.\", msg);\n return null;\n}\n\n// Generiere ein zufälliges IV (Initialisierungsvektor) mit 16 Byte\nconst iv = nodeCrypto.randomBytes(16);\n\n\ntry {\n // Verschlüssele den `sessionToken` mit `aes-256-gcm`\n const cipher = nodeCrypto.createCipheriv('aes-256-gcm', protocolKey, iv);\n const encrypted = Buffer.concat([cipher.update(sessionToken, 'utf8'), cipher.final()]);\n const authTag = cipher.getAuthTag();\n\n // Erstelle den Payload für den /auth/create_session Request mit der erwarteten Struktur\n msg.payload = {\n payload: {\n transactionId: transactionId,\n iv: iv.toString('base64'),\n tag: authTag.toString('base64'),\n payload: encrypted.toString('base64') // Verschlüsseltes Token als Base64-String\n }\n };\n\n // Debug-Ausgaben zur Überprüfung der verschlüsselten Werte\n\n\n} catch (err) {\n node.error(`Fehler bei der Verschlüsselung: ${err.message}`, msg);\n return null;\n}\n\nreturn msg;\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 370, "y": 160, "wires": [ [ "5172c965ff1b6ef5" ] ] }, { "id": "process_create_session_response", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Process Create Session Response", "func": "// Speichere die sessionId in einer globalen Variablen\nglobal.set('sessionId', msg.payload.sessionId);\n\nmsg.headers = {\n \"Authorization\": \"Session \" + global.get('sessionId') // Nutze die global gespeicherte sessionId\n};\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1000, "y": 160, "wires": [ [ "5eb88de89e54e85d" ] ] }, { "id": "5172c965ff1b6ef5", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "auth", "keepAuth": false, "operationData": { "id": "post_auth_create_session", "hasOperationId": true, "path": "/auth/create_session", "method": "post" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "payload body": { "name": "payload", "isActive": true, "required": true, "type": "editor:payload", "collapsed": false, "parameters": { "transactionId": { "name": "transactionId", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.transactionId" }, "iv": { "name": "iv", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.iv" }, "tag": { "name": "tag", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.tag" }, "payload": { "name": "payload", "isActive": true, "required": true, "type": "msg", "value": "payload.payload.payload" } }, "in": "body" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 2, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "400", "text": "Authentication failed" } ], "responseAsPayload": false, "debugMode": false, "headers": [], "_version": "2.1.3", "x": 670, "y": 160, "wires": [ [ "process_create_session_response" ], [] ] }, { "id": "811f54e88ede26d8", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "modules", "keepAuth": false, "operationData": { "id": "get_module_list", "hasOperationId": true, "path": "/modules", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": {}, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 2, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 1260, "y": 160, "wires": [ [ "2acfcfe1c226244c" ], [] ] }, { "id": "1175fd15e4f8e00d", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "auth", "keepAuth": false, "operationData": { "id": "post_logout", "hasOperationId": true, "path": "/auth/logout", "method": "post" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": {}, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 1, "responseOutputLabels": [ { "code": "200", "text": "Success" } ], "responseAsPayload": false, "debugMode": false, "headers": [], "_version": "2.1.3", "x": 1650, "y": 160, "wires": [ [ "bfbe0b948dbd3b50" ] ] }, { "id": "2acfcfe1c226244c", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "Session Header", "func": "msg.headers = {\n \"Authorization\": \"Session \" + global.get('sessionId') // Nutze die global gespeicherte sessionId\n};\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1460, "y": 160, "wires": [ [ "1175fd15e4f8e00d", "50264f55f762fb8f" ] ] }, { "id": "bfbe0b948dbd3b50", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 74", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1820, "y": 160, "wires": [] }, { "id": "4c8066838f8d062c", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "processdata", "keepAuth": false, "operationData": { "id": "get_module_process_data_list", "hasOperationId": true, "path": "/processdata/{moduleid}", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "moduleid path": { "name": "moduleid", "isActive": true, "required": true, "type": "str", "value": "devices:local:ac", "in": "path" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 3, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "404", "text": "Module not found" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 690, "y": 220, "wires": [ [ "0d8aad2378a4fd31" ], [], [] ] }, { "id": "a81107f345fa9713", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 76", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1440, "y": 280, "wires": [] }, { "id": "de3df9768f466b04", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 77", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 120, "y": 120, "wires": [] }, { "id": "2a376301979106e5", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "function 29", "func": "var data = {};\n\ndata.solar_panels_power = msg.payload.panel1.solar_panel1_power + msg.payload.panel2.solar_panel2_power + msg.payload.panel3.solar_panel3_power;\n\nreturn {\n payload: data\n};", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1250, "y": 220, "wires": [ [ "a81107f345fa9713", "53fb2b7abbfc4421" ] ] }, { "id": "50264f55f762fb8f", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 10", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1640, "y": 200, "wires": [] }, { "id": "5eb88de89e54e85d", "type": "trigger", "z": "a1adc89a7a1ee0f9", "name": "", "op1": "", "op2": "0", "op1type": "pay", "op2type": "str", "duration": "-5", "extend": false, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 380, "y": 220, "wires": [ [ "4c8066838f8d062c", "2742519a5ad7f941", "0d62c01b3e58eacc", "0a58603e5cfad95f", "29b34622a7c645b3", "3534c00aecd8de8f" ] ] }, { "id": "2742519a5ad7f941", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 11", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 620, "y": 520, "wires": [] }, { "id": "53fb2b7abbfc4421", "type": "influxdb out", "z": "a1adc89a7a1ee0f9", "influxdb": "d5d914b8487bf10a", "name": "InfluxDB pv kostal", "measurement": "kostal", "precision": "", "retentionPolicy": "", "database": "database", "precisionV18FluxV20": "ms", "retentionPolicyV18Flux": "", "org": "armster", "bucket": "pv", "x": 1470, "y": 220, "wires": [] }, { "id": "0d8aad2378a4fd31", "type": "debug", "z": "a1adc89a7a1ee0f9", "name": "debug 12", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 920, "y": 520, "wires": [] }, { "id": "0d62c01b3e58eacc", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "processdata", "keepAuth": false, "operationData": { "id": "get_module_process_data_list", "hasOperationId": true, "path": "/processdata/{moduleid}", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "moduleid path": { "name": "moduleid", "isActive": true, "required": true, "type": "str", "value": "devices:local:pv1", "in": "path" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 3, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "404", "text": "Module not found" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 690, "y": 280, "wires": [ [ "2ef4118f9ff4fb08", "0d8aad2378a4fd31" ], [], [] ] }, { "id": "0a58603e5cfad95f", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "processdata", "keepAuth": false, "operationData": { "id": "get_module_process_data_list", "hasOperationId": true, "path": "/processdata/{moduleid}", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "moduleid path": { "name": "moduleid", "isActive": true, "required": true, "type": "str", "value": "devices:local:pv2", "in": "path" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 3, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "404", "text": "Module not found" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 690, "y": 340, "wires": [ [ "58c89945e0397b82", "0d8aad2378a4fd31" ], [], [] ] }, { "id": "29b34622a7c645b3", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "processdata", "keepAuth": false, "operationData": { "id": "get_module_process_data_list", "hasOperationId": true, "path": "/processdata/{moduleid}", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "moduleid path": { "name": "moduleid", "isActive": true, "required": true, "type": "str", "value": "devices:local:pv3", "in": "path" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 3, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "404", "text": "Module not found" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 690, "y": 400, "wires": [ [ "b33573468e3ac7ab", "0d8aad2378a4fd31" ], [], [] ] }, { "id": "2ef4118f9ff4fb08", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "function 7", "func": "var data = {};\n\ndata.solar_panel1_voltage = msg.payload[\"0\"].processdata[2].value;\ndata.solar_panel1_current = msg.payload[\"0\"].processdata[0].value;\ndata.solar_panel1_power = msg.payload[\"0\"].processdata[1].value;\n\nreturn {\n topic: \"panel1\",\n payload: data\n};", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 920, "y": 280, "wires": [ [ "a81107f345fa9713", "53fb2b7abbfc4421", "df1cec0fae2e13b2" ] ] }, { "id": "58c89945e0397b82", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "function 30", "func": "var data = {};\n\ndata.solar_panel2_voltage = msg.payload[\"0\"].processdata[2].value;\ndata.solar_panel2_current = msg.payload[\"0\"].processdata[0].value;\ndata.solar_panel2_power = msg.payload[\"0\"].processdata[1].value;\n\nreturn {\n topic: \"panel2\",\n payload: data\n};", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 340, "wires": [ [ "a81107f345fa9713", "53fb2b7abbfc4421", "df1cec0fae2e13b2" ] ] }, { "id": "b33573468e3ac7ab", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "function 31", "func": "var data = {};\n\ndata.solar_panel3_voltage = msg.payload[\"0\"].processdata[2].value;\ndata.solar_panel3_current = msg.payload[\"0\"].processdata[0].value;\ndata.solar_panel3_power = msg.payload[\"0\"].processdata[1].value;\n\nreturn {\n topic: \"panel3\",\n payload: data\n};", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 400, "wires": [ [ "a81107f345fa9713", "53fb2b7abbfc4421", "df1cec0fae2e13b2" ] ] }, { "id": "3534c00aecd8de8f", "type": "openApi-red", "z": "a1adc89a7a1ee0f9", "name": "", "configUrlNode": "1f08ba83891ebaa9", "apiTag": "processdata", "keepAuth": false, "operationData": { "id": "get_module_process_data_list", "hasOperationId": true, "path": "/processdata/{moduleid}", "method": "get" }, "outputStyle": "each response", "errorHandling": "throw exception", "internalErrors": { "text": "", "source": "" }, "parameters": { "moduleid path": { "name": "moduleid", "isActive": true, "required": true, "type": "str", "value": "scb:statistic:EnergyFlow", "in": "path" } }, "requestContentType": "application/json", "responseContentType": "application/json", "outputs": 3, "responseOutputLabels": [ { "code": "200", "text": "Success" }, { "code": "404", "text": "Module not found" }, { "code": "503", "text": "Internal communication error" } ], "responseAsPayload": false, "debugMode": false, "headers": [ { "key": "Authorization", "valueType": "msg", "value": "headers" } ], "_version": "2.1.3", "x": 690, "y": 460, "wires": [ [ "34c17f64d8bd7231", "0d8aad2378a4fd31" ], [], [] ] }, { "id": "34c17f64d8bd7231", "type": "function", "z": "a1adc89a7a1ee0f9", "name": "function 32", "func": "var data = {};\n\ndata.solar_panel1_yield_day = msg.payload[\"0\"].processdata[45].value;\ndata.solar_panel1_yield_month = msg.payload[\"0\"].processdata[46].value;\ndata.solar_panel1_yield_year = msg.payload[\"0\"].processdata[48].value;\ndata.solar_panel1_yield_total = msg.payload[\"0\"].processdata[47].value;\ndata.solar_panel2_yield_day = msg.payload[\"0\"].processdata[49].value;\ndata.solar_panel2_yield_month = msg.payload[\"0\"].processdata[50].value;\ndata.solar_panel2_yield_year = msg.payload[\"0\"].processdata[52].value;\ndata.solar_panel2_yield_total = msg.payload[\"0\"].processdata[51].value;\ndata.solar_panel3_yield_day = msg.payload[\"0\"].processdata[53].value;\ndata.solar_panel3_yield_month = msg.payload[\"0\"].processdata[54].value;\ndata.solar_panel3_yield_year = msg.payload[\"0\"].processdata[56].value;\ndata.solar_panel3_yield_total = msg.payload[\"0\"].processdata[55].value;\ndata.solar_panels_yield_day = msg.payload[\"0\"].processdata[61].value;\ndata.solar_panels_yield_month = msg.payload[\"0\"].processdata[62].value;\ndata.solar_panels_yield_year = msg.payload[\"0\"].processdata[64].value;\ndata.solar_panels_yield_total = msg.payload[\"0\"].processdata[63].value;\n\nreturn {\n payload: data\n};", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 460, "wires": [ [ "a81107f345fa9713", "53fb2b7abbfc4421" ] ] }, { "id": "df1cec0fae2e13b2", "type": "join", "z": "a1adc89a7a1ee0f9", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "useparts": true, "accumulate": false, "timeout": "", "count": "3", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 910, "y": 220, "wires": [ [ "a81107f345fa9713", "2a376301979106e5" ] ] }, { "id": "1f08ba83891ebaa9", "type": "openApi-red-url", "name": "", "url": "http://192.168.0.154/api/v1/swagger.json", "urlType": "str", "server": "http://192.168.0.154/api/v1", "serverType": "custom", "devMode": false, "headers": [], "_version": "2.1.3" }, { "id": "d5d914b8487bf10a", "type": "influxdb", "hostname": "127.0.0.1", "port": "8086", "protocol": "http", "database": "database", "name": "InfluxDB", "usetls": false, "tls": "", "influxdbVersion": "2.0", "url": "http://192.168.0.12:8086", "timeout": "", "rejectUnauthorized": true } ]