Last active
March 27, 2020 20:11
-
-
Save Nolan-Walker/b409695219ed31774d95458be9e5df99 to your computer and use it in GitHub Desktop.
Node-Red Modbus Flows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"c25d9bf9.208578","type":"tab","label":"Modbus Master","disabled":true,"info":""},{"id":"9d58353d.9cbb48","type":"modbus-server","z":"c25d9bf9.208578","name":"Modbus Server","logEnabled":false,"hostname":"10.10.10.1","serverPort":10502,"responseDelay":100,"delayUnit":"ms","coilsBufferSize":1024,"holdingBufferSize":1024,"inputBufferSize":1024,"discreteBufferSize":"1024","showErrors":false,"x":678.9999713897705,"y":148.99999380111694,"wires":[[],["5a5d24ab.58a3dc","28fd74ed.5817ac"],[],[]]},{"id":"5a5d24ab.58a3dc","type":"debug","z":"c25d9bf9.208578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":888.9999713897705,"y":148.99999380111694,"wires":[]},{"id":"592fdf3c.fc2a9","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":468.9999713897705,"y":148.99999380111694,"wires":[["9d58353d.9cbb48"]]},{"id":"b522211.365e2e","type":"comment","z":"c25d9bf9.208578","name":"Creates a Modbus Slave device to read and write to","info":"","x":590,"y":60,"wires":[]},{"id":"3b30e1c2.e36afe","type":"modbus-flex-getter","z":"c25d9bf9.208578","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"7bb65196.e1e0e","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":820,"y":400,"wires":[[],["f08629e9.665898","1900b435.74138c","c5876399.95f3d"]]},{"id":"3876de7a.cabbd2","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":400,"wires":[["d88703f4.0a6b","18a309c9.8afbb6"]]},{"id":"1900b435.74138c","type":"debug","z":"c25d9bf9.208578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.data","targetType":"msg","x":1110,"y":400,"wires":[]},{"id":"d88703f4.0a6b","type":"function","z":"c25d9bf9.208578","name":"FC1 99 [8] (read 8 coils)","func":"msg.topic = 'readserver'\nmsg.payload = { \n 'fc': 1, //'fc' is the function code. 1 means read coil-status\n 'unitid': 0, \n 'address': 0 , \n 'quantity': 8\n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":570,"y":400,"wires":[["3b30e1c2.e36afe"]]},{"id":"a39d08c4.9222d8","type":"link in","z":"c25d9bf9.208578","name":"Trigger Read to toggle","links":["6403fb44.8c6824"],"x":295,"y":480,"wires":[["d88703f4.0a6b"]]},{"id":"8064d5f7.7d61e8","type":"link out","z":"c25d9bf9.208578","name":"Coppy coils in server to scadapack","links":["d8390374.bf346"],"x":1015,"y":720,"wires":[]},{"id":"8449914f.dc71b","type":"link in","z":"c25d9bf9.208578","name":"Notify Function","links":["7d99c884.ab6918"],"x":215,"y":640,"wires":[["d53fa529.3343b8"]]},{"id":"f08629e9.665898","type":"split","z":"c25d9bf9.208578","name":"Split Messages by Payload","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"topic","x":560,"y":640,"wires":[["4e4e27e8.2c66f8","b676bdfb.e07ac"]]},{"id":"4d750a74.279c04","type":"function","z":"c25d9bf9.208578","name":"Read or Read/Write?","func":"msg.topic = \"\"\nif (typeof msg.payload.readwrite != \"undefined\") {\n msg.payload = msg.payload.data;\n node.send(msg);\n} else {\n return null;\n}","outputs":1,"noerr":0,"x":740,"y":740,"wires":[["3d813c7e.369f84","51062589.ef71bc"]]},{"id":"4e4e27e8.2c66f8","type":"join","z":"c25d9bf9.208578","name":"Combine the Messages by Payload","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1000,"y":640,"wires":[["7d504496.e3099c"]]},{"id":"3d813c7e.369f84","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":910,"y":780,"wires":[]},{"id":"aaf993b2.c269f","type":"comment","z":"c25d9bf9.208578","name":"Split messages and recombine after 3 messages to make one message with all payloads","info":"","x":850,"y":600,"wires":[]},{"id":"69e3a1fd.cca7a","type":"comment","z":"c25d9bf9.208578","name":"Trigger from Write Coils","info":"","x":240,"y":440,"wires":[]},{"id":"3a96582.62c34a8","type":"comment","z":"c25d9bf9.208578","name":"Notify Function we will Write to scadapack","info":"","x":220,"y":600,"wires":[]},{"id":"58387865.8cd9f8","type":"comment","z":"c25d9bf9.208578","name":"If write, send read data to write server","info":"","x":1210,"y":980,"wires":[]},{"id":"10df8e97.8c9dc1","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1350,"y":540,"wires":[]},{"id":"47494505.d1e5ec","type":"comment","z":"c25d9bf9.208578","name":"Read Coils from Modbus Server","info":"","x":690,"y":340,"wires":[]},{"id":"2f0f1587.d9ddca","type":"modbus-flex-write","z":"c25d9bf9.208578","name":"","showStatusActivities":false,"showErrors":false,"server":"dafcee37.44008","x":950,"y":1220,"wires":[[],["faa6cd8a.e3b8d"]]},{"id":"2a4b593.aeb76a6","type":"function","z":"c25d9bf9.208578","name":"Inject Coil Value","func":"msg.topic = \"writescadapack\"\nmsg.payload = { \n value: msg.payload,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8 \n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":720,"y":1220,"wires":[["2f0f1587.d9ddca"]]},{"id":"3d6d4822.509078","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1180,"wires":[["bfc0f2f0.56681"]]},{"id":"faa6cd8a.e3b8d","type":"debug","z":"c25d9bf9.208578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"values.value","targetType":"msg","x":1220,"y":1220,"wires":[]},{"id":"bfc0f2f0.56681","type":"join","z":"c25d9bf9.208578","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"8","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":1220,"wires":[["2a4b593.aeb76a6"]]},{"id":"f680c167.d7384","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1240,"wires":[["bfc0f2f0.56681"]]},{"id":"d8390374.bf346","type":"link in","z":"c25d9bf9.208578","name":"From toggle","links":["8064d5f7.7d61e8"],"x":335,"y":1380,"wires":[["3cebe67a.8e053a","2a4b593.aeb76a6"]]},{"id":"8dcf11d7.0af54","type":"comment","z":"c25d9bf9.208578","name":"Copy coils in Modbus Server to Scadapack","info":"This stream will toggle the coils based on what is read from the RTU","x":240,"y":1340,"wires":[]},{"id":"2672422a.e7a0be","type":"comment","z":"c25d9bf9.208578","name":"Inject Boolean into Coils","info":"This stream will write to coils depending on values provided. Can configure the injection nodes to inject at specified times or intervals.","x":510,"y":1180,"wires":[]},{"id":"395f2f26.8af2e","type":"inject","z":"c25d9bf9.208578","name":"","topic":"readwrite","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1380,"wires":[["4888238.4738bdc","8ac76a1a.997958","7d99c884.ab6918"]]},{"id":"4888238.4738bdc","type":"link out","z":"c25d9bf9.208578","name":"Trigger to Read Coils","links":["9047e79b.46f898"],"x":355,"y":1500,"wires":[]},{"id":"3b05d40e.69ca0c","type":"comment","z":"c25d9bf9.208578","name":"Triggers Read Coils","info":"","x":410,"y":1460,"wires":[]},{"id":"7d99c884.ab6918","type":"link out","z":"c25d9bf9.208578","name":"Notify Read Coils of Trigger Press","links":["8449914f.dc71b"],"x":355,"y":1580,"wires":[]},{"id":"7d975676.993bf8","type":"comment","z":"c25d9bf9.208578","name":"Notify Funtion on Read Coils of Trigger Press","info":"","x":490,"y":1540,"wires":[]},{"id":"3cebe67a.8e053a","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":530,"y":1400,"wires":[]},{"id":"32f952e7.d88b5e","type":"comment","z":"c25d9bf9.208578","name":"Write Coils on SCADAPack","info":"","x":730,"y":1140,"wires":[]},{"id":"28fd74ed.5817ac","type":"modbus-response","z":"c25d9bf9.208578","name":"","registerShowMax":20,"x":930,"y":200,"wires":[]},{"id":"e815ef27.ef04e","type":"comment","z":"c25d9bf9.208578","name":"Note: any time you re-deploy it will clear the registers in the modbus server","info":"","x":900,"y":100,"wires":[]},{"id":"369413cd.8a0b2c","type":"modbus-flex-write","z":"c25d9bf9.208578","name":"","showStatusActivities":false,"showErrors":false,"server":"7bb65196.e1e0e","x":930,"y":1920,"wires":[[],["8326319d.3902"]]},{"id":"cd6235ec.bb59d8","type":"function","z":"c25d9bf9.208578","name":"Inject Coil Value","func":"msg.topic = \"writeserver\"\nmsg.payload = { \n value: msg.payload,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 0 , \n 'quantity': 8 \n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":700,"y":1920,"wires":[["369413cd.8a0b2c"]]},{"id":"801a36f8.58bff8","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1880,"wires":[["47ec8c8a.592824"]]},{"id":"8326319d.3902","type":"debug","z":"c25d9bf9.208578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"values.value","targetType":"msg","x":1200,"y":1920,"wires":[]},{"id":"47ec8c8a.592824","type":"join","z":"c25d9bf9.208578","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"8","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":490,"y":1920,"wires":[["cd6235ec.bb59d8"]]},{"id":"ae5a48d5.72d518","type":"inject","z":"c25d9bf9.208578","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1940,"wires":[["47ec8c8a.592824"]]},{"id":"4f4fcf4e.a3aff","type":"function","z":"c25d9bf9.208578","name":"Toggle Coils","func":"var toggleVal = []\nvar payload = []\npayload = msg.payload;\nmsg.topic = \"writeserver\"\nfor (let i=0; i < payload.length; i++){\n if (payload[i] === false) {\n toggleVal.push(true);\n } else if (payload[i] === true) {\n toggleVal.push(false);\n }\n}\n\nmsg.payload = { \n value: toggleVal,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 0 , \n 'quantity': 8 \n}\n\nnode.send(msg);\nreturn;\n","outputs":1,"noerr":0,"x":710,"y":2080,"wires":[["23195fda.1c8a","369413cd.8a0b2c"]]},{"id":"80c926c4.38da58","type":"link in","z":"c25d9bf9.208578","name":"From toggle","links":["7f5f5fb.5c5f2a"],"x":315,"y":2080,"wires":[["70c30ec0.b57ed","4f4fcf4e.a3aff"]]},{"id":"23195fda.1c8a","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":2080,"wires":[]},{"id":"52cd7de2.e7dcb4","type":"comment","z":"c25d9bf9.208578","name":"Toggle coils (based on read)","info":"This stream will toggle the coils based on what is read from the RTU","x":660,"y":2040,"wires":[]},{"id":"2c7b00bc.31b9f","type":"comment","z":"c25d9bf9.208578","name":"Inject Boolean into Coils","info":"This stream will write to coils depending on values provided. Can configure the injection nodes to inject at specified times or intervals.","x":490,"y":1880,"wires":[]},{"id":"e980af2e.84599","type":"inject","z":"c25d9bf9.208578","name":"","topic":"readwrite","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":2080,"wires":[["6403fb44.8c6824","51499ce0.3e7d24","7337912c.6ee3"]]},{"id":"6403fb44.8c6824","type":"link out","z":"c25d9bf9.208578","name":"Trigger to Read Coils (server)","links":["a39d08c4.9222d8"],"x":335,"y":2200,"wires":[]},{"id":"5a8d9bae.c28494","type":"comment","z":"c25d9bf9.208578","name":"Triggers Read Coils","info":"","x":390,"y":2160,"wires":[]},{"id":"51499ce0.3e7d24","type":"link out","z":"c25d9bf9.208578","name":"Notify Read Coils of Trigger Press (server)","links":["d9b9f469.407a78"],"x":335,"y":2280,"wires":[]},{"id":"4199ba95.79d664","type":"comment","z":"c25d9bf9.208578","name":"Notify Funtion on reading server of trigger press","info":"","x":480,"y":2240,"wires":[]},{"id":"70c30ec0.b57ed","type":"debug","z":"c25d9bf9.208578","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":2120,"wires":[]},{"id":"60d9aca3.a526d4","type":"comment","z":"c25d9bf9.208578","name":"#################### ----- Write Coils on Modbus Server ---- ####################","info":"","x":710,"y":1820,"wires":[]},{"id":"2f05f3b0.cf274c","type":"comment","z":"c25d9bf9.208578","name":"Manual write","info":"","x":230,"y":1140,"wires":[]},{"id":"7f5f5fb.5c5f2a","type":"link out","z":"c25d9bf9.208578","name":"To toggle","links":["80c926c4.38da58"],"x":1015,"y":980,"wires":[]},{"id":"c5876399.95f3d","type":"split","z":"c25d9bf9.208578","name":"Split Messages by Payload","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"topic","x":540,"y":900,"wires":[["644ae01e.73f56"]]},{"id":"af2196da.f7a1c8","type":"function","z":"c25d9bf9.208578","name":"Read or Read/Write?","func":"msg.topic = \"\"\nif (typeof msg.payload.readwrite != \"undefined\") {\n msg.payload = msg.payload.data;\n node.send(msg);\n} else {\n return null;\n}","outputs":1,"noerr":0,"x":740,"y":1000,"wires":[["c8729406.6a9c38","a74af39f.bf5e3"]]},{"id":"644ae01e.73f56","type":"join","z":"c25d9bf9.208578","name":"Combine the Messages by Payload","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1000,"y":900,"wires":[["c35ed375.979f2"]]},{"id":"c8729406.6a9c38","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":1060,"wires":[]},{"id":"efdbda87.d81588","type":"comment","z":"c25d9bf9.208578","name":"If write, send read data to write scadapack","info":"","x":1230,"y":720,"wires":[]},{"id":"2ef424b.894efdc","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1350,"y":800,"wires":[]},{"id":"d9b9f469.407a78","type":"link in","z":"c25d9bf9.208578","name":"","links":["51499ce0.3e7d24"],"x":215,"y":900,"wires":[["32eca720.777278"]]},{"id":"8905d4f4.e4a448","type":"comment","z":"c25d9bf9.208578","name":"Notify to write coils on server","info":"","x":220,"y":840,"wires":[]},{"id":"63bd6bee.05eb54","type":"comment","z":"c25d9bf9.208578","name":"Read modbus server and toggle values in it","info":"","x":170,"y":2040,"wires":[]},{"id":"6c14baf3.272b64","type":"comment","z":"c25d9bf9.208578","name":"Copy coils in scadapack to modbus server","info":"","x":200,"y":2380,"wires":[]},{"id":"4593212f.78a37","type":"link in","z":"c25d9bf9.208578","name":"Write coils on server read from scadapack","links":["942e2599.933c78"],"x":315,"y":2420,"wires":[["81c17223.fa21d","cd6235ec.bb59d8"]]},{"id":"3d7e97e2.41c878","type":"inject","z":"c25d9bf9.208578","name":"","topic":"readwrite","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":2420,"wires":[["a0691c2a.eadc8","e17b8e09.ef3f"]]},{"id":"a0691c2a.eadc8","type":"link out","z":"c25d9bf9.208578","name":"Trigger to Read Coils","links":["9c7a835a.92637"],"x":315,"y":2520,"wires":[]},{"id":"45fabdb2.94f6f4","type":"comment","z":"c25d9bf9.208578","name":"Triggers Read Coils","info":"","x":350,"y":2480,"wires":[]},{"id":"e17b8e09.ef3f","type":"link out","z":"c25d9bf9.208578","name":"Notify Read Coils of Trigger Press","links":["3daa4d7c.1a0a72"],"x":315,"y":2600,"wires":[]},{"id":"710745ab.9b418c","type":"comment","z":"c25d9bf9.208578","name":"Notify Funtion on Read Coils of Trigger Press","info":"","x":450,"y":2560,"wires":[]},{"id":"81c17223.fa21d","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":2440,"wires":[]},{"id":"a2bc0341.d375f","type":"comment","z":"c25d9bf9.208578","name":"Read directly from modbus server","info":"","x":200,"y":360,"wires":[]},{"id":"9047e79b.46f898","type":"link in","z":"c25d9bf9.208578","name":"Trigger Read to toggle","links":["4888238.4738bdc"],"x":295,"y":520,"wires":[["d88703f4.0a6b"]]},{"id":"b676bdfb.e07ac","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":560,"wires":[]},{"id":"18a309c9.8afbb6","type":"function","z":"c25d9bf9.208578","name":"Send Message.complete=true","func":"msg.topic = \"refreshjoin_node\"\nmsg.complete = true;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":740,"wires":[["644ae01e.73f56","4e4e27e8.2c66f8"]]},{"id":"61d9aff5.a95ea","type":"function","z":"c25d9bf9.208578","name":"Send Message.complete=true","func":"msg.topic = \"refreshjoin_node\"\nmsg.complete = true;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":700,"wires":[["4e4e27e8.2c66f8"]]},{"id":"48fed9f2.d2c4a8","type":"function","z":"c25d9bf9.208578","name":"Send Message.complete=true","func":"msg.topic = \"refreshjoin_node\"\nmsg.complete = true;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":780,"wires":[["644ae01e.73f56"]]},{"id":"7337912c.6ee3","type":"link out","z":"c25d9bf9.208578","name":"send a refresh to join for scadapack write as it is not used when this button pressed","links":["5047d7e5.8ae378"],"x":275,"y":2000,"wires":[]},{"id":"5047d7e5.8ae378","type":"link in","z":"c25d9bf9.208578","name":"","links":["7337912c.6ee3"],"x":75,"y":700,"wires":[["61d9aff5.a95ea"]]},{"id":"21dec329.22df0c","type":"link in","z":"c25d9bf9.208578","name":"Refresh Join for server write","links":["8ac76a1a.997958"],"x":75,"y":780,"wires":[["48fed9f2.d2c4a8"]]},{"id":"8ac76a1a.997958","type":"link out","z":"c25d9bf9.208578","name":"Send a resfresh to the join for server write as it is not in use when this is pressed","links":["21dec329.22df0c"],"x":315,"y":1300,"wires":[]},{"id":"7d504496.e3099c","type":"switch","z":"c25d9bf9.208578","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"refreshjoin_node","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1230,"y":620,"wires":[["10df8e97.8c9dc1","54afaad2.46edc4"],["4d750a74.279c04","22f04bd9.4b4304"]]},{"id":"54afaad2.46edc4","type":"function","z":"c25d9bf9.208578","name":"NULL","func":"\nreturn null;","outputs":1,"noerr":0,"x":1370,"y":580,"wires":[[]]},{"id":"c35ed375.979f2","type":"switch","z":"c25d9bf9.208578","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"refreshjoin_node","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1230,"y":880,"wires":[["2ef424b.894efdc","7c80c309.d45f8c"],["af2196da.f7a1c8","64bd36c3.27df58"]]},{"id":"7c80c309.d45f8c","type":"function","z":"c25d9bf9.208578","name":"NULL","func":"\nreturn null;","outputs":1,"noerr":0,"x":1370,"y":840,"wires":[[]]},{"id":"64bd36c3.27df58","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1370,"y":900,"wires":[]},{"id":"22f04bd9.4b4304","type":"debug","z":"c25d9bf9.208578","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1410,"y":620,"wires":[]},{"id":"98c82bb6.657268","type":"comment","z":"c25d9bf9.208578","name":"Could try putting the switch node before the splits","info":"","x":510,"y":540,"wires":[]},{"id":"d53fa529.3343b8","type":"delay","z":"c25d9bf9.208578","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":640,"wires":[["f08629e9.665898"]]},{"id":"32eca720.777278","type":"delay","z":"c25d9bf9.208578","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":900,"wires":[["c5876399.95f3d"]]},{"id":"a74af39f.bf5e3","type":"delay","z":"c25d9bf9.208578","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":980,"wires":[["7f5f5fb.5c5f2a"]]},{"id":"51062589.ef71bc","type":"delay","z":"c25d9bf9.208578","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":720,"wires":[["8064d5f7.7d61e8"]]},{"id":"7bb65196.e1e0e","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.1","tcpPort":"10502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":false,"reconnectTimeout":"2000","parallelUnitIdsAllowed":false},{"id":"dafcee37.44008","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.100","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"a78e6ab9.1f27f8","type":"tab","label":"Read Coils","disabled":true,"info":""},{"id":"dc47fc77.b646","type":"modbus-flex-getter","z":"a78e6ab9.1f27f8","name":"","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"server":"dafcee37.44008","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":780,"y":220,"wires":[[],["da338f56.dd88f","99436220.f6267","13105176.15ca5f"]]},{"id":"2bfe37ec.218a78","type":"inject","z":"a78e6ab9.1f27f8","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":220,"wires":[["b2011a0f.75fea8","6b763d94.48da84"]]},{"id":"da338f56.dd88f","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.data","targetType":"msg","x":1070,"y":220,"wires":[]},{"id":"b2011a0f.75fea8","type":"function","z":"a78e6ab9.1f27f8","name":"FC1 99 [8] (read 8 coils)","func":"msg.topic = 'read'\nmsg.payload = { \n 'fc': 1, //'fc' is the function code. 1 means read coil-status\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8\n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":530,"y":220,"wires":[["dc47fc77.b646"]]},{"id":"3b335d1d.3c9df2","type":"link in","z":"a78e6ab9.1f27f8","name":"Trigger Read to toggle","links":["65572cc8.63cfe4"],"x":255,"y":300,"wires":[["b2011a0f.75fea8"]]},{"id":"2fd76982.8b11e6","type":"link out","z":"a78e6ab9.1f27f8","name":"To toggle","links":["750ff296.bb3c3c"],"x":995,"y":540,"wires":[]},{"id":"c22299ef.453988","type":"link in","z":"a78e6ab9.1f27f8","name":"Notify Function","links":["d35d83c7.cb106"],"x":215,"y":460,"wires":[["715ea3dd.22020c"]]},{"id":"99436220.f6267","type":"split","z":"a78e6ab9.1f27f8","name":"Split Messages by Payload Values","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"topic","x":580,"y":460,"wires":[["5b19819.781cd8","2bb30bdd.fc22d4"]]},{"id":"d43dbef5.3c4f2","type":"function","z":"a78e6ab9.1f27f8","name":"Read or Read/Write?","func":"msg.topic = \"\"\nif (typeof msg.payload.readwrite != \"undefined\") {\n msg.payload = msg.payload.data;\n node.send(msg);\n} else {\n return null;\n}","outputs":1,"noerr":0,"x":680,"y":540,"wires":[["ea339ea8.c2349","62c146e6.ea72c8"]]},{"id":"2bb30bdd.fc22d4","type":"join","z":"a78e6ab9.1f27f8","name":"Combine the Messages by Payload","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1000,"y":460,"wires":[["d43dbef5.3c4f2","9563d59d.e1d6a8"]]},{"id":"9563d59d.e1d6a8","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1310,"y":400,"wires":[]},{"id":"f391b2ea.6d098","type":"comment","z":"a78e6ab9.1f27f8","name":"Split messages and recombine after 3 messages to make one message with all payloads","info":"","x":810,"y":420,"wires":[]},{"id":"e87bb388.98663","type":"comment","z":"a78e6ab9.1f27f8","name":"Trigger from Write Coils","info":"","x":120,"y":300,"wires":[]},{"id":"bd71c137.1ae05","type":"comment","z":"a78e6ab9.1f27f8","name":"Notify Function we will Write from write coils","info":"","x":190,"y":420,"wires":[]},{"id":"254b98f.edae568","type":"comment","z":"a78e6ab9.1f27f8","name":"If write, send read data to Toggle Function","info":"","x":1160,"y":540,"wires":[]},{"id":"ea339ea8.c2349","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":910,"y":640,"wires":[]},{"id":"c196d9bc.a3dff8","type":"comment","z":"a78e6ab9.1f27f8","name":"This Inject for Read Only","info":"","x":210,"y":180,"wires":[]},{"id":"5b19819.781cd8","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":880,"y":360,"wires":[]},{"id":"942e2599.933c78","type":"link out","z":"a78e6ab9.1f27f8","name":"Write to modbus server","links":["4593212f.78a37"],"x":975,"y":960,"wires":[]},{"id":"3daa4d7c.1a0a72","type":"link in","z":"a78e6ab9.1f27f8","name":"Notify Function","links":["e17b8e09.ef3f"],"x":235,"y":880,"wires":[["fce51bbf.ac00e8","149f418e.0184ae"]]},{"id":"13105176.15ca5f","type":"split","z":"a78e6ab9.1f27f8","name":"Split Messages by Payload Values","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"topic","x":600,"y":880,"wires":[["5aead87.1b48528","de7f7e69.8cf45"]]},{"id":"f9dae3ae.c7f71","type":"function","z":"a78e6ab9.1f27f8","name":"Read or Read/Write?","func":"msg.topic = \"\"\nif (typeof msg.payload.readwrite != \"undefined\") {\n msg.payload = msg.payload.data;\n node.send(msg);\n} else {\n return null;\n}","outputs":1,"noerr":0,"x":700,"y":960,"wires":[["9125aa9d.47e968","cf4a6091.edb76"]]},{"id":"de7f7e69.8cf45","type":"join","z":"a78e6ab9.1f27f8","name":"Combine the Messages by Payload","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1020,"y":880,"wires":[["f9dae3ae.c7f71","673b844.a5f907c"]]},{"id":"673b844.a5f907c","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1330,"y":820,"wires":[]},{"id":"2f0959ee.dcde26","type":"comment","z":"a78e6ab9.1f27f8","name":"Split messages and recombine after 3 messages to make one message with all payloads","info":"","x":830,"y":840,"wires":[]},{"id":"88d25d43.c87e5","type":"comment","z":"a78e6ab9.1f27f8","name":"Notify Function we will Write from write coils","info":"","x":210,"y":840,"wires":[]},{"id":"579b1fe1.28f5e","type":"comment","z":"a78e6ab9.1f27f8","name":"If write, send read data to Toggle Function","info":"","x":1160,"y":960,"wires":[]},{"id":"9125aa9d.47e968","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":1060,"wires":[]},{"id":"5aead87.1b48528","type":"debug","z":"a78e6ab9.1f27f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":900,"y":780,"wires":[]},{"id":"9c7a835a.92637","type":"link in","z":"a78e6ab9.1f27f8","name":"Trigger Read to toggle","links":["a0691c2a.eadc8"],"x":255,"y":340,"wires":[["b2011a0f.75fea8"]]},{"id":"715ea3dd.22020c","type":"delay","z":"a78e6ab9.1f27f8","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":460,"wires":[["99436220.f6267"]]},{"id":"62c146e6.ea72c8","type":"delay","z":"a78e6ab9.1f27f8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":880,"y":540,"wires":[["2fd76982.8b11e6"]]},{"id":"fce51bbf.ac00e8","type":"delay","z":"a78e6ab9.1f27f8","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":350,"y":900,"wires":[["13105176.15ca5f"]]},{"id":"cf4a6091.edb76","type":"delay","z":"a78e6ab9.1f27f8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":880,"y":960,"wires":[["942e2599.933c78"]]},{"id":"149f418e.0184ae","type":"function","z":"a78e6ab9.1f27f8","name":"Send Message.complete=true","func":"msg.topic = \"refreshjoin_node\"\nmsg.complete = true;\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":600,"wires":[["2bb30bdd.fc22d4"]]},{"id":"6b763d94.48da84","type":"function","z":"a78e6ab9.1f27f8","name":"Send Message.complete=true","func":"msg.topic = \"refreshjoin_node\"\nmsg.complete = true;\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":560,"wires":[["de7f7e69.8cf45"]]},{"id":"dafcee37.44008","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.100","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"ff89c0c6.facf8","type":"tab","label":"Write Coils","disabled":true,"info":""},{"id":"a05d7f88.2bbea","type":"modbus-flex-write","z":"ff89c0c6.facf8","name":"","showStatusActivities":false,"showErrors":false,"server":"dafcee37.44008","x":870,"y":280,"wires":[[],["e6fbf25d.2bd76"]]},{"id":"d126fd1e.13b43","type":"function","z":"ff89c0c6.facf8","name":"Inject Coil Value","func":"msg.topic = \"write\"\nmsg.payload = { \n value: msg.payload,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8 \n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":640,"y":280,"wires":[["a05d7f88.2bbea","7fae1ea1.58de9"]]},{"id":"195402d1.461d7d","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":240,"wires":[["bb50788a.449f58"]]},{"id":"e6fbf25d.2bd76","type":"debug","z":"ff89c0c6.facf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"values.value","targetType":"msg","x":1140,"y":280,"wires":[]},{"id":"bb50788a.449f58","type":"join","z":"ff89c0c6.facf8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"8","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":280,"wires":[["d126fd1e.13b43"]]},{"id":"1d1a3e82.461b11","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":340,"wires":[["bb50788a.449f58"]]},{"id":"230df50b.6cb24a","type":"function","z":"ff89c0c6.facf8","name":"Toggle Coils","func":"var toggleVal = []\nvar payload = []\npayload = msg.payload;\nmsg.topic = \"write/read\";\n\nfor (let i=0; i < payload.length; i++){\n if (payload[i] === false) {\n toggleVal.push(true);\n } else if (payload[i] === true) {\n toggleVal.push(false);\n }\n}\n\nmsg.payload = { \n value: toggleVal,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8 \n};\n\nnode.send(msg);\nreturn;\n","outputs":1,"noerr":0,"x":650,"y":440,"wires":[["bdd89fc5.8b1cc","a05d7f88.2bbea","7fae1ea1.58de9"]]},{"id":"750ff296.bb3c3c","type":"link in","z":"ff89c0c6.facf8","name":"From toggle","links":["2fd76982.8b11e6"],"x":255,"y":440,"wires":[["619ad94.f5d2228","230df50b.6cb24a"]]},{"id":"bdd89fc5.8b1cc","type":"debug","z":"ff89c0c6.facf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":440,"wires":[]},{"id":"ee0a5ac4.ad6ca8","type":"comment","z":"ff89c0c6.facf8","name":"Toggle coils (based on read)","info":"This stream will toggle the coils based on what is read from the RTU","x":420,"y":400,"wires":[]},{"id":"448f0712.4b73d8","type":"comment","z":"ff89c0c6.facf8","name":"Inject Boolean into Coils","info":"This stream will write to coils depending on values provided. Can configure the injection nodes to inject at specified times or intervals.","x":430,"y":240,"wires":[]},{"id":"871815eb.80a9b8","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"readwrite","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":440,"wires":[["65572cc8.63cfe4","d35d83c7.cb106"]]},{"id":"65572cc8.63cfe4","type":"link out","z":"ff89c0c6.facf8","name":"Trigger to Read Coils","links":["3b335d1d.3c9df2"],"x":275,"y":560,"wires":[]},{"id":"73889dee.0c9fa4","type":"comment","z":"ff89c0c6.facf8","name":"Triggers Read Coils","info":"","x":330,"y":520,"wires":[]},{"id":"d35d83c7.cb106","type":"link out","z":"ff89c0c6.facf8","name":"Notify Read Coils of Trigger Press","links":["c22299ef.453988"],"x":275,"y":640,"wires":[]},{"id":"7edbc44e.d1d12c","type":"comment","z":"ff89c0c6.facf8","name":"Notify Funtion on Read Coils of Trigger Press","info":"","x":410,"y":600,"wires":[]},{"id":"619ad94.f5d2228","type":"debug","z":"ff89c0c6.facf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":480,"wires":[]},{"id":"7fae1ea1.58de9","type":"debug","z":"ff89c0c6.facf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":200,"wires":[]},{"id":"dafcee37.44008","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.100","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"ff89c0c6.facf8","type":"tab","label":"Write Coils","disabled":true,"info":""},{"id":"a05d7f88.2bbea","type":"modbus-flex-write","z":"ff89c0c6.facf8","name":"","showStatusActivities":false,"showErrors":false,"server":"dafcee37.44008","x":870,"y":280,"wires":[[],["e6fbf25d.2bd76"]]},{"id":"d126fd1e.13b43","type":"function","z":"ff89c0c6.facf8","name":"Inject Coil Value","func":"msg.topic = \"write\"\nmsg.payload = { \n value: msg.payload,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8 \n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":640,"y":280,"wires":[["a05d7f88.2bbea","7fae1ea1.58de9"]]},{"id":"195402d1.461d7d","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":240,"wires":[["bb50788a.449f58"]]},{"id":"e6fbf25d.2bd76","type":"debug","z":"ff89c0c6.facf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"values.value","targetType":"msg","x":1140,"y":280,"wires":[]},{"id":"bb50788a.449f58","type":"join","z":"ff89c0c6.facf8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"8","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":280,"wires":[["d126fd1e.13b43"]]},{"id":"1d1a3e82.461b11","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":340,"wires":[["bb50788a.449f58"]]},{"id":"230df50b.6cb24a","type":"function","z":"ff89c0c6.facf8","name":"Toggle Coils","func":"var toggleVal = []\nvar payload = []\npayload = msg.payload;\nmsg.topic = \"write/read\";\n\nfor (let i=0; i < payload.length; i++){\n if (payload[i] === false) {\n toggleVal.push(true);\n } else if (payload[i] === true) {\n toggleVal.push(false);\n }\n}\n\nmsg.payload = { \n value: toggleVal,\n 'fc': 15, //force multiple coils\n 'unitid': 0, \n 'address': 99 , \n 'quantity': 8 \n};\n\nnode.send(msg);\nreturn;\n","outputs":1,"noerr":0,"x":650,"y":440,"wires":[["bdd89fc5.8b1cc","a05d7f88.2bbea","7fae1ea1.58de9"]]},{"id":"750ff296.bb3c3c","type":"link in","z":"ff89c0c6.facf8","name":"From toggle","links":["2fd76982.8b11e6"],"x":255,"y":440,"wires":[["619ad94.f5d2228","230df50b.6cb24a"]]},{"id":"bdd89fc5.8b1cc","type":"debug","z":"ff89c0c6.facf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":440,"wires":[]},{"id":"ee0a5ac4.ad6ca8","type":"comment","z":"ff89c0c6.facf8","name":"Toggle coils (based on read)","info":"This stream will toggle the coils based on what is read from the RTU","x":420,"y":400,"wires":[]},{"id":"448f0712.4b73d8","type":"comment","z":"ff89c0c6.facf8","name":"Inject Boolean into Coils","info":"This stream will write to coils depending on values provided. Can configure the injection nodes to inject at specified times or intervals.","x":430,"y":240,"wires":[]},{"id":"871815eb.80a9b8","type":"inject","z":"ff89c0c6.facf8","name":"","topic":"readwrite","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":440,"wires":[["65572cc8.63cfe4","d35d83c7.cb106"]]},{"id":"65572cc8.63cfe4","type":"link out","z":"ff89c0c6.facf8","name":"Trigger to Read Coils","links":["3b335d1d.3c9df2"],"x":275,"y":560,"wires":[]},{"id":"73889dee.0c9fa4","type":"comment","z":"ff89c0c6.facf8","name":"Triggers Read Coils","info":"","x":330,"y":520,"wires":[]},{"id":"d35d83c7.cb106","type":"link out","z":"ff89c0c6.facf8","name":"Notify Read Coils of Trigger Press","links":["c22299ef.453988"],"x":275,"y":640,"wires":[]},{"id":"7edbc44e.d1d12c","type":"comment","z":"ff89c0c6.facf8","name":"Notify Funtion on Read Coils of Trigger Press","info":"","x":410,"y":600,"wires":[]},{"id":"619ad94.f5d2228","type":"debug","z":"ff89c0c6.facf8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":480,"wires":[]},{"id":"7fae1ea1.58de9","type":"debug","z":"ff89c0c6.facf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":200,"wires":[]},{"id":"dafcee37.44008","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.100","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [{"id":"7bd0dde2.4b0ac4","type":"tab","label":"Write Floats","disabled":true,"info":""},{"id":"3a67e4c4.e7110c","type":"modbus-flex-write","z":"7bd0dde2.4b0ac4","name":"","showStatusActivities":false,"showErrors":false,"server":"dafcee37.44008","x":870,"y":320,"wires":[[],["1614cf47.822d51"]]},{"id":"c88ecbfe.5617c8","type":"function","z":"7bd0dde2.4b0ac4","name":"Inject Float","func":"msg.payload = { \n value: msg.payload,\n 'fc': 16, //preset multiple register\n 'unitid': 0, \n 'address': 499 , \n 'quantity': 2\n}; \nreturn msg;\n","outputs":1,"noerr":0,"x":630,"y":320,"wires":[["3a67e4c4.e7110c"]]},{"id":"7dd67f1f.007c4","type":"inject","z":"7bd0dde2.4b0ac4","name":"","topic":"","payload":"-62.354","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":320,"wires":[["4e32db9c.053464"]]},{"id":"1614cf47.822d51","type":"debug","z":"7bd0dde2.4b0ac4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1100,"y":320,"wires":[]},{"id":"4e32db9c.053464","type":"function","z":"7bd0dde2.4b0ac4","name":"Float32 to Uint16","func":"let base = new ArrayBuffer(4); //4 bytes\n//I had to change this next line to Uint16Array\n//from Int16Array. The Flex Writer needs Unsigned Int\nlet int16_view = new Uint16Array(base);\nlet float32_view = new Float32Array(base);\n\nvar payload = msg.payload;\nfloat32_view[0] = payload;\n\nlet rValue = [];\nrValue.push(int16_view[0]);\nrValue.push(int16_view[1]);\n\nmsg.payload = rValue;\nmsg.payload.reverse();\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":320,"wires":[["c88ecbfe.5617c8"]]},{"id":"dafcee37.44008","type":"modbus-client","z":"","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"10.10.10.100","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment