logo elektroda
logo elektroda
X
logo elektroda

How to Configure BK7231N/CB3S Tuya Sprycle WiFi Water Timer Bought from AliExpress

andrewmarkcongdon 1149 13
ADVERTISEMENT
  • ADVERTISEMENT
  • #2 20892240
    p.kaczmarek2
    Moderator Smart Home
    There is no Tuya JSON data in the attached binary file. It seems that you need to investigate the PCB to find out the GPIO roles. Have you tried using GPIO doctor?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20892295
    andrewmarkcongdon
    Level 7  

    p.kaczmarek2 wrote:
    There is no Tuya JSON data in the attached binary file.


    Yes, I need to investigate further, thanks.
    Unlike a couple of other outdoor things I was looking at today, this one wasn't potted, so I can make some progress later.
  • #4 20892300
    p.kaczmarek2
    Moderator Smart Home
    This may require some script to turn off relay after 2 or 3 seconds but it's easily doable with OBK
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20987824
    andrewmarkcongdon
    Level 7  

    P9 Button
    P14 Motor Open Valve
    P24 LED
    P26 Motor Close Valve

    Yes 2 - 3 seconds for the motor to complete its cycle sounds about right.
  • ADVERTISEMENT
  • #6 20987982
    p.kaczmarek2
    Moderator Smart Home
    Can you attach it as full JSON template from the OBK Web App?
    Helpful post? Buy me a coffee.
  • #8 20989346
    p.kaczmarek2
    Moderator Smart Home
    Thank you!
    Code: JSON
    Log in, to see the code

    Do you need any futher help with configuring the device?
    Helpful post? Buy me a coffee.
  • #9 20993554
    andrewmarkcongdon
    Level 7  

    p.kaczmarek2 wrote:
    Do you need any further help with configuring the device?


    For now manually turning on/off the device is working.
    I'm hoping to get to an automated script?
    Next step is the 2-3 second toggle. So OBK is where I should be looking next?
    The goal is to add a Zigbee moisture sensor in the future.
  • Helpful post
    #10 20993719
    p.kaczmarek2
    Moderator Smart Home
    You can very easily configure device to open and close the relay after given time. Check out our autoexec samples:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    For example, the following code may be altered to suit your needs:
    
    // This aliased command will turn off relay on CH1 after 10 seconds
    // addRepeatingEvent	[IntervalSeconds][RepeatsOr-1][CommandToRun]
    alias turn_off_after_time addRepeatingEvent 10 1 setChannel 1 0
    // this will run the turn off command every time that CH1 becomes 1
    addChangeHandler Channel1 == 1 turn_off_after_time 
    

    You can also check the clock events:
    
    // setup NTP driver
    startDriver ntp
    // set your time zone
    ntp_timeZoneOfs 10:00
    
    // create command aliases for later usage
    alias day_lights backlog led_temperature 200; led_dimmer 100; echo lights_day
    alias night_lights backlog led_temperature 500; led_dimmer 50; echo lights_night
    
    // at given hour, change lights state
    addClockEvent 06:01 0xff 1 day_lights 
    addClockEvent 20:01 0xff 1 night_lights 
    
    // wait for NTP sync
    waitFor NTPState 1
    // after NTP is synced, just after reboot, adjust light states correctly
    if $hour>=06&&$hour<21 then day_lights
    if $hour>=21||$hour<06  then night_lights
    
    

    How to create autoexec.bat:


    Helpful post? Buy me a coffee.
  • #11 21000601
    andrewmarkcongdon
    Level 7  
    I changed the pin definitions slightly:

      "pins": {
        "9": "Btn;3",
        "14": "Rel;0",
        "24": "LED;2",
        "26": "Rel;1"
      },
    


    So I could toggle the LED state to reflect the valve state.
    Similarly the button could be scripted to toggle valve state.

    // Channel 0 - Water Off
    // Channel 1 - Water On
    // Channel 2 - LED
    
    alias turn_off_led backlog setChannel 2 0
    alias turn_on_led backlog setChannel 2 1
    
    // This will automatically turn off relays after about 2 seconds
    // NOTE: addRepeatingEvent [RepeatTime] [RepeatCount]
    alias stop_flow backlog turn_off_led; addRepeatingEvent 2 1 setChannel 0 0
    alias start_flow backlog turn_on_led; addRepeatingEvent 2 1 setChannel 1 0
    
    addChangeHandler Channel0 != 0 stop_flow
    addChangeHandler Channel1 != 0 start_flow


    I can change the state of channel 1 and 0 using mqtt so remote script control works too.
    I also added PowerSave in startup.
  • #12 21000702
    p.kaczmarek2
    Moderator Smart Home
    Good job on scripting that. I may add that script to our autoexec.bat examples. Is this a final version, or is there anything more I can help you with?
    Helpful post? Buy me a coffee.
  • #13 21005974
    andrewmarkcongdon
    Level 7  

    Couldn't find a suitable OpenBeken compatible moisture sensor so went with this

    2-in-1 soil sensor next to a plant, measuring moisture and temperature.

    and a ZBDongle-E. Works OK, posts results to MQTT allowing simple closed loop scripting, but the battery life looks like only a week.
  • #14 21512504
    piotrszulc1
    Level 9  
    FYI there's a new version of this device - based on cbu (was cb3s), firmware reported by Tuya App is 1.0.0.
    The firmware is patched so cannot be cloudcut.
    The device looks almost identical on the outside, except that the led is now red (was blue). Can be opened and flashed over serial as the previous version.
    The pinout has changed though, now it is as follows:

    P17 - button, inverted
    P26 - red LED
    P7/P6: on/off relays, to be used with bridge driver

Topic summary

The discussion revolves around configuring the BK7231N/CB3S Tuya Sprycle WiFi Water Timer purchased from AliExpress. Users are exploring GPIO roles and scripting for relay control. Initial responses indicate a lack of Tuya JSON data in the binary file, prompting further investigation of the PCB. Users share pin definitions and scripting examples to automate relay operations, including toggling the valve and LED states. The conversation also touches on integrating a Zigbee moisture sensor for future automation, with suggestions for using OpenBeken firmware and MQTT for remote control.
Summary generated by the language model.
ADVERTISEMENT