Hi,
ich habe versucht, den Flow mit einem Test-JSON anzupassen.
Funktioniert aber leider nicht ;-(
Kannst Du Dir das mal anschauen?
[
{
"id": "a09ad26b.315ae",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": ""
},
{
"id": "ccfc9203.121528",
"type": "inject",
"z": "a09ad26b.315ae",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Time\":\"2022-12-08T12:49:38\",\"STROM\":{\"total\":30500.9}}",
"payloadType": "str",
"x": 120,
"y": 1000,
"wires": [
[
"f85fe9be.7bb55"
]
]
},
{
"id": "f85fe9be.7bb55",
"type": "json",
"z": "a09ad26b.315ae",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 270,
"y": 1240,
"wires": [
[
"2b887bdc.4e30f4",
"6b8f82d5.6c97b4"
]
]
},
{
"id": "2b887bdc.4e30f4",
"type": "change",
"z": "a09ad26b.315ae",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.STROM.total",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 1260,
"wires": [
[
"3c8e0948.90c8ce",
"3058b7fe.9ff1",
"1e79f3ed.4379e4",
"8f9d4b73.b59078"
]
]
},
{
"id": "a2f13296.c8d18",
"type": "homeeDevice",
"z": "a09ad26b.315ae",
"virtual-homee": "",
"name": "B-Control",
"nodeId": "90",
"showNodeId": false,
"profile": "32",
"icon": "default",
"attributes": [
{
"instance": 3,
"minimum": 0,
"maximum": 600000,
"current_value": 0,
"target_value": 225.763,
"last_value": 225.748,
"unit": "kWh%20Ges.",
"step_value": 1,
"editable": 0,
"type": 240,
"state": 1,
"last_changed": 1572548037,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1027",
"node_id": "90"
},
{
"instance": 0,
"minimum": 0,
"maximum": 80000,
"current_value": 0,
"target_value": 458.812,
"last_value": 403.519,
"unit": "W",
"step_value": 1,
"editable": 0,
"type": 239,
"state": 1,
"last_changed": 1572548071,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1033",
"node_id": "90"
},
{
"instance": 0,
"minimum": 0,
"maximum": 420,
"current_value": 0,
"target_value": 232.134,
"last_value": 231.805,
"unit": "V",
"step_value": 1,
"editable": 0,
"type": 51,
"state": 1,
"last_changed": 1572548036,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1034",
"node_id": "90"
},
{
"instance": 0,
"minimum": 0,
"maximum": 200,
"current_value": 0,
"target_value": 2.581,
"last_value": 2.575,
"unit": "A",
"step_value": 1,
"editable": 0,
"type": 272,
"state": 1,
"last_changed": 1572548036,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1035",
"node_id": "90"
},
{
"instance": 0,
"minimum": 0,
"maximum": 600000,
"current_value": 0,
"target_value": 0,
"last_value": 0,
"unit": "kWh%20Tag",
"step_value": 1,
"editable": 0,
"type": 240,
"state": 1,
"last_changed": 1572548037,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1045",
"node_id": "90"
},
{
"instance": 2,
"minimum": 0,
"maximum": 600000,
"current_value": 0,
"target_value": 0,
"last_value": 0,
"unit": "kWh%20Monat",
"step_value": 1,
"editable": 0,
"type": 240,
"state": 1,
"last_changed": 1572548037,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1046",
"node_id": "90"
},
{
"instance": 1,
"minimum": 0,
"maximum": 600000,
"current_value": 0,
"target_value": 0,
"last_value": 0,
"unit": "kWh%20Woche",
"step_value": 1,
"editable": 0,
"type": 240,
"state": 1,
"last_changed": 1572548037,
"changed_by": 1,
"changed_by_id": 0,
"based_on": 1,
"data": "",
"node": "[Circular ~.node]",
"id": "1047",
"node_id": "90"
}
],
"statusTemplate": "",
"x": 1910,
"y": 1200,
"wires": [
[]
]
},
{
"id": "9487378d.310d68",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1034 Gesamtspannung",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1034,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1300,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "88cc4b95.7c9c18",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1035 Gesamtstromstärke",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1035,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1340,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "1e79f3ed.4379e4",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1033 Gesamtverbrauch",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1033,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1260,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "8f9d4b73.b59078",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "\nreturn {payload:msg.payload/232}",
"outputs": 1,
"noerr": 0,
"x": 1100,
"y": 1420,
"wires": [
[
"88cc4b95.7c9c18"
]
]
},
{
"id": "5c296a1b.2b8e54",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1027 Gesamtverbrauch ",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1027,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1220,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "3058b7fe.9ff1",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "return {payload: ((parseFloat(msg.payload)-11815340.7)/1000)+71337.81}",
"outputs": 1,
"noerr": 0,
"x": 960,
"y": 1200,
"wires": [
[
"5c296a1b.2b8e54",
"9c79692e.e8519",
"d91d5658.914e88",
"ea3c4acb.c5f628",
"c60ff652.df98"
]
]
},
{
"id": "9c79692e.e8519",
"type": "change",
"z": "a09ad26b.315ae",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "gesamtverbrauch",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1200,
"y": 1180,
"wires": [
[]
]
},
{
"id": "2ecb1a8d.13d016",
"type": "inject",
"z": "a09ad26b.315ae",
"name": "",
"props": [
{
"p": "payload",
"v": "",
"vt": "date"
},
{
"p": "topic",
"v": "",
"vt": "string"
}
],
"repeat": "",
"crontab": "01 00 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1650,
"y": 660,
"wires": [
[
"b7c26a64.946be"
]
]
},
{
"id": "b7c26a64.946be",
"type": "change",
"z": "a09ad26b.315ae",
"name": "",
"rules": [
{
"t": "set",
"p": "gesamtverbrauch2",
"pt": "flow",
"to": "gesamtverbrauch",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1890,
"y": 660,
"wires": [
[]
]
},
{
"id": "d91d5658.914e88",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "var verb1 = flow.get(\"gesamtverbrauch\");\nvar verb2 = flow.get(\"gesamtverbrauch2\");\n\nreturn {payload: verb1-verb2}",
"outputs": 1,
"noerr": 0,
"x": 1100,
"y": 1320,
"wires": [
[
"4e4fa459.b72984"
]
]
},
{
"id": "4e4fa459.b72984",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1045 Gesamtverbrauch Tag",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1045,\"value\":{{payload}}}}",
"output": "json",
"x": 1520,
"y": 1180,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "d67b82d0.deaa58",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1046 Gesamtverbrauch Monat",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1046,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1140,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "ea3c4acb.c5f628",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "var verb1 = flow.get(\"gesamtverbrauch\");\nvar verb2 = flow.get(\"gesamtverbrauchMonat\");\n\nreturn {payload: verb1-verb2}",
"outputs": 1,
"noerr": 0,
"x": 980,
"y": 1120,
"wires": [
[
"d67b82d0.deaa58"
]
]
},
{
"id": "3402438e.390e3c",
"type": "inject",
"z": "a09ad26b.315ae",
"name": "",
"repeat": "",
"crontab": "02 00 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1490,
"y": 700,
"wires": [
[
"b8ac95eb.9d8a4"
]
]
},
{
"id": "e5e820d4.f99cc",
"type": "change",
"z": "a09ad26b.315ae",
"name": "",
"rules": [
{
"t": "set",
"p": "gesamtverbrauchMonat",
"pt": "flow",
"to": "gesamtverbrauch",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1910,
"y": 700,
"wires": [
[]
]
},
{
"id": "b8ac95eb.9d8a4",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "var d = new Date();\nvar date2 = d.getDate() + \"-\" + (d.getMonth() + 1) + \"-\" + d.getFullYear()+\"_\"+d.getHours()+\":\"+d.getMinutes();\nif (d.getDate() === 1){return {payload:true}}\nelse\nreturn",
"outputs": 1,
"noerr": 0,
"x": 1640,
"y": 700,
"wires": [
[
"e5e820d4.f99cc"
]
]
},
{
"id": "58cee201.fba70c",
"type": "inject",
"z": "a09ad26b.315ae",
"name": "",
"repeat": "",
"crontab": "02 00 * * 1",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1650,
"y": 740,
"wires": [
[
"b63f4eac.b6f488"
]
]
},
{
"id": "b63f4eac.b6f488",
"type": "change",
"z": "a09ad26b.315ae",
"name": "",
"rules": [
{
"t": "set",
"p": "gesamtverbrauchWoche",
"pt": "flow",
"to": "gesamtverbrauch",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1910,
"y": 740,
"wires": [
[]
]
},
{
"id": "ab63b4bf.78c718",
"type": "template",
"z": "a09ad26b.315ae",
"name": "1047 Gesamtverbrauch Woche",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":1047,\"value\":{{payload}}}}",
"output": "json",
"x": 1510,
"y": 1100,
"wires": [
[
"a2f13296.c8d18"
]
]
},
{
"id": "c60ff652.df98",
"type": "function",
"z": "a09ad26b.315ae",
"name": "",
"func": "var verb1 = flow.get(\"gesamtverbrauch\");\nvar verb2 = flow.get(\"gesamtverbrauchWoche\");\n\nreturn {payload: verb1-verb2}",
"outputs": 1,
"noerr": 0,
"x": 1220,
"y": 1060,
"wires": [
[
"ab63b4bf.78c718"
]
]
},
{
"id": "79700011.a96418",
"type": "catch",
"z": "a09ad26b.315ae",
"name": "",
"scope": null,
"uncaught": false,
"x": 1620,
"y": 1000,
"wires": [
[]
]
},
{
"id": "3c8e0948.90c8ce",
"type": "debug",
"z": "a09ad26b.315ae",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 920,
"y": 960,
"wires": []
},
{
"id": "6b8f82d5.6c97b4",
"type": "debug",
"z": "a09ad26b.315ae",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 400,
"y": 1020,
"wires": []
}
]