logo elektroda
logo elektroda
X
logo elektroda

Another Generic Tuya Water Leak Flood Detector TY-SJ-01 - no Audio Alarm [CBU/BK7231N]

divadiow 1524 12
ADVERTISEMENT
  • #1 21097283
    divadiow
    Level 34  
    Just wanted to add another device to the device list and have a thread to link it to. I won't go into too much detail about the flashing and config as there are many other threads for very similar devices.

    This is from Ali https://www.aliexpress.com/item/1005006024045641.html
    Screenshot of a product page for a Tuya water sensor on AliExpress.

    CBU/BK7231N module.

    Device update screen indicating no updates available. Screenshot of a mobile app showing the state of a water sensor. App screen for adding a device with a successfully added water sensor. Image of a water leak detector box with technical specifications displayed. CBU/BK7231N module on a table with connecting wires. Water leak detector module with electronic components.

    boot log

    Code: Text
    Log in, to see the code


    autoexec to publish and label water sensor state and put into deep sleep, configure battery.

    Code: Text
    Log in, to see the code


    Screenshot displaying WaterLeak_CBU sensor status information.

    Could probably get fancier with dry/wet sensor state, instead of on/off, in HA. And a nice automation to raise an email or other kind of alarm when water is detected. Device won't currently stay awake if water is detected.

    Device does wake from deep sleep on button push and on sensor state change. Successful MQTT connection required.

    OBK Template

    Code: JSON
    Log in, to see the code
  • ADVERTISEMENT
  • #3 21144037
    0xlnz
    Level 5  
    Hi, I'm new here.

    > I won't go into too much detail about the flashing and config as there are many other threads for very similar devices.

    Can you point me in the right direction as to where to find info on how to flash OpenBeken on this particular device? I have a couple of these sensor I would very much like to break free, but the information I found about how to flash BK7231N (here: https://www.elektroda.com/rtvforum/topic3951016.html) shows the chip's pinout with 8 rows of vertical pins, whereas the CBU from this water leak sensor only has 7?
  • ADVERTISEMENT
  • #4 21144059
    divadiow
    Level 34  
    similar devices with CBU

    https://www.elektroda.com/rtvforum/topic4055031.html
    https://www.elektroda.com/rtvforum/topic4056603.html

    of course I forget that sometimes when you first start out, a thread that details everything you need to know about your specific device is what you're looking for. Trawling through threads and instructions relating to other devices can be a pain.
  • #5 21144065
    0xlnz
    Level 5  
    hehe not my first rodeo but I figured I'd ask (:

    Thanks a lot for pointing me in the right direction, time to get my hands dirty!
  • ADVERTISEMENT
  • #7 21144478
    0xlnz
    Level 5  
    >>21144071

    all done. was easy enough (:

    thanks for the awesome work!
  • ADVERTISEMENT
  • #9 21153445
    0xlnz
    Level 5  
    Hey @divadiow,
    I noticed a weird behavior with this device, let me explain:
    -device starts in deep sleep, last known value was 0-
    1. On state change of the sensor from 0 to 1, the device is turned on from deep sleep, it reports its status to the mqtt server and then goes back to sleep after 60 seconds.
    2. If the state then changes from 1 to 0, the device is NOT turned on to report the changed status.
    3. what's worse is that when the status changes again from 0 to 1, it does not wake from deep sleep like it did on step 1 (I'm guessing since it doesn't detect a state change, since the last state was 1?)

    If however, i let the sensor go from 1 to 0 before it goes to deep sleep again, then it wakes up as expected on the next status change.

    Just wondering if this is the expected behavior or if there is something else I'm missing. as it stands I have to manually reboot (by unplugging a battery or pushing the reset button) each time it triggers or it doesn't wake again from a state change. (now that I'm thinking about it, It should wake itself anyway after 24h and reset the sensor then... but there is still a 24h windows where state changes are not detected :)

    Hope I was clear enough, let me know what you think
  • #10 21153590
    divadiow
    Level 34  
    Ah. I think I understand. I have not actually used the device for the purpose it was intended, so will set it up again to play. Sorry, that's no help yet :)

    Added after 2 [hours] 5 [minutes]:

    What is your complete autoexec btw?

    Is this issue perhaps solved with the dsedge setting?

    https://www.elektroda.com/rtvforum/topic4023117.html#20872182
  • Helpful post
    #11 21156555
    0xlnz
    Level 5  
    >>21153590

    I did some quick testing, and setting DSEdge 0 seems to wake the sensor on both state change (wet to dry and dry to wet)
    However, when waking due to dry to wet, the sensor seems to wake up two times in a row (not much of a problem but I find it noteworthy). Does not happen on wet to dry.

    full autoexec (copied from your post, only DSEdge 0 added):
    // Powersave mode
    powersave 1
    //Battery config
    Battery_Setup 2000 3000 2.16 2400 4096
    //measure batt every 2s
    Battery_cycle 2
    //mqtt_broadcastInterval 1
    //mqtt_broadcastItemsPerSec 5
    // Add event to make button hold launch safe mode
    addEventHandler OnHold 20 SafeMode 5
    setChannelLabel 5 Water
    // now wait for MQTT
    waitFor MQTTState 1
    // extra delay, to be sure
    delay_s 1
    // publish water state at least once after boot
    publishchannel 5
    DSEdge 0
    // All good, sleep for 1 day or next water event after 60s
    delay_s 60
    PinDeepSleep 86400
  • #12 21156557
    divadiow
    Level 34  
    ah OK cool.

    not sure what to say about the double wake though. any clues in the logs about what triggered it?
  • #13 21156675
    0xlnz
    Level 5  
    >>21156557

    Can't seem to find anything relevant, this is the log for the first wake:
    (the probe was just submerged)

     changed to 1 (flags 0)
    
    Info:GEN:CHANNEL_Set channel 3 has changed to 0 (flags 0)
    
    Info:DRV:DRV_BATTERY : battery voltage : 2733.750000 and percentage 73.375000%
    Info:MAIN:Time 2, idle 68989/s, free 79800, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 3, idle 65407/s, free 79800, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 3 has changed to 1 (flags 0)
    
    Info:GEN:CHANNEL_Set channel 3 has changed to 0 (flags 0)
    
    Info:DRV:DRV_BATTERY : battery voltage : 2731.218750 and percentage 73.121871%
    


    And this is the second time it wakes:
    (the probe remained submerged in a glass of water, no state change)

    
    idle 143931/s, free 79888, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 3 has changed to 1 (flags 0)
    
    Info:GEN:CHANNEL_Set channel 3 has changed to 0 (flags 0)
    
    Info:DRV:DRV_BATTERY : battery voltage : 2722.359375 and percentage 72.235939%
    Info:MAIN:Time 2, idle 68175/s, free 79800, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:MAIN:Time 3, idle 62882/s, free 79800, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 POWERSAVE
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 3 has changed to 1 (flags 0)
    
    Info:GEN:CHANNEL_Set channel 3 has changed to 0 (flags 0)

Topic summary

The discussion revolves around the Tuya Water Leak Flood Detector model TY-SJ-01, which utilizes the CBU/BK7231N module. Users share experiences regarding flashing the device with OpenBeken firmware, troubleshooting issues related to its deep sleep mode, and the behavior of the sensor during state changes. One user reports that the device fails to wake from deep sleep on certain state changes, requiring manual rebooting. Another user suggests modifying the autoexec settings, specifically the DSEdge parameter, which appears to resolve some wake issues. The conversation includes links to relevant resources and logs for further analysis.
Summary generated by the language model.
ADVERTISEMENT