logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Node-Red OpenBeken Optimized Node Update - Adds Reliable Group Support via HTTP and MQTT

gparduino 222 1
ADVERTISEMENT
  • #1 21833210
    gparduino
    Level 2  
    New Version of Node-RED OpenBeken Optimized node.

    New feature: support for groups.

    Reason: OpenBeken groups are supported by UDP. It is possible for these to get missed on busy networks as there is no handshake.

    Solution: The groups in this node allow for the fast UDP groups handled by the OpenBeken switches to be backed up by the HTTP in MQTT messages, which is slower but more reliable.

    Attached README.md file. Well — it won't take .md files, so I will change it to .txt. Change it back to .md if you want to see the formatting.
    Attachments:
    • README (copy).txt (2.94 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 21835050
    gparduino
    Level 2  
    Updated to version 1.3. Solved the issue of occasional relay chatter when using both UDP and MQTT via HTTP on a busy network.

    ----------------

    node-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.


    Anti-Chatter & Hybrid Sync (3-Way Switching)
    --------------------------------------------

    This subflow uses a **State-Locking** mechanism to prevent "Relay Chattering" (rapid oscillations) often caused by the race condition between OpenBeken UDP Groups and MQTT feedback loops.

    ### How it Works:

    1. **Physical Trigger:** When a physical switch is flipped, the hardware sends a 1/get message.

    2. **Lockout Window:** Upon receiving a hardware state change, the subflow "locks" the Sync Group for **400ms**.

    3. **Loop Prevention:** The subflow tags the outgoing synchronization message with source: "from_hw".

    4. **Logic Gate:** Any node receiving a message tagged from_hw will update its local relay but **will not** echo that change back out to the network. This breaks the infinite loop.


    ### Recommended Wiring for UDP Backup:

    If you want MQTT to act as a fail-safe for dropped UDP packets:

    * Wire **Output 1** of Node A to **Input 1** of Node B.

    * Wire **Output 1** of Node B to **Input 1** of Node A.

    * Connect your Dashboard UI switch to the inputs of both nodes.


    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.


    ### Tips for Success

    * **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).
ADVERTISEMENT