logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] OpenBeken 1.18.297 - how to configure GPIO8 short and long button clicks?

pvswie01 315 2
ADVERTISEMENT
  • Request for GPIO8 button configuration details

    #1 21941603
    pvswie01
    Level 2  
    Posts: 2
    I installed a very recent OpenBeken (1.18.297) on a new device with a BK7231N.

    The device supports an external switch or a momentary push button. I use the button.
    I am unable to get the button to work. In fact, I am unable to get any response from the button.
    Details of the switch/button:
    Pin 13 of the Tuya module seems to be GPIO8, default voltage 2.9 V, when the button is pressed: 30 mV.
    I tried many things with the help of ChatGPT and Google AI, but nothing works.
    Question: Which settings & autoexec content do I need to realize the below:
    - short click: On (Set channel 4 to 128), Off (Set channel 4 to 0)
    - long click: Max intensity (Set channel 4 to 255)

    Kind regards,
    pvswie01
    AI: What is the exact brand/model of the device, or can you share the current OpenBeken template / GPIO configuration page for this device?
    My device is not branded. It looks just like the unbranded device on this page: https://devices.esphome.io/devices/oxt-1ch-dimmer/
    AI: Can you post your current autoexec.bat content and the GPIO8 role/settings you tried, including whether you used Button, Btn, Btn_n, input pull-up, etc.?
    At this moment, it makes no sense to include config and autoexec.bat details since the device does not work.
  • ADVERTISEMENT
  • #2 21941617
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14804
    Help: 659
    Rate: 12972
    Here are samples for events that you can use:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Try to use Btn_ScriptOnly to avoid firing default click events as well.
    Make sure that childlock flag is disabled.
    Also, what do you mean by "off"?
    Helpful post? Buy me a coffee.
  • Wrong pin mapping caused button input failure

    #3 21942784
    pvswie01
    Level 2  
    Posts: 2
    >>21941617
    Thanks for the reply.
    I found the error: The OpenBeken webinterface has the config for each of the pins of the BK7231N. I was using the pin number of the Tuya module instead. As a result the signal from the external button was never recognised by the firmware. I also noticed that with the button in the rest position (open) there is a high voltage (2.9 V) on the Tuya module. This voltage goes down to 0 when the button is closed. ==> negative logic, a common thing in electronics. I therefore tried using Btn_ScriptOnly_n but that was also incorrect. Despite the negative logic I still need to use Btn_ScriptOnly. Maybe inside the Tuya module there is some inverting logic between the Tuya module pin 13 and the BK7231N microcontroller.
    So what did I manage to create?
    A 8 euro dimmer controlled by a push button that switches between OFF and dimmed intensity where a long press on the button results in maximum light.
    Once I find out how I will upload to elektroda.com
ADVERTISEMENT