Optimized OpenBeken support for Node-RED with Dashboard 2.0 dynamic UI updates
npm install node-red-contrib-openbeken-subflownode-red-contrib-openbeken-subflow
==================================
A high-performance Node-RED subflow designed specifically for OpenBeken flashed hardware. This node simplifies the integration of devices using Flag 10 and Flag 2 (immediate MQTT state feedback), provides built-in watchdog monitoring, and supports Cross-Device Synchronization for 3-way switch configurations.
Features
--------
* Closed-Loop Feedback: Automatically synchronizes with the device state using the .../1/get topic.
* Watchdog Timer: Monitors device activity and updates the node status to "Offline" if no heartbeat is detected within 5 minutes.
* State-Sync Groups: Support for multi-way (3-way/4-way) switching. Link multiple devices via a Global context to ensure states match even if UDP packets are dropped or firewalled.
* Smart Sanitization: Accepts Booleans (true/false), Strings ("on"/"off"), or Numbers (1/0) and converts them to the correct format for OpenBeken.
* Dashboard 2.0 Ready: Native support for UI updates including icon/color changes based on device connectivity.
Hardware Requirements
---------------------
For the best experience, ensure your OpenBeken device has Flag 10 and Flag 2 enabled. Open your device's web console and run:Backlog Flag 10 1; Flag 2 1; restart
Configuration
-------------
1. Broker: Select your MQTT Broker configuration node.
2. Topic Base: Enter the base MQTT topic of your device (e.g., KitchenLights). Do not include trailing slashes.
3. Sync Group (Optional): Enter a unique string (e.g., Kitchen3Way) to link multiple nodes together. Nodes sharing the same group name will stay synchronized automatically.
3-Way Switching Setup (Cross-Sync)
----------------------------------
To use this node as a backup for OpenBeken Device Groups (or when UDP is blocked):
1. Give both nodes the same Sync Group name.
2. Cross-connect the nodes in your flow: Wire Output 1 of Node A to Input 1 of Node B, and vice versa.
3. The nodes use a source: "from\_hw" tag to prevent infinite relay loops.
Input/Output
------------
* Input: Send a boolean true/false or string "on"/"off" to toggle the device.
* Output 1: Returns a clean boolean true/false based on the hardware's actual state. Perfect for updating Dashboard switches.
* Output 2: MQTT output (Internal use, wire to MQTT Out node).
* Output 3: Status output for custom logging or dashboard indicators.
* Dashboard 2.0: Wire a Dashboard "Switch" node to the input of any node in a Sync Group. To ensure the UI reflects changes from all physical switches, wire Output 1 of _all_ grouped nodes back to the Dashboard Switch input.
* LWT: This node relies on the device being "connected" to show online status. Ensure your MQTT Broker is configured to handle the device's Last Will and Testament (LWT).