logo elektroda
logo elektroda
X
logo elektroda

Tuya Water Sensor WiFi DY-SQ400B Flashing, Configuration for OBK Esphome/Tasmota style firmware

io2345 6450 110
ADVERTISEMENT
  • #91 21383516
    samoswall
    Level 5  
    >>21380844
    Yes, thank you! Moving to 1 line of DSTime works!

    Added after 33 [minutes]:

    A general question!
    We use the DoorSensor, and logically, opening is an important event!
    For a water leak sensor, on the contrary, closing is an important event.
    A binary sensor is automatically published in the Home assistant mqtt discovery.
    
    {
      "dev": {
        "ids": [
          "Water_Leak_Posudomoika"
        ],
        "name": "Posudomoika",
        "sw": "1.18.12",
        "mf": "Beken Corporation",
        "mdl": "BK7231N",
        "cu": "http://192.168.1.23/index"
      },
      "name": "0",
      "~": "WaterLeakPosudomoika",
      "pl_on": "0",          <-- this
      "pl_off": "1",          <-- this
      "uniq_id": "Water_Leak_Posudomoika_binary_sensor_0",
      "qos": 1,
      "stat_t": "~/0/get"
    }
    

    It would be more correct to change the water leak sensor.
    
      "pl_on": "1",
      "pl_off": "0",
    

    And add the device class moisture.
    I've set it up temporarily using MQTT Explorer.
    Is there any way to configure this, in the configuration for automatic changes?
  • ADVERTISEMENT
  • #92 21397272
    florianreus
    Level 4  
    Do you have a final autoexec script?
    - using the last ones sounds the alarm immediately
    - STime or DSTime? or is this the same?
    I'm sorry, I'm a beginner at openbeken.
  • #93 21397320
    samoswall
    Level 5  
    >>21397272
    STime does not exist (DSTime is correct)
    My working autoexec.bat
    
    DSTime 40 43200
    Battery_Setup 2800 4100 1.94
    Battery_cycle 20
    delay_s 2
    again:
    delay_s 1
    if $CH0==1 then DSTime clear
    if $CH0==1 then setChannel 5 80
    goto again
    
  • #94 21397367
    florianreus
    Level 4  
    hmm.
    then the alarm sounds immediately, and can not be turned off.
    the input is configured as doorsnsrwsleep_npup from the template.
  • #95 21397371
    samoswall
    Level 5  
    >>21397367
    As long as there is water, do not turn it off
  • ADVERTISEMENT
  • #96 21397599
    florianreus
    Level 4  
    There's no water.
    With "old" autoexec alarm sounded when I connected the 2 pins. Now the alarm starts directly after boot
    And sleep did never work.
  • #97 21397688
    samoswall
    Level 5  
    florianreus wrote:
    Now the alarm starts directly after boot

    Flag 42 - off
  • ADVERTISEMENT
  • #98 21401601
    florianreus
    Level 4  
    thank you!

    last problem - it is never entering sleep state. Any idea? anywhere I can debug?
  • ADVERTISEMENT
  • #99 21401937
    samoswall
    Level 5  
    >>21401601
    Insert DSEdge 0 into autoexec.bat in 2 lines
    DSEdge 0 was not activated in my configuration.
    But after several flashbacks, it was activated.
  • #100 21403880
    florianreus
    Level 4  
    and some trivial error - now I know I have to load the driver first.
    This is my working autoexec:

    startDriver DoorSensor
    DSTime 40 43200
    DSEdge 2
    Battery_Setup 2800 4100 1.94
    Battery_cycle 20
    delay_s 2
    again:
    delay_s 1
    if $CH0==1 then DSTime clear
    if $CH0==1 then setChannel 5 80
    goto again
  • #101 21403900
    samoswall
    Level 5  
    >>21403880
    DSEdge 0
    The "startDriver DoorSensor" is not necessary, because it starts automatically during configuration pins "8": "DoorSnsrWSleep_nPup;0"
  • #102 21405342
    florianreus
    Level 4  
    I'm quite sure pin 8 is configured. But without explicitly loading the driver I get "unknown command" for DSxx commands.

    Thanks for the help, and maybe my settings help someone.
  • #103 21417444
    tobb
    Level 9  
    Does anyone have experience with a different power supply? I have some spare 3.6 - 3.7 volt batteries that I could use. Will they fit? Will the voltage not be too high for this device?
  • #104 21417458
    tobb
    Level 9  
    Does anyone have experience with different methods of powering this device? I have some spare rechargeable batteries (Li-Ion, Li-MH) 3.6-3.7V. Will it work, or will the voltage be too high?
  • #105 21417473
    LEDówki
    Level 43  
    You have a battery of 3 batteries connected in series. The minimum voltage is 3 V or 2.7 V when you charge this battery immediately. The maximum voltage of 3x1.54 V = 4.62 V can damage the circuits. You need to check what voltage they can be powered up to. A 2-battery battery may be a bit too low a voltage, as we have between 1.8 V and 3.08 V.
  • #106 21417489
    florianreus
    Level 4  
    I powered my first device using a Li-ion battery directly. It's not working anymore, but did work some time. It might be because of the too high voltage.
    My current device is powered with another 3.7 V battery, but I put in a Zener diode (I found in the house) in front so the voltage is limited to 3.3. This is working good.
  • #107 21417572
    LEDówki
    Level 43  
    LiFePO4 has a 3.65 V maximum. It does not need to be charged to the maximum voltage either. Discharge has to be finished at 2.5 V.
    NiMH 2 pieces connected in series will simulate a CR123A cell quite well Link .
  • #108 21417597
    tobb
    Level 9  
    Thank you for your help, I will try with 2xNiMH to start with
  • #109 21433583
    luki6991
    Level 2  
    Hello. Does anyone have a final autoexec.bat that is fully functional? I have a problem where my device cannot be awakened by high water after about 10 minutes. If someone has a completely working configuration, I would be grateful!
  • #110 21437976
    io2345
    Level 7  
    The latest working autoexec.bat is in thread #100
  • #111 21440314
    luki6991
    Level 2  
    It still doesn’t work. Here is my import text:
    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Floor sitting Water Leak Flood Sensor Alarm",
    "model": "DY-SQ400B",
    "chip": "BK7231N",
    "board": "CB3S",
    "flags": "8",
    "keywords": [
    "CR123A",
    "battery",
    "buzzer",
    "detector"

    ],
    "pins": {
    "7": "PWM;5",
    "8": "DoorSnsrWSleep_nPup;0",
    "14": "BAT_Relay;1",
    "23": "BAT_ADC;2",
    "24": "Btn_ScriptOnly;1",
    "26": "LED;5"
    },
    "command": "DSEdge 0",
    "image": "https://obrazki.elektroda.pl/6240569600_1714757661.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic4052199.html"
    }

    Here is my autoexec.bat:
    startDriver DoorSensor
    DSTime 40 43200
    DSEdge 2
    Battery_Setup 2800 4100 1.94
    Battery_cycle 20
    delay_s 2
    again:
    delay_s 1
    if $CH0==1 then DSTime clear
    if $CH0==1 then setChannel 5 80
    goto again

    My device falls into such a deep sleep after a few minutes that not even high water can wake it up. I’m wondering if the issue could be with the flags. What flags should I have? Thanks!

Topic summary

The discussion revolves around the Tuya WiFi Water Sensor DY-SQ400B, focusing on its flashing and configuration for OBK (OpenBeken) and Tasmota firmware. Users explore the device's components, including the CB3S Com-Board and the CR123A 3V battery. Initial inquiries about the device's chip and UART connections lead to suggestions for capturing data using TuyaMCU. As users attempt to flash the device, they encounter issues with UART communication and configuration settings. The conversation includes troubleshooting steps, firmware backup procedures, and the implementation of deep sleep functionality to optimize battery life. Users share their experiences with MQTT integration and alarm configurations, ultimately achieving a working setup for water detection and alerting.
Summary generated by the language model.
ADVERTISEMENT