EU

WF-CS01 Curtain Switch

Available from:
Aliexpress.com
Aliexpress.com

Template

{"NAME":"Tuya Shutter","GPIO":[157,0,54,10,22,19,0,0,17,21,53,23,52],"FLAG":0,"BASE":18}

Added a rule to get it working properly:

Rule1 on Power1#State=1 do backlog Power3 0; Power2 0 endon
      on Power2#State=1 do backlog Power1 0; Power2 0; Power3 0 endon
      on Power3#State=1 do backlog Power1 0; Power2 0 endon
Rule1 1

This combines to:

`Rule1 on Power1#State=1 do backlog Power3 0; Power2 0 endon on Power2#State=1 do backlog Power1 0; Power2 0; Power3 0 endon on Power3#State=1 do backlog Power1 0; Power2 0 endon`

Or use the Interlock settings like below (or use both for safety).

Added some commands too:

InterLock 1,2,3  # lock the relays, only one relay can be on
InterLock    on  # switch interlocking on
PowerOnState  0  # keep relay(s) OFF after power up
PowerRetain   0  # don't retain states
PulseTime1  145  # set relay 1 activation to 45 seconds (+100 for 1sec interval)
PulseTime2    1  # deactivate button 2 immediately after activation (disables relays)
Pulsetime3  145  # set relay 3 activation 45 seconds (+100 for 1sec interval)
SetOption1    1  # restrict button-multipress to single, double and hold actions
SetOption26   1  # use indexes (Power1 iso Power)
SetOption56   1  # Wi-Fi network scan to select strongest signal on restart
SetOption57   1  # Wi-Fi network re-scan, alternate AP

This combines to:

Backlog Delay 50; InterLock 1,2,3; InterLock on; PowerOnState 0; PowerRetain 0; PulseTime1 145; PulseTime2 1; Pulsetime3 145; SetOption1 1; SetOption26 1; SetOption56 1; SetOption57 1; Restart 1

A second solution to use this curtain switch. Template:

{"NAME":"WF-CS01","GPIO":[157,0,54,18,22,11,0,0,9,21,53,23,52],"FLAG":0,"BASE":18}

Some rules to change button color and hold the middle button to turn the timer on or off. (LED status is not perfect if you use the web interface for the timer!)

rule1 on Power1#State=0 do LEDPower1 0 endon on Power1#State=1 do LEDPower1 1 endon on Power3#State=0 do LEDPower3 0 endon on Power3#State=1 do LEDPower3 1 endon
rule1 1

rule2 on button2#state=2 do backlog timers 2; LEDPower2 2 endon
rule2 1

An some important commands:

interlock 1 2 3 # lock the relays, only one relay can be on
SetOption1 1    # restrict button-multipress to single, double and hold actions
PulseTime1 145  # set relay 1 activation to 45 seconds (+100 for 1sec interval)ru
PulseTime2 1    # deactivate button 2 immediately after activation (disables relays)
Pulsetime3 145  # set relay 3 activation 45 seconds (+100 for 1sec interval)
PowerOnState 0  # keep relay(s) OFF after power up
PowerRetain 0   # Don't retain states
SwitchMode1 5   # pushbutton with hold
SwitchMode2 0   # toggle (default)
SwitchMode3 5   # pushbutton with hold
SetOption11 1   # Swap button single and double press functionality

This module is based on the Tuya TYWE3S and TuyaConvert isn’t working anymore (but one can always try..) 20190918_122058

The inside of this module looks like this: 20190918_121854 20190918_122039

And the processor boards: 20190918_122039 20190918_122129

The device has a separate MCU on board which connects to the TYWE3s module via Rx and Tx. 20190918_122059

To be able to flash the device one needs to make 5 connections and CUT the RxD0 line: 20190918_121926

Flashing can be done in several ways: Arduino IDE, VSCode, Platformio, ESP8266Flasher, etc.

!!! BE CAREFUL: always use 3,3 volts for power, NOT 5 volts, and DISCONNECT THE MAINS COMPLETELY while working on the device !!!

The WF-WS01/02/03 have the same boards inside and can be flashed the same way.