logo elektroda
logo elektroda
X
logo elektroda

Tuya MINI-W1-3CH Switch Auto-Toggling After Openbeken Flash - Issue with Channels

Advian1 1689 8
ADVERTISEMENT
  • #1 21038547
    Advian1
    Level 6  
    so got this 3 channel WiFi switch from Ali.
    then I flashed it with Openbeken.
    Everything went well.

    But after connecting it to the mains, I started having this weird issue.
    The device toggles switches automatically.

    I have no idea why it is doing that.

    It first started doing this with channel 2.
    then it started happening with channel 3, then channel 1

    Channel 2 is the worst. it constantly toggles the relay.
    my config:

      "pins": {
        "6": "TglChanOnTgl;1",
        "7": "TglChanOnTgl;2",
        "8": "TglChanOnTgl;3",
        "10": "Rel;1",
        "11": "WifiLED_n;0",
        "23": "Btn_Tgl_All;0",
        "24": "Rel;2",
        "26": "Rel;3"
      },


    see this video for demonstration. see how the fan switch toggles itself.




    Here's the log during this period:
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MQTT:Publishing val 0 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MAIN:Time 9666, idle 71736/s, free 74800, MQTT 1(1), bWifi 1, secondsWithNoPing 9595, socks 3/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MAIN:Time 9667, idle 69489/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9596, socks 2/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MQTT:Publishing val 0 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MAIN:Time 9668, idle 68676/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9597, socks 2/38 POWERSAVE
    Info:MAIN:Time 9669, idle 70242/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9598, socks 2/38 POWERSAVE
    Info:MAIN:Time 9670, idle 66714/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9599, socks 2/38 POWERSAVE
    Info:GEN:dhcp=0 ip=192.168.1.143 gate=192.168.1.1 mask=255.255.255.0 mac=d8:d6:68:fc:50:63
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-62,ssid=ssb-wifi3,bssid=f8:d1:11:62:20:4e,channel=2,cipher_type:CCMP
    Info:MAIN:Time 9671, idle 67435/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9600, socks 2/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MQTT:Publishing val 0 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MAIN:Time 9672, idle 68662/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9601, socks 2/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MQTT:Publishing val 0 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get
    Info:MAIN:Time 9673, idle 79245/s, free 75032, MQTT 1(1), bWifi 1, secondsWithNoPing 9602, socks 2/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Publishing val 1 to switches_room1/2/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic switches_room1/2/get



    this toggling stops if I remove the role from Pin 7.
    Screenshot of a Wi-Fi switch configuration with three channels.
    but if I do that, the physical switch won't work anymore. Can't use it like that.

    the wiring method I'm using is this:
    Wiring diagram of a three-channel Wi-Fi switch with labeled inputs and outputs.

    using openbeken latest.
    Build on Apr 8 2024 09:55:01 version 1.17.540
    have tried a few older release as well.

    I'd appreciate ANY help regarding finding out the solution.
    Please help.
    Or is this device fault and I should through it away?

    Let me know if I should provide any info.
  • ADVERTISEMENT
  • Helpful post
    #2 21038707
    p.kaczmarek2
    Moderator Smart Home
    This may be related to: How to Fix Random Relay Switching on BL602 IoT Devices with SM-028_V1.3?
    The problem is that the circuit seems to be different on various devices so it's hard for me to reproduce it.
    We can either improve the debouncing/switching code or fix the problem in hardware.
    Helpful post? Buy me a coffee.
  • #3 21038766
    Advian1
    Level 6  

    p.kaczmarek2 wrote:
    This may be related to: How to Fix Random Relay Switching on BL602 IoT Devices with SM-028_V1.3?
    The problem is that the circuit seems to be different on various devices so it's hard for me to reproduce it.
    We can either improve the debouncing/switching code or fix the problem in hardware.


    Thanks for replying.
    I don't see any empty slot in the pcb.
    Close-up of a PCB with various electronic components and wires. Close-up of a PCB with various electronic components and connectors. Close-up of MANHOT GK101-1AS relay on a PCB with markings DC5V, 5A 250VAC/30VDC.

    What can I do to help debug/fix it?

    It's based on BK7231N.
    BK7231N module on a PCB with wiring.
  • ADVERTISEMENT
  • #4 21042165
    Advian1
    Level 6  

    One thing I noticed, it is always a double toggle.
    I mean it doesn't switch from off to on and stay there.
    it toggles, and then toggles again swiftly to the original position.

    Also, this doesn't happen when the toggle is in "ON" state.
    only when it is in "OFF" state.
  • ADVERTISEMENT
  • #6 21043451
    Advian1
    Level 6  
    divadiow wrote:
    do you have the original fw to flash back to see if it's a hardware or software issue?

    Added after 2 [minutes]:

    if not, you could use the one here https://www.elektroda.pl/rtvforum/topic4026798.html


    Yes i have the original flash backup.
    Restored it and ran for a while.
    Haven't happened yet.
    I'll keep it running for some more.

    By the way, does openbeken has this feature?
    "State synchronous switch"
    Screenshot of app settings with relay and switch type options.

    Really need this.

    Also, this interlocking?
    Would love it.
    Screenshot of app settings with options: relay status, switch type setting, and interlock setting.


    Added after 4 [hours] 51 [minutes]:

    been running for quite a while.
    it didn't auto toggle even once.

    So software issue?

    How can I help you solve it?
  • ADVERTISEMENT
  • #7 21043723
    p.kaczmarek2
    Moderator Smart Home
    You can make a state synchronous switch very easily. Just make a dInput (or dInput_pup, etc) pin and the linked channel will follow the value on the input.

    The mutually exclusive locking could be done with some scripting.

    @Advian1 do you have Github account? Would you be able to try changing debouncing and checking which constants etc are working? I can't do that without having this switch at hand...
    Helpful post? Buy me a coffee.
  • #8 21043817
    Advian1
    Level 6  
    p.kaczmarek2 wrote:
    @Advian1 do you have Github account? Would you be able to try changing debouncing and checking which constants etc are working? I can't do that without having this switch at hand...


    Yes, I do.
    but not sure how to do what you are asking.
    I'm not familiar with the openbeken source code.

    Will you please provide some direction?

    Added after 6 [hours] 53 [minutes]:

    @p.kaczmarek2 is this the value you wanted me to change?
    Screenshot of a source code editor displaying the file new_pins.c with a highlighted code segment defining BTN_DEBOUNCE_MS as 75.

    I'll try that and report the result. should I increase or decrease?

    However, setting the pins to dInput_n will probably solve the problem for me and I'll get the correct behavior as well.


    Thanks a lot for the heads up.

Topic summary

The discussion revolves around a Tuya MINI-W1-3CH WiFi switch that exhibits automatic toggling of its channels after being flashed with OpenBeken firmware. The user reports that the issue began with channel 2 and subsequently affected channels 1 and 3, with channel 2 being the most problematic. Responses suggest that the issue may stem from either software bugs or hardware differences in the device. Suggestions include restoring the original firmware to determine if the problem persists, adjusting debouncing settings in the OpenBeken code, and implementing a state synchronous switch feature. The user has confirmed that reverting to the original firmware resolved the issue temporarily, indicating a potential software-related problem. Further debugging and adjustments to the firmware are recommended to achieve stable operation.
Summary generated by the language model.
ADVERTISEMENT