logo elektroda
logo elektroda
X
logo elektroda

[Tutorial] Detached Mode for Openbeken wall switch

ferbulous 3015 8

TL;DR

  • Sets up detached mode on an OpenBeken-flashed wall switch so toggling the switch keeps Wi‑Fi/Zigbee bulbs powered while actions are sent separately over MQTT.
  • Reassigns the real relay on P8 to AlwaysHigh, maps a fake relay to P9, and uses a script to publish button events from pin 14 plus MQTT-state pin remapping.
  • Uses MQTT topics like living_room_switches/1/get and living_room_switches/button/get, with a Node-RED flow that handles click, dblclick, holdstart, hold, and release payloads.
  • Single click toggles lights, holdstart flips input_boolean.dim_switch for dimming direction, hold changes brightness every 250 ms, and double click cycles warm/cool color temperature.
  • The switch’s LED stays on because it is tied to the relay, and the author notes device group control is still less stable than the Home Assistant approach.
Generated by the language model.
ADVERTISEMENT
📢 Listen (AI):
  • This is a quick guide on setting up 'detached mode' with openbk flashed switches.
    This would continuously power your wifi/zigbee bulbs without turning it off when the switch is toggled.

    On your switch. you'll need to change the relay that's wired to your wifi bulbs to AlwaysHigh and assign a fake relay to any random unused pin.

    [Tutorial] Detached Mode for Openbeken wall switch

    P8 - Relay 1
    P14 - Button 1
    P9 - Fake relay

    [Tutorial] Detached Mode for Openbeken wall switch
    P8 AlwaysHigh 
    P9 Relay 1


    Add this script:

    
    //publish button actions to mqtt for button 1 (pin 14)
    addEventHandler OnClick 14  publish button click
    addEventHandler OnDblClick 14 publish button dblclick
    addEventHandler OnHoldStart 14 publish button holdstart
    addEventHandler OnHold 14 publish button hold
    addEventHandler OnRelease 14  publish button release
    //reassign pin 8 as relay when MQTT is offline
    addEventHandler MQTTState 1 backlog setPinRole 8 AlwaysHigh; setPinRole 9 Rel
    addEventHandler MQTTState 0 backlog setPinRole 8 Rel; setPinRole 9 AlwaysLow
    


    Now, you can toggle the switch and do some custom actions based on published mqtt button payload
    MQTT topic to subscribe

    <device name>/<channel number>/get
    <device name>/button/get

    Example for my device:

    living_room_switches/1/get
    living_room_switches/button/get


    Nodered flows for dimming & changing color temperature:
    [Tutorial] Detached Mode for Openbeken wall switch [
    Spoiler:
     
    [{"id":"18d64a1a715694fc","type":"mqtt in","z":"4cb2d8d4.f1ff18","name":"","topic":"living_room_switches/button/get","qos":"2","datatype":"auto-detect","broker":"da8d15474208fac9","nl":false,"rap":true,"rh":0,"inputs":0,"x":150,"y":780,"wires":[["4a5e5569a15691e5"]]},{"id":"4a5e5569a15691e5","type":"switch","z":"4cb2d8d4.f1ff18","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"click","vt":"str"},{"t":"eq","v":"dblclick","vt":"str"},{"t":"eq","v":"hold","vt":"str"},{"t":"eq","v":"release","vt":"str"},{"t":"eq","v":"holdstart","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":390,"y":780,"wires":[["9a0699ccd15bc40a"],["a7e3bedb345795e4"],["0b2252d48c11a5f6"],["5cfd4e38daddc201"],["bf794dd51f95e6d2"]]},{"id":"0bda89995a681890","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"toggle lights","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"light","service":"toggle","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1090,"y":620,"wires":[[]]},{"id":"bf794dd51f95e6d2","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"toggle_dimming","server":"10991ca8.1f1c03","version":5,"debugenabled":false,"domain":"input_boolean","service":"toggle","areaId":[],"deviceId":[],"entityId":["input_boolean.dim_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":540,"y":940,"wires":[[]]},{"id":"a7e3bedb345795e4","type":"api-current-state","z":"4cb2d8d4.f1ff18","name":"input cycle colors","server":"f4149317.d3794","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.cycle_colors","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":630,"y":720,"wires":[["44d99c8c08d5e1ee"]]},{"id":"44d99c8c08d5e1ee","type":"switch","z":"4cb2d8d4.f1ff18","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Cool","vt":"str"},{"t":"eq","v":"Warm","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":810,"y":720,"wires":[["7316fa48add4a421"],["87c641df2d84020a"]]},{"id":"7316fa48add4a421","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Cool","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"{\"color_temp\":153}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":700,"wires":[["03c552b5c13531ed"]]},{"id":"87c641df2d84020a","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Warm","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"{\"color_temp\":490}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":760,"wires":[["03c552b5c13531ed"]]},{"id":"03c552b5c13531ed","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"input_select","service":"select_next","areaId":[],"deviceId":[],"entityId":["input_select.cycle_colors"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1150,"y":720,"wires":[[]]},{"id":"0b2252d48c11a5f6","type":"api-current-state","z":"4cb2d8d4.f1ff18","name":"check dim","server":"f4149317.d3794","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.dim_switch","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":600,"y":800,"wires":[["5f94ea1ad5c9da8b"],["6034cf15d769023f"]]},{"id":"5cfd4e38daddc201","type":"change","z":"4cb2d8d4.f1ff18","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":880,"wires":[["5f94ea1ad5c9da8b","6034cf15d769023f"]]},{"id":"5f94ea1ad5c9da8b","type":"trigger","z":"4cb2d8d4.f1ff18","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":860,"y":860,"wires":[["f4f5fd69f4ccefe2"]]},{"id":"6034cf15d769023f","type":"trigger","z":"4cb2d8d4.f1ff18","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-250","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":860,"y":920,"wires":[["92cc63045a3ad078"]]},{"id":"92cc63045a3ad078","type":"api-current-state","z":"4cb2d8d4.f1ff18","name":"Check lights state","server":"22f5da40.d3e236","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_lights_prime","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":1090,"y":920,"wires":[["e07a0bcb27553333"],[]]},{"id":"f4f5fd69f4ccefe2","type":"api-current-state","z":"4cb2d8d4.f1ff18","name":"Check lights state","server":"22f5da40.d3e236","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_lights_prime","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":1090,"y":860,"wires":[["fbb46d6331d169ab"],[]]},{"id":"e07a0bcb27553333","type":"function","z":"4cb2d8d4.f1ff18","name":"Brightness -40","func":"var brightness = msg.data.attributes.brightness; //setup brightness and set to msg.payload\nbrightness = parseInt(brightness);\n\nif (brightness > 70) {\n    brightness = brightness - 40;\n} else {\n    brightness = 50;\n}\n\nmsg.payload = brightness;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":920,"wires":[["8a533c20131b57b0"]]},{"id":"fbb46d6331d169ab","type":"function","z":"4cb2d8d4.f1ff18","name":"Brightness +30","func":"var brightness = msg.data.attributes.brightness;\nbrightness = parseInt(brightness);\n\nvar dimmSize = 30;  //ONLY CHANGE THIS VALUE IF YOU WANT A DIFFERENT DIMM SPEED\nvar maxBrightness = 255;\nif (brightness <= maxBrightness - dimmSize) {\n    brightness += dimmSize;\n} else {\n    brightness = maxBrightness;\n}\n\nmsg.payload = brightness;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":860,"wires":[["44b27c64043219f4"]]},{"id":"8a533c20131b57b0","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Light On","server":"22f5da40.d3e236","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"{    \"entity_id\": \"light.bedroom_1_light\",    \"brightness\": {{payload}}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1500,"y":920,"wires":[[]]},{"id":"44b27c64043219f4","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Light On","server":"22f5da40.d3e236","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"{    \"entity_id\": \"light.bedroom_1_light\",    \"brightness\": {{payload}}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1500,"y":860,"wires":[[]]},{"id":"9a0699ccd15bc40a","type":"api-current-state","z":"4cb2d8d4.f1ff18","name":"Check lights","server":"f4149317.d3794","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.living_room_lights_prime","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":550,"y":660,"wires":[["ca3d5ec50c904c8b"],["fa29de278dcf515f"]]},{"id":"fa29de278dcf515f","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Lights off","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":780,"y":660,"wires":[[]]},{"id":"ca3d5ec50c904c8b","type":"api-call-service","z":"4cb2d8d4.f1ff18","name":"Lights on","server":"f4149317.d3794","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_room_lights_prime"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":780,"y":620,"wires":[[]]},{"id":"8a20507042a29c50","type":"mqtt in","z":"4cb2d8d4.f1ff18","name":"","topic":"living_room_switches/1/get","qos":"2","datatype":"auto-detect","broker":"da8d15474208fac9","nl":false,"rap":true,"rh":0,"inputs":0,"x":130,"y":700,"wires":[["46d961b14905441e"]]},{"id":"46d961b14905441e","type":"switch","z":"4cb2d8d4.f1ff18","name":"Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":600,"wires":[["ca3d5ec50c904c8b"],["fa29de278dcf515f"]]},{"id":"da8d15474208fac9","type":"mqtt-broker","name":"MQTT hass","broker":"192.168.1.40","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"f4149317.d3794","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"10991ca8.1f1c03","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false},{"id":"22f5da40.d3e236","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]
    


    1) Create input boolean for dimming (input_boolean.dim_switch)
    2) Add a new input helper dropdown for 'cycle colors'
    [Tutorial] Detached Mode for Openbeken wall switch

    Brief summary of the flow
    a. single click to toggle lights on/off
    b. 'holdstart' payload would toggle 'input_boolean.dim_switch' that switches between dimming or increasing brightness
    c. hold action (with trigger node) would continuously increase/decrease brightness every 250ms
    d. release payload sends reset payload to stop the trigger node thus stopping the dimming action
    f. double click to change from warm or cold temperature
    e. toggle channel 1 relay to toggle on/off for the lights

    Demo:




    As you can see, the led indicator for switch 1 is always on, that's because for my switch, the led is tied to the relay.
    There are other switches in the market with its dedicated pin for led such as these:

    https://templates.blakadder.com/DS-102_3.html
    https://templates.blakadder.com/milfra_TB12.html

    Alternative way would be to use device group to perform all the actions above without relying on homeassistant, however device group isn't quite stable for my usage yet as I continue testing it.

    I'm sure there are other ways of setting 'detached' mode, anyway this is my approach.
    Your ideas are welcome

    Cool? Ranking DIY
    About Author
    ferbulous
    Level 18  
    Offline 
    ferbulous wrote 419 posts with rating 56, helped 8 times. Been with us since 2022 year.
  • ADVERTISEMENT
  • Helpful post
    #2 20335015
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14388
    Help: 650
    Rate: 12308
    Very clever way to get around the device limitations, although with the latest OBK updates (that weren' t in place at the time of creating automation from the first post) it should be possible to do it fully in script....

    Double click to change temperature...

    Let me see if I can come up with something similar....

    Ok ok, it will not be the same, I will use a simple CW strip simulation as an example:
    
    
    // 
    // SetButtonTimes [ValLongPress] [ValShortPress] [ValRepeat]
    // Each value is times 100ms.
    // Defaults:
    //  SetButtonTimes 10 3 5
    // more responsive hold:
    SetButtonTimes 10 3 5
    
    // shortcut for command. Repetas time is 10 sec, repeats count is 1
    alias add_turnoff_event addRepeatingEvent 10 1 led_enableAll 0
    
    alias do_brightness_action add_dimmer 5 1
    alias do_temperature_action add_temperature 5 1
    alias do_hold_action if $CH10 then do_brightness_action else do_temperature_action
    
    // toggles light state - not needed, done automatically
    addEventHandler OnClick 7 led_enableAll toggle
    // channel 10 describes mode - changing temperature or brightness
    addEventHandler OnDblClick 7 toggleChannel 10
    // turn on and do add_dimmer 5 with bWrapInteadOfClamp enabled
    addEventHandler OnHold 7 backlog led_enableAll 1; do_hold_action 
    

    Code above does:
    - click turns on/off the strip
    - double click changes hold mode (adjust temperature or dimmer)
    - hold adjusts (as above) temperature or dimmer
    Simulation:



    It uses ScriptOnly button so it doesn't tries to toggle anything automatically, all is scripted:
    [Tutorial] Detached Mode for Openbeken wall switch

    If you look at my code, you can see how I handled determining whether we are in Dimmer adjust mode or a Temperature adjust mode:
    
    alias do_brightness_action add_dimmer 5 1
    alias do_temperature_action add_temperature 5 1
    alias do_hold_action if $CH10 then do_brightness_action else do_temperature_action
    


    I've been wondering if the same approach could be used for your case with checking MQTT state?

    
    alias do_hold_action if MQTTOn then do_some_action else do_other_action
    


    but I am just here showing some random ideas, in general, your solution is good.
    Helpful post? Buy me a coffee.
  • #3 20335173
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    Indeed, all those action are doable in script
    I did try implementing with device group earlier, but I was still getting 'dgr socket error', device group randomly not broadcasting/receiving or just the black led (light is on, but no light, need to select color temp/colors to get it to light up)
    So I went back to using nodered for now

    script for brightness & color change on openbk
    
    addEventHandler OnHoldStart 22 SetChannel 6 0
    // when Hold repeats, add a 10 value as a step
    // AddChannelSyntax: channelindex delta minValue maxValue
    // the 0 255 is needed so we clamp the value to 255 
    addEventHandler OnHold 22 backlog AddChannel 6 15 0 255; DGR_SendBrightness cornerlamp $CH6
    // send on/off command to cornerlamp device group
    addChangeHandler Channel4 == 0 DGR_SendPower cornerlamp 0 1
    addChangeHandler Channel4 == 1 DGR_SendPower cornerlamp 1 1
    // double click to change color temp
    setChannel 5 1
    addEventHandler OnDblClick 22 addChannel 5 1
    addChangeHandler Channel5 == 1 DGR_SendRGBCW cornerlamp 255, 255, 255
    addChangeHandler Channel5 == 2 DGR_SendRGBCW cornerlamp 255, 0, 0
    addChangeHandler Channel5 == 3 setChannel 5 1
  • ADVERTISEMENT
  • #4 20335227
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14388
    Help: 650
    Rate: 12308
    I am using DGR to control LED strips and it seem reliable for me, but we will investigate more.

    But for now, have you considering replacing DGR_SendBrightness with SendGET?

    Maybe it could work....
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20335592
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    @p.kaczmarek2
    SendGET didn’t work when i tried replacing DGR_SendBrightness
    I did put a request if channel variable can be passed to the url
  • ADVERTISEMENT
  • #6 20335788
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14388
    Help: 650
    Rate: 12308
    @ferbulous it was already granted, from what I can tell. Almost immediately. The target URL is now expanding the $CH11 etc etc syntax.
    Helpful post? Buy me a coffee.
  • #7 20337306
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    p.kaczmarek2 wrote:
    it was already granted, from what I can tell. Almost immediately. The target URL is now expanding the $CH11 etc etc syntax.


    Thanks, I haven't checked that yet
    Example for the URL to utilize that?

    addEventHandler OnHoldStart 22 SetChannel 6 0
    // when Hold repeats, add a 10 value as a step
    // AddChannelSyntax: channelindex delta minValue maxValue
    // the 0 255 is needed so we clamp the value to 255 
    addEventHandler OnHold 22 backlog AddChannel 6 15 0 255; SendGet http://192.168.1.134/cm?cmnd=led_dimmer%20$CH6
  • #8 20337333
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14388
    Help: 650
    Rate: 12308
    The following example looks correct, altough I do not know if our software is currently capable of sending GET packet, every, how often does "hold event" repeat, 300ms? You might need to make repeats less frequent, but I am not sure.
    In general, just check in practise, I will also check as well.

    It's just that SENDGET is more "expensive" than UDP send
    Helpful post? Buy me a coffee.
  • #9 20337360
    ferbulous
    Level 18  
    Posts: 419
    Help: 8
    Rate: 56
    p.kaczmarek2 wrote:
    It's just that SENDGET is more "expensive" than UDP send

    Indeed, it's probably not suitable especially if you have multiple bulbs
📢 Listen (AI):

Topic summary

✨ This discussion focuses on setting up 'detached mode' for OpenBeken (OBK) flashed wall switches, allowing continuous power to WiFi/Zigbee bulbs regardless of switch toggling. Users share methods for configuring relays, including setting a relay to AlwaysHigh and assigning a fake relay to an unused pin. Various scripts are provided to handle button actions and control brightness and color changes. Participants discuss the reliability of DGR (Device Group Relay) for LED strips and explore alternatives like SendGET for command execution, while addressing issues with device group communication and MQTT state handling.
Generated by the language model.

FAQ

TL;DR: Detached mode keeps smart bulbs powered while your switch sends 4 Hz (250 ms) brightness updates; “Very clever way to get around device limitations” [Elektroda, p.kaczmarek2, post #20335015]

Why it matters: Bulbs stay online, avoiding reboots and enabling advanced automations.

Quick Facts

• Relay pin (e.g., P8) set to AlwaysHigh supplies constant 230 V to the load [Elektroda, ferbulous, post #20331492] • Fake relay mapped to an unused pin (P9) preserves button logic [Elektroda, ferbulous, post #20331492] • Button events published over MQTT: click, dblclick, holdstart, hold, release [Elektroda, ferbulous, post #20331492] • Hold cycle runs every 250 ms, stepping brightness by 15 (0-255 range) [Elektroda, ferbulous, post #20331492] • Script-only mode uses SetButtonTimes 10 × 100 ms = 1 s long-press threshold [Elektroda, p.kaczmarek2, post #20335015]

What is “detached mode” on an OpenBeken wall switch?

Detached mode leaves the relay permanently on, so the physical switch no longer cuts power. Instead, button presses trigger MQTT or script events that control smart bulbs or groups, keeping bulbs continuously powered [Elektroda, ferbulous, post #20331492]

How do I configure the pins to keep the bulbs powered?

  1. Set the relay-wired pin (e.g., P8) role to AlwaysHigh.
  2. Map the physical button pin (e.g., P14) to Button.
  3. Assign any unused pin (e.g., P9) as a fake Relay 1 role.
  4. Save and reboot the device [Elektroda, ferbulous, post #20331492]

Why add a fake relay?

OpenBeken expects each button to control a relay channel. A fake relay satisfies that requirement without cutting power, so button events still publish while mains stays on [Elektroda, ferbulous, post #20331492]

Which MQTT topics carry the button payloads?

Device publishes two topics: //get and /button/get. Subscribe to both to catch click, dblclick, holdstart, hold, and release payloads [Elektroda, ferbulous, post #20331492]

Can I run everything without Home Assistant or Node-RED?

Yes. Latest firmware lets you script the entire logic on-device using addEventHandler and aliases. The sample script toggles, dims, and adjusts temperature with no external broker [Elektroda, p.kaczmarek2, post #20335015]

How does the Node-RED flow dim lights while holding the button?

A Trigger node fires every 250 ms, sending ‘1’ to a function that adds or subtracts 40 brightness points, then pushes a light.turn_on service call. Release payload resets the trigger, stopping the loop [Elektroda, ferbulous, post #20331492]

What statistic shows responsiveness?

With 250 ms repeats, users get up to 4 brightness changes per second—a smooth dimming experience comparable to many commercial dimmers [Elektroda, ferbulous, post #20331492]

How do I switch between brightness and color-temperature adjustment?

In script-only mode, Channel 10 stores the mode. A double click toggles CH10. The hold handler runs add_dimmer or add_temperature based on CH10 state [Elektroda, p.kaczmarek2, post #20335015]

Is UDP (DGR) or HTTP (SendGET) better for device-to-device commands?

UDP DGR packets are lighter and broadcast instantly. HTTP SendGET works but is “more expensive” in bandwidth and CPU, especially with multiple bulbs [Elektroda, p.kaczmarek2, post #20337333]

What edge-case failures should I expect?

Some users report “dgr socket error” and group packets occasionally dropping, leaving LEDs off until a new command arrives [Elektroda, ferbulous, post #20335173]

How often does the hold event repeat, and can I change it?

Default Trigger repeats every 250 ms. Edit the Trigger or SetButtonTimes values; e.g., SetButtonTimes 10 3 5 uses a 1 s long-press and 300 ms repeat [Elektroda, p.kaczmarek2, post #20335015]

What happens if MQTT goes offline?

The script reassigns pin roles: P8 becomes a real relay, restoring manual control, while P9 switches to AlwaysLow for safety [Elektroda, ferbulous, post #20331492]

Quick 3-step setup recap?

  1. Flash OpenBeken and set P8 AlwaysHigh, P14 Button 1, P9 Relay 1.
  2. Paste the provided addEventHandler script and save.
  3. Subscribe to /button/get in your automation platform. Done—bulbs stay powered and buttons publish events [Elektroda, ferbulous, post #20331492]
Generated by the language model.
ADVERTISEMENT