New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a new template/module for a new Wallpad 4CH Touch Switch (Tuya TYWE3S based device) #5545
Comments
You can use rules to get the device usable with Tasmota. Solution is similar to this https://github.com/arendst/Sonoff-Tasmota/wiki/LC-Technology-WiFi-Relay |
@Jason2866 when in generic template the serial communication doesn't work. when configuring GPIO 0 and GPIO 2 for relays while in tuya dimmer template it doesn't even show the relay control in the main menu. |
You have to use module generic. I dont understand why serial communication doesnt work for you. |
dont know. it only send and recieve serial data in "Tuya Dimmer" template. |
I bought the US version of the Tuya 4 Ch touch switch, it does not use the Tuya serial, it directly use the gpio's as below. {"GPIO0":"25 (Relay5)","GPIO1":"0 (None)","GPIO2":"0 (None)","GPIO3":"19 (Button3)","GPIO4":"23 (Relay3)","GPIO5":"17 (Button1)","GPIO12":"20 (Button4)","GPIO13":"24 (Relay4)","GPIO14":"22 (Relay2)","GPIO15":"21 (Relay1)","GPIO16":"18 (Button2)"}. |
where did you buy it? can you send the link? |
the same is available in the Aliexpress but i dont have the link, you can get it |
thank you. how is the touch response in the switch? does it respond immediately or it takes a slight delay to react? |
when I use generic with GPIO it has 1 sec delay but after defining the template in tasmota it works fast. {"NAME":"Tuya 4 Channel","GPIO":[255,255,255,19,23,17,0,0,20,24,22,21,18],"FLAG":0,"BASE":18} GPIO0 is the Wifi Icon LED if you want to control. |
good work |
I think this thread has reached a conclusion and therefore its being closed |
Hi
I have done some analysis and found the following, have special Tuya
Devices not fully supported by Tasmota Tuya code,
as Tuya get more popular we may expect some new devices.
My findings,
1. I*t assume only one power for Tyua Serial devices.*
update devices_present = 4 in sonoff.ino, will allow you to add button or
extra power for current Tuya dimmer with GPIO's
devices_present = 1 fro dimmer. In my case it 3 (dimmer 2 , dimmer power 1
, other power 3)
else if (TUYA_DIMMER == my_module_type) // if TUYA_XXXXXX if you defined
new template
{
devices_present = 3; // devices_present = Setoption; to better support for
new devices
}
2. *It assume the Power is always Device 1, but in reality it can change
based on the device. *
standard Tyua dimmer power is 1but various for device, as per the
Protocol tuya_buffer[6] dimmer id
*Example: *I have the Tyua device has Fan Dimmer and Light switch (link :
https://www.amazon.com/gp/product/B07M77KCYJ/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
)
in my device
MCU to ESP --> 55AA010700050*3*0100010112
case TUYA_CMD_STATE:
* ......*
* if(tuya_buffer[6] == 1 ) // Device -->1 Dimmer Power *
{
if((power || Settings.light_dimmer > 0) && (power !=
tuya_buffer[10])) {
*ExecuteCommandPower(1*, tuya_buffer[10], SRC_SWITCH); // send
SRC_SWITCH? to use as flag to prevent loop from inbound states from
faceplate interaction
}
}
*if(tuya_buffer[6] == 3 ) // Device -->3 Light Switch *
{
*ExecuteCommandPower(3*, tuya_buffer[10], SRC_SWITCH); // send
SRC_SWITCH? to use as flag to prevent loop from inbound states from
faceplate interaction
}
//in your case you need add 1,2,3,4 for tuya_buffer[6] and remove
the Dimmer part as it is device 2
ESP to MCU --> 55AA000600050*3*0100010110, I used XdrvMailbox.notused to
pass the deviceId from "Sonoff.ino" and "xdrv_04_light.ino"
bool TuyaSetPower(void)
{
bool status = false;
uint8_t deviceId = XdrvMailbox.notused;
uint8_t rpower = XdrvMailbox.index;
int16_t source = XdrvMailbox.payload;
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: SetDevicePower.rpower=%d, deviceId=
%d"), rpower, deviceId);
if (source != SRC_SWITCH && TuyaSerial) { // ignore to prevent loop from
pushing state from faceplate interaction
if(deviceId == 1) // 3 is dimmer
{
TuyaSendBool(1, rpower);
}
if(deviceId == 3) // 3 is dimmer
{
TuyaSendBool(3, rpower);
}
status = true;
}
return status;
}
Thanks
Thiru
…On Mon, Apr 8, 2019 at 9:56 PM Rambylon ***@***.***> wrote:
what the hell? what is that conclusion? do you know how it can be
controlled @blakadder <https://github.com/blakadder> ? when i came to you
for help, you wont help me with my problem. ok i left you alone. Now why
did you close this? what the hell is wrong with you?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5545 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AdTyEws6eZrq3lTU7eqP2IyrcfM74LqSks5vfAFtgaJpZM4cRmKE>
.
|
im very well confused and im not expert with tasmota recoding. can you be more detailed? @thirug010 it would be very helpful. there is no dimmer in my device. just 4 relays. |
Hi,
I am updating the code based on the your Serial Data in the Excel
file, I will get back to you ASAP.
Thanks
Thiru
…On Fri, Apr 19, 2019 at 6:54 AM Rambylon ***@***.***> wrote:
im very well confused and im not expert with tasmota recoding. can you
help me out a bit? i would be very grateful
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5545 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHKPEE7NYJURUA5VRH4CXHLPRGXF7ANCNFSM4HCGMKCA>
.
|
thank you @thirug010 are you tamil? |
Yes
…On Sat, Apr 20, 2019 at 10:06 AM Rambylon ***@***.***> wrote:
thank you @thirug010 <https://github.com/thirug010> are you tamil?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5545 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHKPEE5LEFTWOCKZEMQ4GNLPRMWN7ANCNFSM4HCGMKCA>
.
|
Hi @Rambylon, I have updated the 6.5.0 code to support 4 gang Switch. I tested with Wemo + serial Terminal for the communication,
update the sonoff.ino and xdrv_16_tuyadimmer.ino from the .zip folder and compile and update the firmware. Thanks |
thank you @thirug010 i flashed the update through ota. and the firmware now recognizes 4 switches. switching them works perfectly when done one by one. but when more than two switches are on and when we try to turn off one it doesnt work. the relay doesnt click and the display shows off for a second and goes back to its previous state (in openhab). In tasmota web UI it shows like this the console shows
for POWER4 OFF it sends TX data of 4th relay ON. but it should send off data. the same happens for the POWER3. the weird thing is it sends correct data when all other switches are off. this only happens when another switch is on. why do you think this happens? and share me a way to contact you personally other than this issue. im also from your state. |
Can you give me the Console log with option 4 I will check and update you
My email : thirug010@gmail.com
Thanks
Thiru
…On Sat, Apr 20, 2019 at 10:26 PM Rambylon ***@***.***> wrote:
thank you @thirug010 <https://github.com/thirug010> i flashed the update
through ota. and the firmware now recognizes 4 switches. switching them
works perfectly when done one by one. but when more than two switches are
on and when we try to turn off one it doesnt work. the relay doesnt click
and the display shows off for a second and goes back to its previous state.
Like this
[image: tuya problem 6]
<https://user-images.githubusercontent.com/49051701/56465005-01de1a80-6413-11e9-9748-17afb001cb69.gif>
why do you think this happens? and share me a way to contact you
personally other than this issue. im also from your state.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5545 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHKPEE3CEOXAOP5OYC7NWTDPRPNFXANCNFSM4HCGMKCA>
.
|
the console log with setoption4 @thirug010 from web gui
from mqtt
|
Did you get any further with a working Tuya touch switch in Tasmota? I have a different 4 gang touch switch (non-dimmer) but the serial codes you provided are identical. |
@MikeSaint Take a look at https://blakadder.github.io/templates/oil_diffuser_550ml.html for an example on how to get some control of the switches |
@MikeSaint no. There is no further development in the matter. Still hoping for further development in the tuya driver. |
Hi All, Me and @Rambylon is working in the separate thread to resolve the issue with Custom Tuya based devices (1 dimmer + 1 relay aka Fan Light switch , 4 Relay Tuya serial switch .. ). Thanks |
That's great news @thirug010 If you want me to do any testing on the Tuya touch switches (3 & 4 gang) I have, please let me know. |
@MaliMrav Great information on the power usage and the diagram on "Cooperative Processing by the MCU and Wi-Fi Module". I have flashed 3 devices to the dev branch Tasmota and it's working fine as a serial switch (apart from SetOption38 to 4 makes them reboot but not retain the setting). But that's not the end of the world. Recovering from a failed install / bad setting / user error is my problem of the week. Mine are all TYWE3S based Tuya 3 and 4 gang serial switches. Has anyone worked out how to USB flash one of these serial 4 gang switches if the OTA flash fails and it goes into a mode where it doesn't connect to WiFi or create it's own SSID for management (aka sort of bricked)? 3 devices worked fine and are fully functional. I've got one that was running Tasmota basic and flashed to the new Dev branch of full Tasmota but failed once it was set to be a Tuya Dimmer and rebooted. The other failed because I stupidly put some version of ESPEasy firmware on it that didn't have OTA upgrade capability or my WiFi settings (my bad). Being serial, the buttons don't respond as GPIO-0 would on a Sonoff device. I've tried loads of combinations that would work 100% on a Sonoff device using ESPEasy on a USB to TTL serial stick, but these serial switches don't seem to behave in the same way where we'd simply ground GPIO-0 to put it into flash mode. Grounding GPIO-0 on these units during startup doesn't seem to do anything at boot. I'm pretty sure that is my issue. Has anyone worked out how to flash one of these? Could you please share the process and exactly which TYWE3S pins were used? |
Yes, I've worked it out The reason why it fails with usb is because the MCU sends data every 5 seconds on the same line as your USB serial (RXD0). So to successfully update your firrmware via USB you need to cut the RXD0 track, write your firmware and then re-solder the track back on. As far as connections are concerned, it is pretty simple: USB MCU Then you need to have a push-button (momentary) switch with one side to GND and the other side to GPIO0. the sequence:
Every time you need to program it you need to follow the sequence. |
Hi Thiru, Hi Thiru, Ok attached is a capture of the serial port (capture.txt) and the same capture just formated for better reading (capture-new.txt so the format seems to be 55AA 01 07 0005 01 01 0001 01 10 <--- Switch # 01 and is ON 55AA 01 07 0008 07 02 0004 000000001C <--- No clue 55AA 01 07 0008 65 02 0004 000000007A <--- No clue 66 and 67 have some value only when some switches are on (so they must be the current. 68 has always got a value so I assume that is the voltage (~240 Volts in Australia) the 0004 refers to there being the function length as per below diagram |
In the dev branch the SetOption63 --> 0 and SetOption38 --> 4 doesn't seem to work. Do I now need to hard-code the switch count? |
SetOption38 is wrong and is deleted on latest dev branch. Use SetOption41 instead as documented here #6039 |
@arendst is this functionality no longer supported then?
|
@mike, it is still supported as documented. The problem was both IRReceive and Tuya used the same storage location. That has been changed now as IRReceive continues to use SetOption38 and Tuya uses SetOption41. |
OK. So you were referring to the improper use of SetOption38 in the Tuya PR. SetOption38 as documented for IR remains. Check. All's well. |
Hi Thiru, So the switches can be found at http://www.szmakegood.com/ |
ok so the switch count is fixed; Great! What about removing the dimmer slider, SetOption63 --> 0 ? Further more, I still have the status lines interpreted as dimmer settings. My workaround is pretty much a hack to disable the reading of what the function incorrectly assumes it to be a dim value else if (tuya_buffer[5] == 08 { // dim packet <--- this is a wrong assumption because there are other use cases where the 6th byte is 08, not just dimmer values. so I've just disabled it by looking for a different value, for now: Regards, |
I need some help. I connected the serial at 9600 baudrate. I am getting U▒U▒U▒U▒U▒sOGcriojabRHDvFH1.0.0▒U▒U▒U▒U... what is the correct baud rate for TYEW3S ? |
How do youupload the ZIP file OTA using the Tasmota WebGUI? |
@christianzappa, thanks |
Thanks @thirug010 |
@christianzappa , Please share screenshot of the Tasmota web ui, thanks |
@thirug010 sure. I've just got a WiFi issue atm. After resetting Tasmota and inputting my SSID and Pass, the unit isn't connecting to my wifi or generating an access point. |
On my units I had to fully power them off for the WiFi to connect once the SSID and password were set. Not just reboot, remove power completely.
SetOption38 is incorrectly specified in earlier posts in this thread to set the number of switches. It should be SetOption41.
On my units running the latest production release of Tasmota it doesn’t change the number of switches but I don’t care as it works fine and I just ignore switches 5 & 6.
|
@MikeSaint - |
This post was old it had the old setoptions correct option is updated it is SetOption41 is the correct option Please use the latest dev branch code to avoid the 6 switch issue Thanks |
Tried all the reset button tricks, and completely removed it, not just switching the lighting circuit off at the breaker, same problem, not generating an AP or connecting to the one I programmed. The Wi-Fi LED just blinks away with no result... |
You can actually do it with Tuya-convert. The only
|
I flashed the Sonoff.bin - set the Tuya MCU device - however I get a endless loop in the console. Seems to be a restart of MCU detected - but why? 12:35:58 TYA: Heartbeat |
It is detected cause the mcu is sending the restart code. Why the MCU is actually restarting has nothing to do with Tasmota. Its most likely a power issue or hardware issue |
Got the problem: I powered the device panel (4 Gang Switch) with a 3.3V source - without attaching it to the body case board. When switch panel is attached to body board it and powered with 220V it works fine... |
I have Tuya Fan switch currently using version 6.7.2 currently, the Light switch trigger Power3 (on mqtt), while both Light and FAN led are switched on when turning it back on. |
@Rambylon I also have the same device, I want to identify which secondary MCU is in use, but the MCU on mine is blank and have no numbers on it. I see in your photo that it shows some numbers, but it is not clear enough to read, would you mind posting the number written on yours? |
Somebody please help m,e |
Please, address this to the Tasmota Support Chat. The chat is a better and more dynamic channel for helping you. Github issues are meant for Tasmota Software Bug Reporting. Please check the Contributing Guideline and Policy and the Support Guide. Thanks. Support InformationSee Wiki for more information. |
Hi Christian Do you have the correct SetOptions for a single gang dimmer version please? |
Have you look for this feature in other issues and in the wiki?
Yes, i did look in the other issues and in wiki but i didn't find solution as this device was not using GPIO pins for control. It uses Serial Data for controling through RX and TX ports. The "Tuya Dimmer" module works for only one channel control from Tasmota(the first one) but it receives state change from the device for all channels, though it shows only one channel in Tasmota ( CH1 on/off in device-> turns on/off in tasmota, CH4-> on/off in device-> turns on/off in Tasmota, and respectively for all the 4 channels).
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
The problem is that this device (Wallpad 4CH Touch Wifi Switch) is Tuya based and it uses Serial data for communicating with a secondary MCU for switching the relays, rather than using on-board GPIO pins for relay control. So the Module configuration in Tasmota was useless as they can only configure the GPIO pins for I/O. It can be controlled via the console and MQTT using the serial codes but it can not transmit the state changes in MQTT.And can not be controlled from the Tasmota GUI.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I have identified the Serial codes used to communicate with the secondary MCU for relay control (both command codes and response codes). I can successfully use the serial codes for testing the relay controls in the Tasmota Console. The solution that i wish is the implementation of these codes to create a new template (or module) in Tasmota for this device. So that the device can get controlled from the Tasmota GUI and MQTT.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
If the above mentioned idea is not possible, then i wish a method for transmitting the state data of the device through MQTT. As the switches are not configured, getting the state data from the device through MQTT is not possible.
Additional context
Add any other context or screenshots about the feature request here.
The link to the product in Aliexpress is https://www.aliexpress.com/item/New-Arrival-4-Gang-Wifi-Switch-Wallpad-White-Tempered-Glass-UK-EU-Standard-4-Gang-Wifi/32892658176.html
The Serial Codes for this device
tuya_4gang_wallpad_uk.xlsx
(Please, remember to close the issue when the problem has been addressed)
The text was updated successfully, but these errors were encountered: