I did not find the exact config for https://de.aliexpress.com/item/1005005664191871.html.
So I started from here: https://www.elektroda.com/rtvforum/topic4011762.html#20795168.
But the button function was not as expected: only holding a button should activate a relay - there should be no push button mode. Nevertheless, I want to keep the 30 seconds relay active time. So I changed the autoexec.bat to the following:
// Autoexec.bat file for Tuya Wi-Fi Curtain Module, please adapt to your hardware if different
startDriver SSDP
PowerSave 1
// P7 - L1 Relay Channel 1 Close
// P23 - L2 Relay Channel 3 Open
// P24 - S1 Btn Channel 1 Close
// P26 - S2 Btn Channel 3 Open
// Channel 2 - Stop
// Channel 4 - Close is finished
// Channel 5 - Open is finished
// P8 - Wifi Btn
// P6 - Wifi LED
// ntp setup
ntp_setServer 192.168.178.1
ntp_timeZoneOfs +01:00
startDriver NTP
// daily automatic close/open
addClockEvent 19:00 0x7f backlog SetChannel 1 1; startScript autoexec.bat resetClose
addClockEvent 09:00 0x7f backlog SetChannel 3 1; startScript autoexec.bat resetOpen
// description
SetChannelLabel 1 Close
SetChannelLabel 2 Stop
SetChannelLabel 3 Open
// configure buttons
addEventHandler OnHold 24 if Channel4 == 0 then backlog setChannel 1 1
addEventHandler OnRelease 24 backlog setChannel 1 0
addEventHandler OnHold 26 if Channel5 == 0 then backlog setChannel 3 1
addEventHandler OnRelease 26 backlog setChannel 3 0
// logic
alias Reset_Stop_Close backlog SetChannel 2 0; SetChannel 1 0
alias Reset_Stop_Open backlog SetChannel 2 0; SetChannel 3 0; SetChannel 4 0; SetChannel 5 0
alias Reset_Close_Open backlog SetChannel 1 0; SetChannel 3 0
addChangeHandler Channel1 == 1 backlog Reset_Stop_Open; startScript autoexec.bat resetClose
addChangeHandler Channel2 == 1 backlog Reset_Close_Open; startScript autoexec.bat resetStop
addChangeHandler Channel3 == 1 backlog Reset_Stop_Close; startScript autoexec.bat resetOpen
// do not proceed
return
// Scripts
resetClose:
delay_s 30
// stop close and notice close is finished
SetChannel 1 0
SetChannel 4 1
return
resetStop:
delay_s 1
// disable button
SetChannel 2 0
stopAllScripts
return
resetOpen:
delay_s 30
// stop open and notice open is finished
SetChannel 3 0
SetChannel 5 1
return