logo elektroda
logo elektroda
X
logo elektroda

Tuya TH08 (BK7231N) Button_OnLongPressHold Log Spam with OpenBeken 1.18.250 – Pin 14 Issue

tahunasky 75 8
ADVERTISEMENT
  • #1 21828503
    tahunasky
    Level 3  
    Hi.
    I am getting alot of Button_OnLongPressHold messages in log - as in continuously, as if I am holding the button down on the device.

    I have this TH08 /1? temperature / humidity sensor - wifi only.
    [url=]https://openbekeniot.github.io/webapp/devices/Tuya_TH08.html

    Firmware version: Built on Jan 27, 2026 23:02:13, version 1.18.250

    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Generic Wi-Fi TH01? Temperature & Humidity Sensor [CHT8310]",
      "model": "TH08",
      "chip": "BK7231N",
      "board": "CBU",
      "flags": "0",
      "keywords": [
        "battery",
        "environment",
        "AAA",
        "hygrometer",
        "th08 label",
        "blue pcb",
        "sensylink"
      ],
      "pins": {
        "8": "BAT_Relay;3",
        "14": "Btn;4;0",
        "16": "WifiLED_n;0",
        "20": "CHT83XX_SCK;0",
        "22": "CHT83XX_SDA;0;1",
        "23": "BAT_ADC;2"
      },
      "command": "backlog PowerSave 1; startDriver battery; startDriver CHT83XX",
      "image": "https://obrazki.elektroda.pl/5743076800_1701986603.png",
      "wiki": "https://www.elektroda.com/rtvforum/topic4019974.html"
    }
    


    This is what the log looks like.
    Quote:

    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:No change in channel 0 (still set to 334) - ignoring

    Info:GEN:No change in channel 1 (still set to 75) - ignoring

    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:No change in channel 0 (still set to 334) - ignoring

    Info:GEN:No change in channel 1 (still set to 75) - ignoring

    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:No change in channel 0 (still set to 334) - ignoring

    Info:GEN:No change in channel 1 (still set to 75) - ignoring

    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:No change in channel 0 (still set to 334) - ignoring

    Info:GEN:CHANNEL_Set channel 1 has changed to 76 (flags 0)

    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold
    Info:GEN:14 Button_OnLongPressHold


    I can not get addEventHandler OnHold 14 to work in either template/config or autoexec.bat, and now I am thinking it is because the firmware thinks it is being pressed continuously.

    If I configure the pin as "14": "Btn;4;0", it get the Button_OnLongPressHold continuously in log. If I set pin to Btn_pd. Btn_pd_n or Btn_n the Button_OnLongPressHold messages in log go, but the button press is not detected.

    It looks like a similar problem to the post: [url=]https://www.elektroda.com/rtvforum/topic4162671.html

    I am wanting to be able to press the button at boot, to stop autoexec from running or to check in autoexec for button press to cancel deepsleep.

    Here is the tuya dump from when I flashed sensor
    Quote:

    {
    "abi":"0",
    "id":"null",
    "swv":"1.0.0",
    "bv":"40.00",
    "pv":"2.2",
    "lpv":"3.4",
    "pk":"xflodz7oja0pndk3",
    "firmk":"null",
    "cadv":"1.0.3",
    "cdv":"1.0.0",
    "dev_swv":"1.0.0",
    "s_id":"null",
    "dtp":"0",
    "sync":"0",
    "attr_num":"0",
    "mst_tp_0":"0",
    "mst_ver_0":"null",
    "mst_tp_1":"0",
    "mst_ver_1":"null",
    "mst_tp_2":"0",
    "mst_ver_2":"null",
    "mst_tp_3":"0",
    "mst_ver_3":"null ",
    "em_sys_env":"BK7231NL"
    }


    Sorry, no meaningful pins data found. This device may be TuyaMCU or a custom one with no Tuya config data.
    No module information found.
    Device internal platform - BK7231NL, equals BK7231N.
    And the Tuya section starts, as usual, at 2023424 (0x1EE000)


    Is it possible to fix this, if so how ?

    Thanks


    AI: Can you confirm if the physical button on pin 14 is working correctly—e.g., does it feel stuck, or have you checked with a multimeter if the pin is pulled high/low as expected when pressed and released?
    physical button on pin 14 is working correctly, tested with multimeter.
    AI: Have you tried using a different firmware version or testing the button functionality on another similar device to see if the issue persists, or is it only happening with this specific firmware and device?
    I dont have a similar device to test firmware, and have only downloaded latest firmware.
  • ADVERTISEMENT
  • #2 21828523
    divadiow
    Level 37  
    please try:

    -clear any assignment for pin14
    -enable flag 13
    -reboot

    what is the default state of pin 14 as seen in the list in main GUI? 0 or 1?
    what state does it change to when you press the button and does it return to its previous state or stay as the new state on release?
  • #3 21828527
    tahunasky
    Level 3  
    >>21828523
    Hi, Thanks for the reply...

    So I added "flags": "13", in template/config - I guess that's what you mean.

    This is what it says for pin 14 and removed "14": "Btn_n;4;0",

    Table assigning functions to pins P8–P16, showing BAT_Relay and WifiLED_n selected
  • ADVERTISEMENT
  • #5 21828539
    tahunasky
    Level 3  
    >>21828531

    This is pin state.

    Tuya TH08 (BK7231N) Button_OnLongPressHold Log Spam with OpenBeken 1.18.250 – Pin 14 Issue

    Maybe I did something wrong... this is the template as is shown in webapp
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "13",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "8": "BAT_Relay;3;0",
        "16": "WifiLED_n;0;0",
        "20": "CHT83XX_SCK;0;0",
        "22": "CHT83XX_SDA;0;1",
        "23": "BAT_ADC;2"
      },
      "command": "backlog PowerSave 1; startDriver battery; startDriver CHT83XX",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
  • #6 21828542
    divadiow
    Level 37  
    tahunasky wrote:
    So I added "flags": "13", in template/config - I guess that's what you mean.


    from main gui -> config menu -> Configure General/Flags -> tick "Flag 13 - [HTTP] Show actual PIN logic level for unconfigured pins" -> Submit
  • ADVERTISEMENT
  • #7 21828546
    tahunasky
    Level 3  
    >>21828542

    PIN 14: 1 is what it shows.
  • ADVERTISEMENT
  • #8 21828547
    divadiow
    Level 37  
    but also, the original template has IO14 as

    Code: Text
    Log in, to see the code


    I don't know if that's correct, but it doesn't seem like it's a normal button

    Added after 44 [seconds]:

    >>21828546

    and does it change to 0 when you push the button? does it change back to 1 when you release the button?
  • #9 21828554
    tahunasky
    Level 3  
    >>21828547


    If I press button, it becomes PIN 14: 0.

    As soon as I release button, pin goes back to 1.

    I did use the original template 14 set to DoorSnsrWSleep;4, however, I want to be able to stop sensor from going to sleep if I press button so I can modify settings.

    The original template would not let me do this... deepsleeps too quickly. If you read other templates they set up button with addEventHandler OnHold 14 stopAllScripts, but I couldn't get it to work... now I know why because of the Info:GEN:14 Button_OnLongPressHold due to pin being default to 1.

    So if I put an addEventHandler OnHold 14 goto end in autoexec.bat with end: after deepsleep would this make it work... or is there something else I should do?

    Added after 2 [hours] 6 [minutes]:

    I have got it working to what I want it to do by setting pin "14": "dInput;4;0", then checking channel 4 in autoexec.bat

    autoexec,bat

    
    CHT_Calibrate 0 6
    
    setChannelType 0 Temperature_div10
    setChannelType 1 Humidity
    
    waitFor MQTTState 1
    delay_s 1
    
    if $CH4==0 then  goto END
    
    publish temp-humidity/device_1 "{\"temp\":$CH0,\"humdity\":$CH1,\"bat_voltage\":$batteryVoltage,\"bat_percent\":$batteryLevel}" 1
    delay_s 1
    DeepSleep 300
    
    END:
    publish temp-humidity/device_1 "{\"END - CHN4 Value\":$CH4}" 1
    


    Is there a better way to do this ?
    How can I blink the wifi_LED_n a couple of times to let me know that script has gone to END without deepsleep. I managed to turn it on, but not off again with below code:
    waitFor WiFiState 4
    setPinRole 16 LED_n
    setPinChannel 16 1
    delay_s 2
    setPinChannel 16 0
    
ADVERTISEMENT