Modbus TCP iSMA-B-MIX38-IP

New guy here :raised_hand:

I'm trying to learn node-red over programming BMS in Niagara.
Coming from Niagara I have a couple of iSMA MIX38 IO's that I'm trying to communicate with in node-red via modbus TCP/IP.

In Niagara when I would add the DO's there's a preloaded block for each output.
This is what it contains for DO-4
mod

As you can see there's a data address, absolute address and a bit number.
The bit number is the only one different on all the DO outputs. and ranges from 0-11 which translate to DO1-DO12.

I've tried to follow different guides online, but none of them seems to work for me - keep in mind that I no master programmer and new at this, so I might have overlooked something.

What I have success with is writing to FC6 and address 17.
There I can write numbers 1, for DO1, 2 for DO2, 4 for DO3 all the way up to 2048 for DO12.
But if I turn on one output eg. DO3 and I the try to turn on DO8, DO3 turns off and DO8 opens.
And i figure that making a bunch of outputs in node-red for each scenario of outputs to be on or off would be a huge mess.

Is there any simple way to get this to work?
In niagara I just drag a block for the DO I want to controll and send a Boolean true or false signal.

Heres a link for the manual, if it can help.
http://support.innon.com/iSMA/iSMA-B-MIX/Manuals/iSMA-B-MINI_and_MIX_Series_IO_Manual_Modbus.pdf

I've looked around for a couple of days and stumbled across a solution @UnborN did in another thread.

For anyone looking for this in the future the mapping for the DI's and DO's for this iSMA stuff is done in this flow.

