[
{
"id": "f6bfa45d44848e0b",
"type": "tab",
"label": "Flow 3",
"disabled": false,
"info": "",
"env": []
},
{
"id": "d6218fe1418c8ae9",
"type": "inject",
"z": "f6bfa45d44848e0b",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 260,
"wires": [
[
"2e25ecba20d95814"
]
]
},
{
"id": "2e25ecba20d95814",
"type": "function",
"z": "f6bfa45d44848e0b",
"name": "Monatstage",
"func": "var msg = {};\n\n// ------------- Aktuellen Monat herausfinden -------------------------\nvar Tage;\nvar now = new Date();\nvar month = now.getMonth() + 1;\n\nif (month == 1) {Tage = 31}\nif (month == 2) { Tage = 28 }\nif (month == 3) { Tage = 31}\nif (month == 4) { Tage = 30 }\nif (month == 5) { Tage = 31}\nif (month == 6) { Tage = 30 }\nif (month == 7) { Tage = 31 }\nif (month == 8) { Tage = 31 }\nif (month == 9) { Tage = 30 }\nif (month == 10) { Tage = 31 }\nif (month == 11) { Tage = 30 }\nif (month == 12) { Tage = 31 }\n// --------------------------------------------------------------------\n\n\nmsg.payload =\n{\n Tage:Tage,\n}\nreturn [msg];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 260,
"wires": [
[
"0374cab1d63834c4",
"42e42ac5275c90ae"
]
]
},
{
"id": "42e42ac5275c90ae",
"type": "debug",
"z": "f6bfa45d44848e0b",
"name": "payload",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 440,
"y": 220,
"wires": []
},
{
"id": "0374cab1d63834c4",
"type": "change",
"z": "f6bfa45d44848e0b",
"name": "",
"rules": [
{
"t": "set",
"p": "query",
"pt": "msg",
"to": "'SELECT sum(\"Pool_vom_Netz\") / 120000 FROM \"Bilanz\" WHERE time > now() -' & payload.Tage & 'd'",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 260,
"wires": [
[
"9005b1ef0601da83",
"7e1adada9963614b"
]
]
},
{
"id": "7e1adada9963614b",
"type": "debug",
"z": "f6bfa45d44848e0b",
"name": "query",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "query",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 630,
"y": 220,
"wires": []
},
{
"id": "9005b1ef0601da83",
"type": "influxdb in",
"z": "f6bfa45d44848e0b",
"influxdb": "655abc6ff1dd28f5",
"name": "Abfrage Zählerst. Energie",
"query": "msg.query",
"rawOutput": true,
"precision": "",
"retentionPolicy": "",
"org": "",
"x": 690,
"y": 260,
"wires": [
[
"af64830ef5a1d939",
"833e8db5cdba66d3"
]
]
},
{
"id": "af64830ef5a1d939",
"type": "debug",
"z": "f6bfa45d44848e0b",
"name": "payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 220,
"wires": []
},
{
"id": "833e8db5cdba66d3",
"type": "function",
"z": "f6bfa45d44848e0b",
"name": "E_Whirlpool_Monat_v_Netz",
"func": "var msg1 = {};\n\nvar Pool_vom_Netz = msg.payload.results[0].series[0].values[0][1];\n\n\nmsg1.payload =\n{\n\nPool_vom_Netz_Monat: parseFloat(Pool_vom_Netz.toFixed(2)),\n \n\n}\n\n\nreturn [msg1];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 940,
"y": 260,
"wires": [
[
"8014820292266bd7"
]
]
},
{
"id": "8014820292266bd7",
"type": "debug",
"z": "f6bfa45d44848e0b",
"name": "payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1020,
"y": 220,
"wires": []
},
{
"id": "655abc6ff1dd28f5",
"type": "influxdb",
"hostname": "10.1.1.113",
"port": "8086",
"protocol": "http",
"database": "whirlpool",
"name": "whirlpool",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"rejectUnauthorized": true
}
]