logo elektroda
logo elektroda
X
logo elektroda

Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide

jakkumn 3870 40
ADVERTISEMENT
  • #1 20441205
    jakkumn
    Level 3  
    TreatLife 3 Way Smart Dimmer Switch (DS02S)
    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide
    A 3 way smart switch with dimmer.

    This allows you to turn on and off a light with dimming capabilities
    This device was originally supported by Tasmota (Tasmota Docs).

    Pretty straight forward to get this flashed to OpenBeken. The below image shows the pinout and the important MCU reset pull low. Connect 3.3V power, ground, your tx/rx pins and pull the MCU's nReset pin low (MCU Datasheet) and then flash using the flash tool BK7231GUIFlashTool (BK7231GUIFlashTool).
    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide.

    Below is an excerpt from the Tasmota docs showing the dpid values.

    The “DpId”:1 line shows the switch’s on/off status
    “DpId”:2 shows the current brightness value (you have to convert it from HEX to decimal and divide by 10 get the percentage: “DpIdData”:”00000182” converts from HEX 182 to decimal 386/10=38.6%.
    “DpId”:3 shows the current minimum brightness (also need to convert from HEX to decimal and divide by ten: “DpIdData”:”0000000A” = 1.0%)
    “DpId”:4 shows the current dimmer mode (00 is definitely “Mode 1” from the stock Tuya/Smart Life firmware).
    


    Here is the completed autoexec.bat script (many thanks to p.kaczmarek2!)
    startDriver TuyaMCU
    //tuyaMcu_setBaudRate 115200 // This syncs the MCU baudrate. If soft controls are not working, try uncommenting this line.
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    


    Here is how to setup for Home Assistant
    mqtt:
      light:
        - name: "<Name to display in home assistant>"
          state_topic: "<client topic>/1/get"
          command_topic: "<client topic>/1/set"
          brightness_command_topic: "<client topic>/2/set"
          brightness_state_topic: "<client topic>/2/get"
          qos: 1
          payload_on: 1
          payload_off: 0
          retain: true
          optimistic: true
  • ADVERTISEMENT
  • Helpful post
    #2 20441408
    p.kaczmarek2
    Moderator Smart Home
    Hello, this "dimmer mode" is a new thing to me, but I still think it should be easy to configure this device.
    
    
    startDriver TuyaMCU
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    

    Wouldn't that be enough? The other two parms might work well with default values, let's try.
    If not, please provide the log, with debug messages included.

    What do you mean by "disconnecting relay from input"? This device is using TuyaMCU. The TuyaMCU processes both touch buttons and dimming. I don't think it's possible to hack TuyaMCU to detach on/off functionality from that. It is only easily doable when device is using WiFi module for main processing.
    You could maybe cut the traces from TuyaMCU to buttons and reroute them to WiFi module unused GPIOs, that could work...
    Of course that's assuming I understood you well.

    Btw, is this device using CB3S or WB3S?
    Helpful post? Buy me a coffee.
  • #3 20442199
    jakkumn
    Level 3  
    Thank you for your help! When I have a chance, I will get that setup and do some testing. I really appreciate your time and assistance!

    It sounds as if you understood my 'disconnecting' request correctly and I believe you probably are right on the fact that it won't be as straightforward as I would like considering the MCU is handling all the input processing. I recently retrofitted a fan to a 3-way switch and wanted to be more easily able to control the smart lights and the fan controller from what appears to be a single switch on the wall (aka this switch as it would provide on/off for the lights and 'dimmer' slide-like increments for the fan speeds). I know Tasmota offered an option to disconnect the input from the relay but, like I noted above, you're probably right given the MCU is doing the lifting here and don't believe the Tasmota version would work either. I will have to do some more research into if there may be a better solution up to and potentially making the traveler connected switches just dumb switches with input monitoring via a Shelly or similar device.

    The switch is currently using the WB3S.

    Again, thank you so much for your help! If you have any other questions around the switch, let me know. Happy to keep poking at it beyond using your example config above.
  • #4 20442209
    p.kaczmarek2
    Moderator Smart Home
    jakkumn wrote:
    I know tasmota offered an option to disconnect the input from the relay

    we also obviously have that, you can script channels anyway you want, you can use Btn_ScriptOnly and manually script Click, DblClick, 3 and 4x click events to for example run timers or toggle relays or anything, but still, in your case all processing is done on MCU, so the only way to go is to reroute trace to the WiFi module.

    Hmm if you want to have external switch you can always use Tasmota Device Group support, put any Tasmota or OBK switch into the same group as this switch, and they will power on/off in sync.

    Ok, so now... please test the config and if you need anything more, I'm here to help
    Helpful post? Buy me a coffee.
  • #5 20445974
    jakkumn
    Level 3  
    I spoke too soon, the button on the physical device was working as expected but I am not getting any sort of control from the web interface toggle. The state is not updating nor does the dimmer appear to be doing anything.
  • ADVERTISEMENT
  • #6 20446240
    p.kaczmarek2
    Moderator Smart Home
    Go to the Web App, enable all logs (debug ones also), do you get TuyaMCU packets?

    Try rebooting device, or totally powering it off for few seconds and again turn on.

    Do you get any kind of TyuaMCU communication working?
    Helpful post? Buy me a coffee.
  • #7 20453517
    mattj
    Level 9  
    Hey there!

    Sharing a photo of the latest (to my knowledge) board with the WB3S chip. Board is labelled v2.1, with a revision date of 2020/06/23.

    Not sure if I am missing something, but I can't seem to pull a bus connection. Were you connecting to the RX/TX on the chip itself, or going through the board pins? Do you have an updated diagram which you used with the Beken-chip version?

    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide

    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide

    Thanks!
  • ADVERTISEMENT
  • #8 20453552
    p.kaczmarek2
    Moderator Smart Home
    Solution is in the first post. It's a TuyaMCU device, you have to reset the MCU or cut traces to avoid interference.
    Solution:
    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide
    Helpful post? Buy me a coffee.
  • #9 20453638
    mattj
    Level 9  
    >>20453552

    I’ll give it another shot later. I tried both the “alligator clip to short” and “press and hold” methods - but neither seemed to work. The photo also described grounding GPIO-0, was that necessary here?
  • #10 20453747
    p.kaczmarek2
    Moderator Smart Home
    Is your MCU in TSSOP 28-Pin case? Check the linked datasheet where the nRESET pin exactly is.

    I don't think that GPIO0 means anything for Beken, it's not needed

    Remember to do a firmware read and backup first.
    Helpful post? Buy me a coffee.
  • #11 20457132
    mattj
    Level 9  
    Thanks! I think it was my attempt at grounding NRST - I went ahead and just soldered to the pad near the bottom of the board (with the button) after tracing it from the MCU. Flashed a handful of different BK chips now, slowly getting the hang of branching out to new devices - most just didn't have a Tuya MCU, so it was a bit more straightforward.

    Appreciate all the work here, this OpenBeken project is coming along pretty awesome!

    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide
  • #12 20463194
    jakkumn
    Level 3  
    Apologies for not replying earlier, I was away and unable to get to provide any information you were looking for.

    Looking at the logs I am not seeing any entries about TuyaMCU appearing, please see the excerpt below (this is post reboot as you requested). Mostly looks to be just ap and mqtt checks. I have also added (from the native UI) a screenshot showing that it appears the mcu driver is loaded. I can wait a while and also post later logs as well if need be. What else can I do to help figure out what is going on? Again, I really appreciate your help!
    Flashing OpenBeken on BK7231T TreatLife 3 Way Smart Dimmer Switch (DS02S): A Guide

    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-49,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Info:MAIN:Time 71, idle 245679/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 72, idle 254609/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 73, idle 253147/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 74, idle 250778/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 75, idle 252923/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 76, idle 508651/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 77, idle 252442/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 78, idle 252948/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 79, idle 252993/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 80, idle 251045/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=<redacted> gate=<redacted> mask=255.255.255.0 mac=<redacted> 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-49,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Info:MAIN:Time 81, idle 253698/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 82, idle 254437/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 83, idle 251242/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 84, idle 255804/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 85, idle 253072/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 86, idle 504801/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 87, idle 254560/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 88, idle 255622/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 89, idle 251224/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 90, idle 252645/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=<redacted> gate=<redacted> mask=255.255.255.0 mac=<redacted> 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-50,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Info:MAIN:Time 91, idle 247894/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 92, idle 253009/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 93, idle 254188/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 94, idle 252632/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 95, idle 250808/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 96, idle 254761/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 97, idle 255054/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 98, idle 251494/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 99, idle 255501/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 100, idle 252948/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=<redacted> gate=<redacted> mask=255.255.255.0 mac=<redacted> 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-50,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Info:MAIN:Time 101, idle 246492/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 102, idle 253746/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 103, idle 254648/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 104, idle 250561/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 105, idle 252242/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 106, idle 254893/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 107, idle 252629/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 108, idle 255535/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 109, idle 252841/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 110, idle 249418/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=<redacted> gate=<redacted> mask=255.255.255.0 mac=<redacted> 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-50,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Info:MAIN:Time 111, idle 250377/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 112, idle 253565/s, free 88344, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 113, idle 504777/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 114, idle 757956/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 115, idle 255904/s, free 76616, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 116, idle 508793/s, free 76616, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 117, idle 252708/s, free 76648, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 118, idle 251449/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 119, idle 251263/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:CMD:loglevel set 4
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    Info:MAIN:Time 120, idle 253664/s, free 88312, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1659008ms longests:0ms/0ms req:24ms/24ms unkn tcp/ip
    Debug:MAIN:PS: nosleep reasons 131998 0 0 381 0
    Info:GEN:dhcp=0 ip=<redacted> gate=<redacted> mask=255.255.255.0 mac=<redacted> 
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-50,ssid=<redacted>,bssid=<redacted> ,channel=11,cipher_type:CCMP
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    Info:MAIN:Time 121, idle 242282/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1671332ms longests:0ms/0ms req:24ms/24ms unkn tcp/ip
    Debug:MAIN:PS: nosleep reasons 129450 0 0 110 0
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    Info:MAIN:Time 122, idle 244542/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1699416ms longests:0ms/0ms req:24ms/24ms unkn tcp/ip
    Debug:MAIN:PS: nosleep reasons 132181 0 0 351 0
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    Info:MAIN:Time 123, idle 248780/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1667846ms longests:0ms/0ms req:24ms/24ms unkn tcp/ip
    Debug:MAIN:PS: nosleep reasons 132100 0 0 111 0
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    Info:MAIN:Time 124, idle 247012/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    
  • #13 20463226
    p.kaczmarek2
    Moderator Smart Home
    In Web App, set log level to Extra Debug, then keep log open, then clear log, then reboot device (while keeping log open) and show log starting from the very start of the device. Your log starts at Time = 71 seconds, which is above one minute of uptime already.

    @Matt_J , you also seem to have this device, is it working for you?
    Helpful post? Buy me a coffee.
  • #14 20463258
    jakkumn
    Level 3  
    I did as requested and now see the very beginning of the logs along with a TuyaMCU heartbeat.

    Info:MAIN:Module reboot in 1...
    Info:MAIN:Time 7, idle 246864/s, free 88384, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_userName <redacted>
    mqtt_pass <redacted>
    mqtt_clientID <redacted>
    mqtt_host <redacted>
    Info:MAIN:Time 8, idle 262650/s, free 88304, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to <redacted>/+/set
    Info:MQTT:mqtt_subscribed to <redacted>/+/set
    Info:MQTT:mqtt_subscribed to cmnd/<redacted>/+
    Info:MQTT:mqtt_subscribed to cmnd/<redacted>/+
    Info:MQTT:mqtt_subscribed to <redacted>/+/get
    Error:MQTT:MQTT client "<redacted>" request cb: err 0
    Info:MQTT:Publishing val 2 to <redacted>/sockets retain=0
    Info:MQTT:[g_bPublishAllStatesNow] item -8 result 0
    Info:MAIN:Time 12, idle 268248/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val -49 to <redacted>/rssi retain=0
    Info:MQTT:[g_bPublishAllStatesNow] item -7 result 0
    Info:MAIN:Time 13, idle 262616/s, free 88328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 13 to <redacted>/uptime retain=0
    Info:MQTT:[g_bPublishAllStatesNow] item -6 result 0
    Info:MAIN:Time 14, idle 264538/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 192.168.4.61 to <redacted>/ip retain=0
    Info:MQTT:[g_bPublishAllStatesNow] item -4 result 0
    Info:MAIN:Time 16, idle 291409/s, free 79704, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 17, idle 263111/s, free 88328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 18, idle 258563/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 21, idle 257271/s, free 88064, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 22, idle 261151/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 23, idle 265587/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 26, idle 264315/s, free 88064, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MAIN:Time 27, idle 272180/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 28, idle 273409/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 32, idle 273044/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 33, idle 263443/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 37, idle 274362/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 38, idle 287308/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 42, idle 273247/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 43, idle 280918/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 47, idle 266615/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 48, idle 261503/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 52, idle 537752/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 53, idle 280381/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 57, idle 258859/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 62, idle 269877/s, free 79672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 71, idle 256136/s, free 79672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Debug:MAIN:PS: 0ms/1539396ms longests:0ms/0ms req:24ms/4294967278ms unkn timer_thd
    Debug:MAIN:PS: nosleep reasons 121004 0 0 98 0
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 76, idle 254093/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1541418ms longests:0ms/0ms req:24ms/4294967278ms unkn timer_thd
    Debug:MAIN:PS: nosleep reasons 125039 0 0 268 0
    Debug:MQTT:MQTT deduper sent 0, culled duplicates 0, culled too fast 0
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:MAIN:Time 81, idle 242661/s, free 88296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Debug:MAIN:PS: 0ms/1546556ms longests:0ms/0ms req:24ms/4294967278ms unkn timer_thd
    Debug:MAIN:PS: nosleep reasons 123533 0 0 199 0


    I toggled the state on via the web interface, went to inspect and didn't see any change. I physically pushed the on button of the switch, saw the lights come on, and then turned it back off. This may be the output found in the log, otherwise it is just the repeated heart beat as seen above.

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    Info:TuyaMCU:Consumed 8 unwanted non-header byte in Tuya MCU buffer
    Info:TuyaMCU:Skipped data (part) F0 F0 F0 F0 F0 0A 02 F8 
  • #15 20463310
    p.kaczmarek2
    Moderator Smart Home
    There are no heartbeats at all.
    Try different baud rate.
    Common baud rates are 9600 bit/s and 115200 bit/s, the 9600 is default one.
    Alter your autoexec.bat to read:
    
    tuyaMcu_setBaudRate 115200 
    

    somewhere after startDriver TuyaMCU and try again.


    Another possibility to check would be to turn off the powersave. Remove "PowerSave" line if you have it. Maybe it somehow interferes with TuyaMCU.
    Helpful post? Buy me a coffee.
  • #16 20463344
    jakkumn
    Level 3  
    That would appear to be it! It is now working as expected. I can now control it from the web UI. Thank you so much for your help! I am going to edit the first post with these notes so that way anyone else that needs it has the information available.

    Next up is doing the home assistant mqtt side of things. I will edit the first post for that when I get to it as well.

    I really appreciate all the help p.kaczmarek2!
  • ADVERTISEMENT
  • #17 20463440
    mattj
    Level 9  
    I'm late to the party :) looks like it was resolved. EDIT: the addition of the 115200 baud rate fixed things for me too.

    I've also got different variants of the Treatlife series and I'll post some configs for those under separate threads (DS02 - single pole dimmer, DS02F - fan variant).
  • #18 20511919
    marcbria
    Level 2  
    Hi Everyone,

    So I followed the guide and flashed a DS02S (But single pole instead of 3 way, weird I know) with version 2.1 board successfully.
    I got it connected to my wifi and homeassistant, but I'm experiencing 2 odd behaviors.

    If it is not connected to the MQTT server and is manually turned ON after a small period of time it turns OFF.
    If it's turned OFF and loses its connection to the MQTT server upon reconnect it turns back ON.

    Is there anything I can do about this?

    Thanks for all the hard work, this is the first device I've tried to flash and I'm looking forward to doing more.
  • #19 20512044
    p.kaczmarek2
    Moderator Smart Home
    Maybe it's again the WiFi state issue and you need to put
    
    tuyaMcu_defWiFiState 4
    

    in your autoexec.bat, after starting TuyaMCU driver?
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md
    Helpful post? Buy me a coffee.
  • #20 20566728
    marcbria
    Level 2  
    Hi Everyone,

    Adding tuyaMcu_defWiFiState 4 resolved the issue with it turning off after a short time without a MTQQ connection.

    I've got another weird behavior, if I change the brightness using the web UI to a value below 10 it doesn't adjust the brightness. Setting the value to something above 10 works as expected.

    Here I dim the light to 40 using the web UI (the brightness changes) then set it to 2 (nothing happens)

    
    Info:GEN:CHANNEL_Set channel 2 has changed to 40 (flags 0)
    Info:MQTT:Channel has changed! Publishing 40 to channel 2 
    Info:MQTT:Publishing val 40 to obk12145B41/2/get retain=1
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk12145B41/2/get
    Info:MQTT:MQTT in topic obk12145B41/2/get
    Info:MQTT:MQTT topic not handled: obk12145B41/2/get
    Info:MQTT:channelSet NOT 'set'
    
    Info:GEN:CHANNEL_Set channel 2 has changed to 6 (flags 1)
    Info:MQTT:Channel has changed! Publishing 6 to channel 2 
    Info:MQTT:Publishing val 6 to obk12145B41/2/get retain=1
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk12145B41/2/get
    Info:MQTT:MQTT in topic obk12145B41/2/get
    Info:MQTT:MQTT topic not handled: obk12145B41/2/get
    Info:MQTT:channelSet NOT 'set'
    


    My autoexec.bat:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    tuyaMcu_defWiFiState 4
    


    Thanks again

    Added after 1 [hours] 48 [minutes]:

    Figured it out just needed to adjust the dimmer range in the config.

    tuyaMcu_setDimmerRange 100 1000

    works nicely.

    Added after 33 [minutes]:

    So after some source code reading and fiddling I've figured out the following:

    dpId 4 corresponds with the dimming mode (Valid values are 0,1,2)
    dpId 3 corresponds with the minimum dimming level (Valid values range is 10 - 1000)

    I'm using tuyaMcu_sendState in my autoexec bat to send the values

    So my autoexec.bat now looks like:
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_sendState 4 4 0
    tuyaMcu_sendState 3 2 10
    tuyaMcu_setDimmerRange 10 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    tuyaMcu_defWiFiState 4
    
  • #21 20567168
    p.kaczmarek2
    Moderator Smart Home
    Thank you for sharing information. This is very useful.

    I am aware about some devices being problematic without wifi state 0x04. I am considering making a 0x04 global default so even without MQTT all devices think that they are connected to cloud, but I am not sure yet if it's safe to do such a global breaking change in one of the updates.
    Helpful post? Buy me a coffee.
  • #23 20670418
    p.kaczmarek2
    Moderator Smart Home
    Was the template the same as the one posted?
    Helpful post? Buy me a coffee.
  • #24 20670486
    nl0
    Level 5  
    p.kaczmarek2 wrote:
    Was the template the same as the one posted?

    I may be misunderstanding your question, for now I'm using autoexec.bat
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    tuyaMcu_defWiFiState 4
    
  • #25 20670545
    p.kaczmarek2
    Moderator Smart Home
    Ah ok, sorry, I forgot that's a TuyaMCU device. Still, good to hear it's working.
    Helpful post? Buy me a coffee.
  • #26 20670628
    nl0
    Level 5  
    p.kaczmarek2 wrote:
    that's a TuyaMCU device.

    Yes, no pins, just this:
    
    {
    	"uart_baud":"115200",
    	"uart_databit":"3",
    	"uart_parity":"0",
    	"uart_stopbits":"1}bt_hid",
    	"prod_test":"false "
    }
    

    p.kaczmarek2 wrote:
    good to hear it's working.

    Thank you very much for your work!
  • #27 20815732
    slaroy
    Level 4  
    I followed the templates provided in this thread. The web GUI now shows a toggle button for power, and a slider for the dimmer. Unfortunately, whenever I toggle the power, a few seconds after I hear the relay click, the state reverts back to the original state in the GUI. For instance, if the GUI is showing it is ON, I click the button, it shows OFF, the relay clicks, then the GUI reverts back to ON, but without the relay changing state.

    Could this be an issue with OpenBeken? I was having the exact same problem when I flashed the device with ESPhome, which was the whole reason for trying to use OpenBeken instead. Anybody know how to solve the issue?
  • #28 20815902
    p.kaczmarek2
    Moderator Smart Home
    Please post your current autoexec.bat so I can have some basic glance over the what's going on.
    Helpful post? Buy me a coffee.
  • #29 20816414
    slaroy
    Level 4  
    Thanks for taking a look! It's literally the same as a previous post that was reported as working:

    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 115200
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_sendState 4 4 0
    tuyaMcu_sendState 3 2 10
    tuyaMcu_setDimmerRange 10 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    tuyaMcu_defWiFiState 4
    

    Chipset: BK7231T

    Build: Build on Aug 29 2023 06:14:35 version 1.17.230
  • #30 20816427
    p.kaczmarek2
    Moderator Smart Home
    This looks correct.

    Let's investigate more.

    Do a fresh reboot of the device (turn off mains totally).

    Open OBK page.

    Press the physical button on the device (NOT in OBK panel) - does OBK follow the state of the device correctly?

    Press physical button on the device again - did OBK follow the state?

    And press physical button again - did OBK follow the state?

    I am asking because I want to know whether OBK is able to "receive" the changes that are made on the device by touching physical touch button.
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around flashing the TreatLife 3 Way Smart Dimmer Switch (DS02S) with OpenBeken firmware, originally supported by Tasmota. Users share their experiences and configurations for successfully flashing the device, including the necessary connections to the BK7231T chip and the use of the BK7231GUIFlashTool. Key issues addressed include configuring the TuyaMCU driver, setting the correct baud rate (115200), and ensuring proper communication between the device and the web interface. Users also discuss troubleshooting steps for problems such as the device not responding to the web interface or reverting states. Solutions include adjusting the WiFi state and ensuring the device is under load for accurate state reporting.
Summary generated by the language model.
ADVERTISEMENT