[{"id":"40508ac23f5824f9","type":"debug","z":"f6979629ded1c46f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":1240,"wires":[]},{"id":"062ecef6fd0d1fe0","type":"modbus-read","z":"f6979629ded1c46f","name":"","topic":"","showStatusActivities":false,"logIOActivities":true,"showErrors":false,"unitid":"","dataType":"InputRegister","adr":"15","quantity":"1","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"c9182903019e9c6a","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":920,"wires":[["5a40b34a04265347"],[]]},{"id":"7ed14e5.f2503b","type":"modbus-flex-write","z":"f6979629ded1c46f","name":"","showStatusActivities":false,"showErrors":false,"server":"c9182903019e9c6a","emptyMsgOnFail":false,"keepMsgProperties":false,"x":630,"y":1240,"wires":[["40508ac23f5824f9"],[]]},{"id":"ebde8026.c14da8","type":"function","z":"f6979629ded1c46f","name":"FC6","func":"// get current status array\nlet deviceStatus = flow.get(\"deviceStatus\");  \n\n// what coil to update ..  must be sent in msg.coil as a number \nlet coil = msg.coil;\n\n// make string to array\ndeviceStatus = deviceStatus.split('');\n\n// update x coil status in array based on payload 0 or 1\ndeviceStatus[coil] = msg.payload;\n// make it to a string AGAIN !!!\ndeviceStatus = deviceStatus.join('');\n\n// update status for Context so node-red will know the status\nflow.set(\"deviceStatus\", deviceStatus);     \n\n\n// make the string to a decimal\nlet dec = parseInt(deviceStatus, 2)\n\n\n// prepare msg for Modbus flex write\nmsg.payload =  {\n    value: dec, \n    'fc': 6, \n    'unitid': 1, \n    'address': 17,\n    'quantity': 1 \n};  \n\n // send msg to Modbus flex write\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":1240,"wires":[["7ed14e5.f2503b"]]},{"id":"ef4575de.037b28","type":"comment","z":"f6979629ded1c46f","name":"Update Context and Prepare Write","info":"","x":560,"y":1200,"wires":[]},{"id":"3237f347.ed54b4","type":"inject","z":"f6979629ded1c46f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"trigger","payloadType":"str","x":150,"y":1080,"wires":[["4b202f6f.f4938"]]},{"id":"eb0f70eb.9b4c4","type":"debug","z":"f6979629ded1c46f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":1080,"wires":[]},{"id":"4b202f6f.f4938","type":"function","z":"f6979629ded1c46f","name":"FC03","func":"msg.payload = { \n  //  value: msg.payload, \n    'fc': 3, \n    'unitid': 1, \n    'address': 17,\n    'quantity': 1 \n} \nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":1080,"wires":[["1d12e1bf.a40bbe"]]},{"id":"1d12e1bf.a40bbe","type":"modbus-flex-getter","z":"f6979629ded1c46f","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"c9182903019e9c6a","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":440,"y":1080,"wires":[["e471c7d9.aab7c"],[]]},{"id":"e471c7d9.aab7c","type":"function","z":"f6979629ded1c46f","name":"","func":"\n// convert to binary string and add leading zeros\nlet deviceStatus = msg.payload[0].toString(2).padStart(16, '0');\n\n// set Node-red context in memory so node-red can access the status\nflow.set('deviceStatus', deviceStatus)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":1080,"wires":[["eb0f70eb.9b4c4"]]},{"id":"5eac710f.091238","type":"comment","z":"f6979629ded1c46f","name":"Initial Read","info":"","x":280,"y":1040,"wires":[]},{"id":"25f887fd.782f48","type":"comment","z":"f6979629ded1c46f","name":"Set Context","info":"","x":630,"y":1040,"wires":[]},{"id":"ea9f15bca31680eb","type":"inject","z":"f6979629ded1c46f","name":"12","props":[{"p":"payload"},{"p":"coil","v":"4","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1300,"wires":[["ebde8026.c14da8"]]},{"id":"54ad83dbe3917457","type":"inject","z":"f6979629ded1c46f","name":"11","props":[{"p":"payload"},{"p":"coil","v":"5","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1340,"wires":[["ebde8026.c14da8"]]},{"id":"ec166e1be6e64d95","type":"inject","z":"f6979629ded1c46f","name":"10","props":[{"p":"payload"},{"p":"coil","v":"6","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1380,"wires":[["ebde8026.c14da8"]]},{"id":"954624c57c435175","type":"inject","z":"f6979629ded1c46f","name":"9","props":[{"p":"payload"},{"p":"coil","v":"7","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1420,"wires":[["ebde8026.c14da8"]]},{"id":"2723a0aa15804711","type":"inject","z":"f6979629ded1c46f","name":"8","props":[{"p":"payload"},{"p":"coil","v":"8","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1460,"wires":[["ebde8026.c14da8"]]},{"id":"29cbf6a5934c108f","type":"inject","z":"f6979629ded1c46f","name":"7","props":[{"p":"payload"},{"p":"coil","v":"9","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1500,"wires":[["ebde8026.c14da8"]]},{"id":"655def7eb93a9225","type":"inject","z":"f6979629ded1c46f","name":"6","props":[{"p":"payload"},{"p":"coil","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1540,"wires":[["ebde8026.c14da8"]]},{"id":"a8eeb48281363908","type":"inject","z":"f6979629ded1c46f","name":"5","props":[{"p":"payload"},{"p":"coil","v":"11","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1580,"wires":[["ebde8026.c14da8"]]},{"id":"4dc9741b6cdc06e9","type":"inject","z":"f6979629ded1c46f","name":"4","props":[{"p":"payload"},{"p":"coil","v":"12","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1620,"wires":[["ebde8026.c14da8"]]},{"id":"4dceb6e1d20581e7","type":"inject","z":"f6979629ded1c46f","name":"3","props":[{"p":"payload"},{"p":"coil","v":"13","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1660,"wires":[["ebde8026.c14da8"]]},{"id":"cc3dcaf32e3135a2","type":"inject","z":"f6979629ded1c46f","name":"2","props":[{"p":"payload"},{"p":"coil","v":"14","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1700,"wires":[["ebde8026.c14da8"]]},{"id":"ee4ca1c326cc896a","type":"inject","z":"f6979629ded1c46f","name":"1","props":[{"p":"payload"},{"p":"coil","v":"15","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":510,"y":1740,"wires":[["ebde8026.c14da8"]]},{"id":"af4aaaf123eea30c","type":"inject","z":"f6979629ded1c46f","name":"12","props":[{"p":"payload"},{"p":"coil","v":"4","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1300,"wires":[["ebde8026.c14da8"]]},{"id":"86ca902c7553d7d1","type":"inject","z":"f6979629ded1c46f","name":"11","props":[{"p":"payload"},{"p":"coil","v":"5","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1340,"wires":[["ebde8026.c14da8"]]},{"id":"f9360c1877330616","type":"inject","z":"f6979629ded1c46f","name":"10","props":[{"p":"payload"},{"p":"coil","v":"6","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1380,"wires":[["ebde8026.c14da8"]]},{"id":"1362e0764493aab8","type":"inject","z":"f6979629ded1c46f","name":"9","props":[{"p":"payload"},{"p":"coil","v":"7","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1420,"wires":[["ebde8026.c14da8"]]},{"id":"a1f29f8268ecb5f5","type":"inject","z":"f6979629ded1c46f","name":"8","props":[{"p":"payload"},{"p":"coil","v":"8","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1460,"wires":[["ebde8026.c14da8"]]},{"id":"ce0d8359ff19e0fd","type":"inject","z":"f6979629ded1c46f","name":"7","props":[{"p":"payload"},{"p":"coil","v":"9","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1500,"wires":[["ebde8026.c14da8"]]},{"id":"5c952db90c5dae24","type":"inject","z":"f6979629ded1c46f","name":"6","props":[{"p":"payload"},{"p":"coil","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1540,"wires":[["ebde8026.c14da8"]]},{"id":"b520d702938cf7ee","type":"inject","z":"f6979629ded1c46f","name":"5","props":[{"p":"payload"},{"p":"coil","v":"11","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1580,"wires":[["ebde8026.c14da8"]]},{"id":"5a253c1a0c30d392","type":"inject","z":"f6979629ded1c46f","name":"4","props":[{"p":"payload"},{"p":"coil","v":"12","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1620,"wires":[["ebde8026.c14da8"]]},{"id":"644553c7a9ac1bfa","type":"inject","z":"f6979629ded1c46f","name":"3","props":[{"p":"payload"},{"p":"coil","v":"13","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1660,"wires":[["ebde8026.c14da8"]]},{"id":"39f77a9905dcdf9b","type":"inject","z":"f6979629ded1c46f","name":"2","props":[{"p":"payload"},{"p":"coil","v":"14","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1700,"wires":[["ebde8026.c14da8"]]},{"id":"f95d6ccce5f946f4","type":"inject","z":"f6979629ded1c46f","name":"1","props":[{"p":"payload"},{"p":"coil","v":"15","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":650,"y":1740,"wires":[["ebde8026.c14da8"]]},{"id":"8e42e8ec2cd6c1ee","type":"change","z":"f6979629ded1c46f","name":"DO12","rules":[{"t":"set","p":"coil","pt":"msg","to":"4","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1120,"wires":[["ebde8026.c14da8"]]},{"id":"20e0cd89ff0be906","type":"change","z":"f6979629ded1c46f","name":"DO11","rules":[{"t":"set","p":"coil","pt":"msg","to":"5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1160,"wires":[["ebde8026.c14da8"]]},{"id":"195217a4632553d7","type":"change","z":"f6979629ded1c46f","name":"DO10","rules":[{"t":"set","p":"coil","pt":"msg","to":"6","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1200,"wires":[["ebde8026.c14da8"]]},{"id":"2899cbfe8b67d8f2","type":"change","z":"f6979629ded1c46f","name":"DO9","rules":[{"t":"set","p":"coil","pt":"msg","to":"7","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1240,"wires":[["ebde8026.c14da8"]]},{"id":"df6dd2c3f800baa2","type":"change","z":"f6979629ded1c46f","name":"DO8","rules":[{"t":"set","p":"coil","pt":"msg","to":"8","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1280,"wires":[["ebde8026.c14da8"]]},{"id":"5f96b1c6b45d4866","type":"change","z":"f6979629ded1c46f","name":"DO7","rules":[{"t":"set","p":"coil","pt":"msg","to":"9","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1320,"wires":[["ebde8026.c14da8"]]},{"id":"325fb93142cd6853","type":"change","z":"f6979629ded1c46f","name":"DO6","rules":[{"t":"set","p":"coil","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1360,"wires":[["ebde8026.c14da8"]]},{"id":"72b4c0937c37dfb1","type":"change","z":"f6979629ded1c46f","name":"DO5","rules":[{"t":"set","p":"coil","pt":"msg","to":"11","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1400,"wires":[["ebde8026.c14da8"]]},{"id":"00f9da237116b3be","type":"change","z":"f6979629ded1c46f","name":"DO4","rules":[{"t":"set","p":"coil","pt":"msg","to":"12","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1440,"wires":[["ebde8026.c14da8"]]},{"id":"6925ab81c9490157","type":"change","z":"f6979629ded1c46f","name":"DO3","rules":[{"t":"set","p":"coil","pt":"msg","to":"13","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1480,"wires":[["ebde8026.c14da8"]]},{"id":"8001cfc286873915","type":"change","z":"f6979629ded1c46f","name":"DO2","rules":[{"t":"set","p":"coil","pt":"msg","to":"14","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1520,"wires":[["ebde8026.c14da8"]]},{"id":"8192152090bafc9c","type":"change","z":"f6979629ded1c46f","name":"DO1","rules":[{"t":"set","p":"coil","pt":"msg","to":"15","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":1560,"wires":[["ebde8026.c14da8"]]},{"id":"38e10fc705cfeb5b","type":"modbus-write","z":"f6979629ded1c46f","name":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"HoldingRegister","adr":"17","quantity":"1","server":"c9182903019e9c6a","emptyMsgOnFail":false,"keepMsgProperties":false,"x":650,"y":1800,"wires":[[],[]]},{"id":"984da599ba80a69c","type":"inject","z":"f6979629ded1c46f","name":"All off","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":490,"y":1800,"wires":[["38e10fc705cfeb5b","4b202f6f.f4938"]]},{"id":"23c95c6c30ab9db5","type":"debug","z":"f6979629ded1c46f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":980,"wires":[]},{"id":"5a40b34a04265347","type":"bit-sixteen","z":"f6979629ded1c46f","name":"","x":430,"y":920,"wires":[[],[],[],[],[],[],[],[],[],[],[],["23c95c6c30ab9db5"],[],[],[],[]],"outputLabels":["DI1","DI2","DI3","DI4","DI5","DI6","DI7","DI8","DI9","DI10","DI11","DI12","","","",""]},{"id":"c9182903019e9c6a","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"10.0.1.101","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}]

A big thanks to @UnborN in via this thread:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.