logo elektroda
logo elektroda
X
logo elektroda

[CBU/BK7231N] Smart Life SW100 Water Leak Flood Sensor: Pin Config & Autoexec

divadiow 1383 4
ADVERTISEMENT
  • Helpful post
    #1 21097453
    divadiow
    Level 34  
    Photo of a circuit board featuring a CBU module and a pinout diagram.
    Same situation as this device https://www.elektroda.com/rtvforum/topic4056568.html. Bought a few door contact/water leak sensors hoping for an XR809 module, but got CBUs and a CB3S. May as well post for the device list and somewhere for future discussions about each type for other users. This is a CBU/BK7231N version of this https://www.elektroda.com/rtvforum/topic4052871.html#21086916

    Factory dump attached. v1.0.6 so cloudcutterable.

    Screenshot of a water detection app showing the status Normal. Device update screen indicating no updates available. App screen showing water sensor addition. Packaging of water leak detector model SW100. Packaging of the Wi-Fi water leak sensor SW100 with a barcode. Electronic circuit of a water sensor with an open casing. Circuit board of the Smart Life Flood Water Leak Detector with visible electronic components.

    Easy UART is able to extract the pin config for this one

    Code: Text
    Log in, to see the code


    Code: Text
    Log in, to see the code


    there's mention of a sound pin and bz frequency but P8 doesn't trace anywhere I can see (not to L1 or URI missing component pads). The TP pads trace to:

    Photo of a circuit board featuring a CBU module and a pinout diagram.

    TP1 and TP5 (or TP7?) could not be determined. Maybe one goes to P21/SDA1 on the back of the CBU where I cannot reach.

    Basic starter autoexec:

    Code: Text
    Log in, to see the code


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

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

    Screenshot of the WaterLeak2_CBU device interface showing battery level, voltage, and water status.

    OBK template:
    Code: JSON
    Log in, to see the code


    https://github.com/OpenBekenIOT/webapp/commit/a29bbb6a5e69cf000c920834f31038ee75c9c5a1
  • ADVERTISEMENT
  • #2 21097601
    p.kaczmarek2
    Moderator Smart Home
    Thank you for presentation. Here are my few hints:

    While keeping device awake as long as water is detected was indeed requested by some users, this is not recommended in my opinion. It will drain batteries fast.

    Your script could be a bit improved for a situation where MQTT is not online. Currently it will just wait for it forever, but you could add a "repeating event" for it to go to sleep after 2 minutes.

    Futhermore, the same could be done currently with DoorSensor driver, as it has recently gained "automatic wakeup" function as well, you can set it with DSTime, arguments are:
    
    DSTime [timeSeconds] [optionalAutoWakeUpTimeSeconds]
    

    Some more info:
    https://www.elektroda.com/rtvforum/find.php?q=DoorSensor
    https://www.elektroda.com/rtvforum/find.php?q=DSTime
    Still, a DIY autoexec.bat is also good

    And last, I will say it's interesting to see this device with CBU. CBU is the most useful module so far, as it has already routed out P16, which can be used WS2812B:
    https://www.elektroda.com/rtvforum/topic4005865.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21097611
    divadiow
    Level 34  
    Thanks for the tips!

    No, I don't imagine wanting the sensor to stay on either. One email, or some other alert signal, would surely suffice. What happens as a result of that one alert can be built outside of the device.

    Good point about the MQTT.

    Also, I wasn't yet sure if there was any practical difference between using dinput Vs door sensor. Door sensor obviously looks a bit wrong aesthetically in the gui but...

    I did use door sensor on the contact sensor with alarm device but was wondering if it should be changed for dinput.
  • ADVERTISEMENT
  • #4 21097621
    p.kaczmarek2
    Moderator Smart Home
    Oh the answer to the "difference" question is actually in our docs:
    Table with a description of DoorSensor function and its auto-start in deep sleep mode.
    DoorSensor pin is the same as dInput, it's just also linked to the driver and will cause driver autostart. That's because some of the users may prefer to have their devices working withour scripting and just setting a DoorSensor pin is easier than writing/copying autoexec.bat.

    Hmm you have a point with that aesthetic, but how can we fix that? Rename DoorSensor to, idk, SleepSensor?
    Helpful post? Buy me a coffee.
  • #5 21098108
    divadiow
    Level 34  
    ok sure.

    So how about this. BUT shouldn't the if $MQTTState==0 be if $MQTTState==1?

    With if $MQTTState==1 it goes into the 300s sleep but MQTT is definitely connected. With if $MQTTState==0 it will go to 86400s sleep.

    Code: Text
    Log in, to see the code


    yes flag 10 is set

    Added after 13 [minutes]:

    p.kaczmarek2 wrote:
    Hmm you have a point with that aesthetic, but how can we fix that? Rename DoorSensor to, idk, SleepSensor?


    Hmm. Maybe? Will a full rename screw all the existing installs and all the mentions and guides in forums?

    Added after 3 [minutes]:

    Hang on. I've just remembered wake from sleep doesn't actually resume from standby and resume script from where it stopped does it. It'll reboot, so the goto start after 300s is pointless

    Added after 7 [hours] 53 [minutes]:

    hmm. interesting https://www.elektroda.com/rtvforum/topic3945688-210.html#20792033
ADVERTISEMENT