{"_id":"@bkmj/node-red-contrib-flow-switch","name":"@bkmj/node-red-contrib-flow-switch","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bkmj/node-red-contrib-flow-switch","version":"0.1.0","description":"Un nœud Node-RED qui agit comme un interrupteur avec un bouton UI sur le nœud.","dependencies":{},"keywords":["node-red"],"node-red":{"nodes":{"flow-switch":"flow-switch.js"}},"license":"Apache-2.0","author":{"name":"Marc-André Morneau","email":"ma.morneau.1@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/mamorneau/node-red-contrib-flow-switch.git"},"bugs":{"url":"https://github.com/mamorneau/node-red-contrib-flow-switch/issues"},"homepage":"https://github.com/mamorneau/node-red-contrib-flow-switch#readme","_id":"@bkmj/node-red-contrib-flow-switch@0.1.0","gitHead":"baa41ccea78d274c629e379588f74c7eddfabc03","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-4Sr0W9FqIatytBGj4N7zor/1TPXcELdQmnPjys68ITf6wD+Xw7bQgXqmzohUInF8u447cLSWLxFWGvqF5u8+Jg==","shasum":"607c90b0176aac4f1ce3a60ecf307cfddbee8364","tarball":"https://registry.npmjs.org/@bkmj/node-red-contrib-flow-switch/-/node-red-contrib-flow-switch-0.1.0.tgz","fileCount":6,"unpackedSize":32674,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDtYS3+ujPJZlDDpZqvtFzpWHsT2u9KWFoeLIwVmC3nZQIhANlb+4NKUdb6WAt+wXn+7SxVi6450iKghN8Utz/rcVRD"}]},"_npmUser":{"name":"mmorneau","email":"ma.morneau.1@gmail.com"},"directories":{},"maintainers":[{"name":"bkmjiot","email":"mlafreniere@bradken.com"},{"name":"danychasse","email":"dchasse@bradken.com"},{"name":"mmorneau","email":"ma.morneau.1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node-red-contrib-flow-switch_0.1.0_1748831137874_0.7989697353812972"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-02T02:25:37.754Z","0.1.0":"2025-06-02T02:25:38.062Z","modified":"2025-06-02T02:25:38.403Z"},"maintainers":[{"name":"bkmjiot","email":"mlafreniere@bradken.com"},{"name":"danychasse","email":"dchasse@bradken.com"},{"name":"mmorneau","email":"ma.morneau.1@gmail.com"}],"description":"Un nœud Node-RED qui agit comme un interrupteur avec un bouton UI sur le nœud.","homepage":"https://github.com/mamorneau/node-red-contrib-flow-switch#readme","keywords":["node-red"],"repository":{"type":"git","url":"git+https://github.com/mamorneau/node-red-contrib-flow-switch.git"},"author":{"name":"Marc-André Morneau","email":"ma.morneau.1@gmail.com"},"bugs":{"url":"https://github.com/mamorneau/node-red-contrib-flow-switch/issues"},"license":"Apache-2.0","readme":"# Node-RED Contrib Flow Switch\r\n\r\nA Node-RED node that acts as a switch to control the passage of messages, with a UI button directly on the node and the ability to control it via incoming messages.\r\n\r\n[Image of an example of the flow-switch node in Node-RED]\r\n\r\n## Features\r\n\r\n* **Integrated UI Button:** Toggle the node's state (ON/OFF) directly from the Node-RED editor by clicking the node's button.\r\n* **Message Control:** Change the node's state by sending a message with a specific `msg.topic` and `msg.payload`.\r\n* **Configurable Deploy State:**\r\n    * Choose to initialize the node with a specific state (ON or OFF) upon each deployment.\r\n    * Or, retain the node's last active state before deployment.\r\n* **Customizable Status Texts:** Define the texts displayed below the node for the ON and OFF states.\r\n* **Control Message Passthrough:** Option to allow the control message to pass through to the node's output after it has acted on the switch.\r\n* **Internationalization:** Support for English (en-US) and Canadian French (fr-CA) for the configuration interface.\r\n\r\n## Installation\r\n\r\nTo install this node:\r\n\r\n1.  **Via npm (Recommended):**\r\n    * Navigate to your Node-RED user directory (typically `~/.node-red`).\r\n    * Run the following command:\r\n        ```bash\r\n        npm install @bkmj/node-red-contrib-flow-switch\r\n        ```\r\n    * Restart Node-RED.\r\n\r\n    *(Note: If this package is not yet published to npm, you would typically install it by cloning the Git repository directly into your `~/.node-red/nodes` directory and then restarting Node-RED.)*\r\n\r\n## Configuration\r\n\r\nWhen you add a `flow-switch` node to your flow, you can configure the following properties in its edit panel:\r\n\r\n* **Name:** An optional name for this node instance.\r\n* **Behavior on Deploy:**\r\n    * `Use 'Initial state on deploy' value`: The node will adopt the state defined below upon each deployment.\r\n    * `Keep last active state`: The node will remember its last active state (ON/OFF) before deployment and restore it.\r\n* **Initial state on deploy:** The state (on/off) the node will adopt if the above option is selected.\r\n* **Pass through control message?:** If checked, the message that was used to control the switch will be forwarded to the node's output. Otherwise, it is consumed.\r\n\r\n### Status Display (under the node)\r\n* **Text if ON:** The text to display below the node when the switch is ON (default: \"on\").\r\n* **Text if OFF:** The text to display below the node when the switch is OFF (default: \"off\").\r\n\r\n### Control by Message\r\n* **Control Topic:** The `msg.topic` the node will listen to for commands (default: \"control\").\r\n* **Control Values (`msg.payload`):**\r\n    * **for ON:** The `msg.payload` that will activate the switch (default: \"on\").\r\n    * **for OFF:** The `msg.payload` that will deactivate the switch (default: \"off\").\r\n    * **for Toggle:** The `msg.payload` that will invert the switch's state (default: \"toggle\").\r\n\r\n## Usage\r\n\r\n### Via the UI Button\r\nClick the button on the right side of the node in the Node-RED editor to change the switch's active state. The status under the node will update.\r\n\r\n### By Message\r\n1.  Configure the \"Control Topic\" in the node's edit panel (e.g., `cmnd/mySwitch/state`).\r\n2.  Configure the \"Control Values\" for ON, OFF, and Toggle actions.\r\n3.  Send a message to the `flow-switch` node with:\r\n    * `msg.topic` matching the configured \"Control Topic\".\r\n    * `msg.payload` matching one of the configured \"Control Values\".\r\n\r\n**Example:**\r\nIf \"Control Topic\" is `control` and \"Value for ON\" is `true`:\r\nAn incoming message with `msg.topic = \"control\"` and `msg.payload = true` will turn the switch ON.\r\n\r\n### Flow Behavior\r\n* If the switch is **ON**, incoming messages (that are not control messages) are passed to the output.\r\n* If the switch is **OFF**, incoming messages (that are not control messages) are blocked.\r\n* Control messages are consumed by the node (do not pass to the output) unless the \"Pass through control message?\" option is checked.\r\n\r\n## Development\r\n\r\n### Language Files\r\nTranslations are managed in the `locales` directory.\r\n* `locales/en-US/flow-switch.json` for English.\r\n* `locales/fr-CA/flow-switch.json` for Canadian French.\r\n\r\nFeel free to contribute with other translations!\r\n\r\n## License\r\n\r\nThis project is licensed under the Apache-2.0 License.\r\n","readmeFilename":"README.md","_rev":"1-bfef61ee6788668366ff85c724a4ebab"}