logo elektroda
logo elektroda
X
logo elektroda

OpenBeken on GHome SW6 3-Way Switch (BF7231N): Pinout, LED, Load Detection

akosschneemaier 309 7
ADVERTISEMENT
  • #1 21538151
    akosschneemaier
    Level 6  
    Hello,

    i just installed OpenBeken on a GHome SW6 3-Way switch with BF7231N chip.

    Here are some pictures:
    Front: White smart light switch with WiFi icon and three wires coming out from the back. Back: Back view of a smart 3-way light switch with labeled wire connections and technical information.

    Config after flashing:
    - Green LED will iluminate when the load is on and >10W
    - Red LED will illuminate when the load is off

    {
    ....
      "pins": {
        "6": "Rel_n;1", - Relay
        "14": "LED;2", - Red LED
        "22": "Btn;1", - Button
        "24": "dInput_NoPullUp_n;2", - Load detector input, low when load is >~10W
        "26": "LED_n;2" - Green LED
      },
    ....
    }
    


    Internals:
    A printed circuit board of an electronic device inside a plastic case with a metal mounting bracket.
    BK7231N chip:
    Electronic module with integrated circuit on a PCB inside a plastic enclosure.

    Serial:
    Close-up of a circuit board with a relay, capacitors, and connected wires.

    And the question:
    Tasmota has a config for the ESP8266 version: See https://templates.blakadder.com/gosund_SW6.html , it has some rules to make the operation more streamlined. I need some help on how to create similar rules under OpenBeken, so on/off/toggle command work nicelly. Can somebody help converting the Tasmota rules to OpenBeken?

    Thanks
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #3 21544903
    p.kaczmarek2
    Moderator Smart Home
    How exactly would you like to connect it? Do you pair it with a non-smart switch, or are there two smart switches? With two smart switches, you could use OBK Tasmota Device Groups support.

    Or do you want to integrate the read of dInput_NoPullUp_n to show on/off correctly?
    Helpful post? Buy me a coffee.
  • #4 21545106
    akosschneemaier
    Level 6  
    >>21544903 It is paired with a non-smart switch. I want to make it work the same way as the tasmota version works, so I can send on/off/toggle commands and read on/off status correctly

    Tasmota does this with 3 rules and some dummy components:
    Components
    
    Relay1   A dummy component that stores the power state of the switch.
    Relay2   The actual hardware switch. This controls the state of the circuit (on/off) but, is not a direct indication of the state of the circuit. The relay could be on while the circuit is open.
    Relay3   A dummy component used to process external commands. This is necessary to allow explicit control of the state of the circuit. It should always be in the same state as Relay 1.
    Switch1   The status of the circuit. Switch1’s state will change when the circuit changes. As an example say relay2 is off, the circuit is closed, and Switch1’s state will be 1. If relay2 is toggled to on the, circuit will open and Switch1’s state will change to 0.
    Switch2   The push button on the smart switch. Using Switch instead of button seems to provide a quicker response.
    

    Rules
    
    Backlog Rule1 ON Power3#State do Power2 2 endon ON switch2#state=3 DO publish stat/tasmota_XXXXX/SWITCH1T {"TRIG":"HOLD"} ENDON; Rule1 1
    Rule2 ON Power1#state=0 do Backlog rule1 0; power3 0; rule1 1 endon On Power1#state=1 do Backlog rule1 0; power3 1; rule1 1 endon; Rule2 1
    Backlog Rule3 ON event#OFF do power3 0 endon ON event#ON do power3 1 endon ON event#TOGGLE do power3 2 endon; Rule3 1
    


    I would like to translate the rules to Openbeken, but I am unable to find any useful examples or documentation on rules for Openbeken.

    thanks
  • ADVERTISEMENT
  • #5 21565377
    akosschneemaier
    Level 6  
    After playing around with scripting I ended up with an updated config:
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "6": "Rel_n;2",
        "14": "LED;3",
        "22": "Btn;2",
        "24": "dInput_NoPullUp_n;3",
        "26": "LED_n;3",
        "28": "Rel_n;1"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
    


    And with the following autoexec.bat
    
    alias control_script if $CH1!=$CH3 then ToggleChannel 2
    addEventHandler OnChannelChange 3 SetChannel 1 $CH3 
    addEventHandler OnChannelChange 1 control_script
    
  • ADVERTISEMENT
  • #7 21565621
    p.kaczmarek2
    Moderator Smart Home
    Nice, is it working and fully functional?

    I'm finishing ACL HVAC driver for another user, so if there is a need, I can also make a native (C code) driver for 3-way switch.
    Helpful post? Buy me a coffee.
  • #8 21569154
    akosschneemaier
    Level 6  
    >>21565621

    Yes it is working perfectly. Not sure if a driver is needed though

Topic summary

The discussion focuses on installing and configuring OpenBeken firmware on a GHome SW6 3-Way switch featuring the BK7231N chip. The user shares pinout details and LED behavior: the green LED indicates load presence above 10W, while the red LED signals load off. The configuration maps pins for relay control, LEDs, button input, and load detection using a "dInput_NoPullUp_n" input. The switch is paired with a non-smart switch, aiming to replicate Tasmota firmware functionality, which uses multiple dummy components and rules to manage relay states and accurately reflect circuit on/off status. An updated JSON configuration and autoexec.bat script are provided to handle channel toggling and state synchronization. Additional responses include sharing original firmware, boot logs, and offers to develop native C drivers for 3-way switch support. The discussion highlights integration challenges of load detection and state reporting in custom firmware for BK7231N-based smart switches.
Summary generated by the language model.
ADVERTISEMENT