{"library":"node-red-node-serialport","title":"Node-RED Serial Port Communication Nodes","description":"node-red-node-serialport provides a set of nodes for Node-RED, enabling communication with hardware serial ports (e.g., RS232, RS485, USB-to-serial adapters). It integrates the widely used `serialport` library to offer Input, Output, Request, and Control nodes directly within the Node-RED visual programming environment. The current stable version is 2.0.3, released in late 2023. This package is actively maintained, with significant updates in major versions to align with Node.js and underlying `serialport` library advancements. Its primary differentiator is seamless integration into Node-RED flows, allowing developers to manage serial communications visually and programmatically without writing custom boilerplate code for port management.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install node-red-node-serialport"],"cli":null},"imports":["Drag 'Serial In' node from Node-RED palette onto canvas.","Drag 'Serial Out' node from Node-RED palette onto canvas.","Drag 'Serial Control' node from Node-RED palette onto canvas."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/*\n  To install node-red-node-serialport, run this command in your Node-RED user directory (typically ~/.node-red):\n*/\nnpm i node-red-node-serialport\n\n/*\n  After installation, the nodes will appear in your Node-RED palette.\n  To dynamically control a serial port, configure a 'Serial Control' node\n  and send it a message like the following (e.g., from an 'Inject' node\n  or 'Function' node):\n*/\n\n// Example message to configure and enable a serial port via a 'Serial Control' node\nconst controlMessage = {\n    \"payload\": {\n        \"serialport\": \"/dev/ttyUSB0\", // Or \"COM1\" on Windows\n        \"serialbaud\": 115200,\n        \"databits\": 8,\n        \"parity\": \"none\",\n        \"stopbits\": 1,\n        \"enabled\": true\n    }\n};\n\n// In a Node-RED Function node, you would typically return msg like this:\n// return controlMessage;\n\nconsole.log(\"Node-RED Serial Control Message Example:\", controlMessage);\n// In a real Node-RED flow, this message would be wired into a 'Serial Control' node.\n","lang":"javascript","description":"Illustrates how to install the Node-RED package and provides a JavaScript object representing a message payload to programmatically configure and control a serial port using the 'Serial Control' node in a Node-RED flow.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}