@netfritz
Hallo
Da ich mit dem Modbus Adapter die Holdingregister z.Z. nicht beschreiben kann,
vor allem SG Ready 1 und 2.
Habe ich es Heute mit ioBroker Node Red versucht.
Nach ein paar fehl Versuchen habe ich es hinbekommen SG Ready 1 und 2 anzusteuern.
Habe den node-red-contrib-modbus und node-red-contrib-modbus-flex-server installiert.
Dann den Flex.Server Knoten und Modbus-Red und Modbus-Write in das Flow gezogen
und Konfiguriert.
Hier noch der Flow zum Importieren.
Gruß NetFritz
[
{
"id": "e30b3d7c8e9c13ae",
"type": "tab",
"label": "Modbus",
"disabled": false,
"info": "",
"env": []
},
{
"id": "1c58a83f7b099c2c",
"type": "modbus-flex-server",
"z": "e30b3d7c8e9c13ae",
"name": "",
"logEnabled": false,
"serverAddress": "localhost",
"serverPort": "502",
"responseDelay": 100,
"unitId": 1,
"delayUnit": "ms",
"coilsBufferSize": 20000,
"registersBufferSize": 20000,
"minAddress": 0,
"splitAddress": 10000,
"funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t} \n}",
"funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t} \n}",
"funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor) \n\t} \n}",
"funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor) \n\t} \n}",
"funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor) \n\t} \n}",
"funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\taddr += node.splitAddress\n\tif (unitID === node.unitId && \n\t\taddr >= node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor) \n\t} \n}",
"showErrors": false,
"x": 280,
"y": 60,
"wires": [
[
"d47aa0d1fa728da8"
],
[
"d47aa0d1fa728da8"
],
[
"d47aa0d1fa728da8"
],
[
"d47aa0d1fa728da8"
],
[
"d47aa0d1fa728da8"
]
]
},
{
"id": "d47aa0d1fa728da8",
"type": "debug",
"z": "e30b3d7c8e9c13ae",
"name": "debug 231",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 510,
"y": 60,
"wires": []
},
{
"id": "e5d4b02e39142509",
"type": "inject",
"z": "e30b3d7c8e9c13ae",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "str",
"x": 90,
"y": 60,
"wires": [
[
"1c58a83f7b099c2c"
]
]
},
{
"id": "802c615c03960bb5",
"type": "modbus-read",
"z": "e30b3d7c8e9c13ae",
"name": "Read",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"showWarnings": true,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "1500",
"quantity": "20",
"rate": "5",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "0b269ba065891482",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 270,
"y": 140,
"wires": [
[
"850acb94b17b4b94"
],
[
"850acb94b17b4b94"
]
]
},
{
"id": "850acb94b17b4b94",
"type": "debug",
"z": "e30b3d7c8e9c13ae",
"name": "debug 232",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 510,
"y": 140,
"wires": []
},
{
"id": "cf41e8a95857a041",
"type": "modbus-write",
"z": "e30b3d7c8e9c13ae",
"name": "Write",
"showStatusActivities": false,
"showErrors": false,
"showWarnings": true,
"unitid": "1",
"dataType": "MHoldingRegisters",
"adr": "4001",
"quantity": "2",
"server": "0b269ba065891482",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"delayOnStart": false,
"startDelayTime": "",
"x": 250,
"y": 200,
"wires": [
[
"36fc03fafb4bfac3"
],
[
"36fc03fafb4bfac3"
]
]
},
{
"id": "36fc03fafb4bfac3",
"type": "debug",
"z": "e30b3d7c8e9c13ae",
"name": "debug 233",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 510,
"y": 200,
"wires": []
},
{
"id": "6188c6b9a087442e",
"type": "inject",
"z": "e30b3d7c8e9c13ae",
"name": "SG 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[0,0]",
"payloadType": "json",
"x": 90,
"y": 180,
"wires": [
[
"cf41e8a95857a041"
]
]
},
{
"id": "361c3ea15c934a33",
"type": "inject",
"z": "e30b3d7c8e9c13ae",
"name": "SG 3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[1,0]",
"payloadType": "json",
"x": 90,
"y": 220,
"wires": [
[
"cf41e8a95857a041"
]
]
},
{
"id": "0b269ba065891482",
"type": "modbus-client",
"name": "",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": true,
"tcpHost": "192.168.2.103",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true,
"showErrors": false,
"showWarnings": true,
"showLogs": true
}
]