[
{
"id": "36239d1d9d361a2e",
"type": "change",
"z": "7e6af0015415146d",
"name": "create Array",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\t {\t \"unitId\": payload,\t \"_address\": 0,\t \"name\": \"Voltage\",\t \"description\": \"Voltage\",\t \"unit\": \"V\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 6,\t \"name\": \"Current\",\t \"description\": \"Current\",\t \"unit\": \"A\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 12,\t \"name\": \"ActivePower\",\t \"description\": \"Active Power\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 18,\t \"name\": \"ApparentPower\",\t \"description\": \"ApparentPower\",\t \"unit\": \"VA\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 24,\t \"name\": \"ReactivePower\",\t \"description\": \"ReactivePower\",\t \"unit\": \"VAr\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 30,\t \"name\": \"PowerFactor\",\t \"description\": \"PowerFactor\",\t \"unit\": \"\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 70,\t \"name\": \"Frequency\",\t \"description\": \"Frequency\",\t \"unit\": \"Hz\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 72,\t \"name\": \"ActiveEnergy\",\t \"description\": \"Active Energy\",\t \"unit\": \"kWh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 74,\t \"name\": \"ExportActiveEnergy\",\t \"description\": \"ExportActiveEnergy\",\t \"unit\": \"kWh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 74,\t \"name\": \"TotalSystemPowerDemand\",\t \"description\": \"TotalSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 76,\t \"name\": \"ImportReactiveEnergy\",\t \"description\": \"ImportReactiveEnergy\",\t \"unit\": \"kvarh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 76,\t \"name\": \"MaxTotalSystemPowerDemand\",\t \"description\": \"MaxTotalSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 78,\t \"name\": \"ExportReactiveEnergy\",\t \"description\": \"ExportReactiveEnergy\",\t \"unit\": \"kvarh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 88,\t \"name\": \"ImportSystemPowerDemand\",\t \"description\": \"ImportSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 90,\t \"name\": \"MaxImportSystemPowerDemand\",\t \"description\": \"MaxImportSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 92,\t \"name\": \"ExportSystemPowerDemand\",\t \"description\": \"ExportSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 94,\t \"name\": \"MaxExportSystemPowerDemand\",\t \"description\": \"MaxExportSystemPowerDemand\",\t \"unit\": \"W\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 258,\t \"name\": \"CurrentDemand\",\t \"description\": \"CurrentDemand\",\t \"unit\": \"A\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 264,\t \"name\": \"MaxCurrentDemand\",\t \"description\": \"MaxCurrentDemand\",\t \"unit\": \"A\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 342,\t \"name\": \"TotalActiveEnergy\",\t \"description\": \"TotalActiveEnergy\",\t \"unit\": \"kWh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t },\t {\t \"unitId\": payload,\t \"_address\": 344,\t \"name\": \"TotalReactiveEnergy\",\t \"description\": \"TotalReactiveEnergy\",\t \"unit\": \"kvarh\",\t \"type\": \"floatbe\",\t \"len\": 2,\t \"factor\": 1,\t \"offset\": 0,\t \"formula\": \"\",\t \"role\": \"level\",\t \"room\": \"\",\t \"cw\": false,\t \"isScale\": false\t }\t]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 860,
"wires": [
[
"833e22472f593063"
]
]
},
{
"id": "8b8fb28987277d75",
"type": "function",
"z": "7e6af0015415146d",
"name": "Trigger IDs",
"func": "if (msg.payload) {\n context.set(\"data\",msg.payload);\n context.set(\"pointer\",0)\n}\nvar array = context.get(\"data\");\nvar pointer = context.get(\"pointer\");\npointer ++;\n\nif ( pointer <= array.length)\n{\n msg.payload = array[pointer - 1];\n context.set(\"pointer\",pointer);\n return msg;\n}\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 860,
"wires": [
[
"36239d1d9d361a2e"
]
]
},
{
"id": "6521f44463e25c3c",
"type": "inject",
"z": "7e6af0015415146d",
"name": "Mehrere IDs",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[10,11,12]",
"payloadType": "json",
"x": 230,
"y": 860,
"wires": [
[
"8b8fb28987277d75"
]
]
},
{
"id": "557989f42ddad473",
"type": "change",
"z": "7e6af0015415146d",
"name": "Read Modbus",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "parts.count - parts.index - 1",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\t \"fc\": 4,\t \"unitid\": payload.unitId,\t \"address\": payload._address,\t \"quantity\": 2,\t \"value\": 2\t}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1080,
"y": 860,
"wires": [
[
"0f4f661c760aa72b"
]
]
},
{
"id": "833e22472f593063",
"type": "split",
"z": "7e6af0015415146d",
"name": "split Array",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 900,
"y": 860,
"wires": [
[
"557989f42ddad473"
]
]
},
{
"id": "0f4f661c760aa72b",
"type": "function",
"z": "7e6af0015415146d",
"name": "Simulate Modbus getter",
"func": "var msg2 = {\n topic : msg.topic,\n queueLengthByUnitId : {\n unitID: msg.payload.unitid,\n queueLength: msg.parts.index\n }\n}\n\n\nvar msg1 = {\n payload : {\n data : [0,0],\n buffer: Buffer.alloc(3)\n },\n modbusRequest : {\n address : 99,\n quantity : 2\n }\n}\n\n\nreturn [msg1,msg2];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1310,
"y": 860,
"wires": [
[
"5e5a202488c31ae0"
],
[
"3a68bda0a135f481"
]
]
},
{
"id": "5e5a202488c31ae0",
"type": "change",
"z": "7e6af0015415146d",
"name": "WriteModbus",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\t \"value\": payload,\t \"fc\": 6,\t \"unitid\" : 1, /* unitId */\t \"address\": modbusRequest.address,\t \"quantity\": modbusRequest.quantity\t}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 840,
"wires": [
[]
]
},
{
"id": "112befc65439e8b7",
"type": "comment",
"z": "7e6af0015415146d",
"name": "Getriggert by Getter Node",
"info": "",
"x": 230,
"y": 800,
"wires": []
},
{
"id": "4a433464d06dc6d8",
"type": "change",
"z": "7e6af0015415146d",
"name": "Trigger next ID",
"rules": [
{
"t": "set",
"p": "trigger",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 780,
"y": 920,
"wires": [
[
"8b8fb28987277d75"
]
]
},
{
"id": "315c37ef4aceb5d4",
"type": "debug",
"z": "7e6af0015415146d",
"name": "next ID wenn topic 0 (array zu ende)",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1330,
"y": 980,
"wires": []
},
{
"id": "3a68bda0a135f481",
"type": "switch",
"z": "7e6af0015415146d",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1050,
"y": 980,
"wires": [
[
"4a433464d06dc6d8",
"315c37ef4aceb5d4"
]
]
}
]