Skip to content
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

Closed
Rambylon opened this issue Mar 29, 2019 · 64 comments
Labels
enhancement Type - Enhancement that will be worked on

Comments

@Rambylon
Copy link

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
IMG_20190328_073442
IMG_20190328_073504
IMG_20190328_082312
The Serial Codes for this device
tuya_4gang_wallpad_uk.xlsx

(Please, remember to close the issue when the problem has been addressed)

@Rambylon Rambylon changed the title Adding a new template for a new module Adding a new template/module for a new Wallpad 4CH Touch Switch (Tuya TYWE3S based device) Mar 29, 2019
@Jason2866
Copy link
Collaborator

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

@Rambylon
Copy link
Author

Rambylon commented Apr 5, 2019

@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.

@Jason2866
Copy link
Collaborator

You have to use module generic. I dont understand why serial communication doesnt work for you.
I use serial bridge function in module generic....

@Rambylon
Copy link
Author

Rambylon commented Apr 5, 2019

dont know. it only send and recieve serial data in "Tuya Dimmer" template.

@thirug010
Copy link
Contributor

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)"}.

20190406_080656
20190406_080648
20190406_080635
20190406_080630

@Rambylon
Copy link
Author

Rambylon commented Apr 7, 2019

where did you buy it? can you send the link?

@thirug010
Copy link
Contributor

https://www.alibaba.com/product-detail/SESOO-Smart-home-Amazon-alexa-compatible_60601674427.html?spm=a2700.7724838.2017115.1.7e6b1505r3ArLm

the same is available in the Aliexpress but i dont have the link, you can get it
from Alibaba chat

@Rambylon
Copy link
Author

Rambylon commented Apr 7, 2019

thank you. how is the touch response in the switch? does it respond immediately or it takes a slight delay to react?

@thirug010
Copy link
Contributor

thirug010 commented Apr 7, 2019

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.

@Rambylon
Copy link
Author

Rambylon commented Apr 7, 2019

good work

@blakadder
Copy link
Collaborator

I think this thread has reached a conclusion and therefore its being closed

Repository owner deleted a comment from Rambylon Apr 9, 2019
@thirug010
Copy link
Contributor

thirug010 commented Apr 10, 2019 via email

@Rambylon
Copy link
Author

Rambylon commented Apr 19, 2019

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.

@thirug010
Copy link
Contributor

thirug010 commented Apr 20, 2019 via email

@Rambylon
Copy link
Author

thank you @thirug010 are you tamil?

@thirug010
Copy link
Contributor

thirug010 commented Apr 20, 2019 via email

@thirug010
Copy link
Contributor

Hi @Rambylon,

I have updated the 6.5.0 code to support 4 gang Switch. I tested with Wemo + serial Terminal for the communication,

  1. Tasmota Web UI ON /OFF send the Serial to the Terminal ( tested for all switches )
    2.. MQTT power command trigger the Serial to the Terminal
  2. Serial Data from your Excel switch ON /OFF the Tasmota / MQTT.

update the sonoff.ino and xdrv_16_tuyadimmer.ino from the .zip folder and compile and update the firmware.

image

Thanks
Thiru

sonoff.zip

@Rambylon
Copy link
Author

Rambylon commented Apr 21, 2019

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
tuya problem 6

the console shows

04:33:51 SRC: MQTT
04:33:51 RSL: Received Topic cmnd/tuya/POWER4, Data Size 3, Data OFF
04:33:51 RSL: Group 0, Index 4, Command POWER, Data OFF
04:33:51 TYA: TX Packet: "55aa00060005040100010111"
04:33:51 MQT: stat/tuya/RESULT = {"POWER4":"OFF"}
04:33:51 MQT: stat/tuya/POWER4 = OFF
04:33:51 TYA: RX Packet: "55aa00070005040100010112"
04:33:51 TYA: RX Device -4 --> On State
04:33:51 SRC: Switch
04:33:51 MQT: stat/tuya/RESULT = {"POWER4":"ON"}
04:33:51 MQT: stat/tuya/POWER4 = ON
04:33:54 SRC: MQTT
04:33:54 RSL: Received Topic cmnd/tuya/POWER3, Data Size 3, Data OFF
04:33:54 RSL: Group 0, Index 3, Command POWER, Data OFF
04:33:54 TYA: TX Packet: "55aa00060005030100010110"
04:33:54 MQT: stat/tuya/RESULT = {"POWER3":"OFF"}
04:33:54 MQT: stat/tuya/POWER3 = OFF
04:33:54 TYA: RX Packet: "55aa00070005030100010111"
04:33:54 TYA: RX Device -3 --> On State
04:33:54 SRC: Switch
04:33:54 MQT: stat/tuya/RESULT = {"POWER3":"ON"}
04:33:54 MQT: stat/tuya/POWER3 = ON

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.

@thirug010
Copy link
Contributor

thirug010 commented Apr 21, 2019 via email

@Rambylon
Copy link
Author

the console log with setoption4 @thirug010

from web gui

09:26:59 SRC: WebGui from 192.168.0.131
09:26:59 TYA: Send Dim Level skipped due to 0 or already set. Value=0
09:26:59 TYA: TX Packet: "55aa0006000501010001010e"
09:27:00 MQT: stat/tuya/POWER1 = {"POWER1":"OFF"}
09:27:00 MQT: stat/tuya/POWER1 = OFF
09:27:00 TYA: RX Packet: "55aa0007000501010001010f"
09:27:00 TYA: RX Device -1 --> On State
09:27:00 SRC: Switch
09:27:00 TYA: Send Serial Packet Dim Value=25 (id=1)
09:27:00 TYA: TX Packet: "55aa0006000801020004000000192d"
09:27:00 MQT: stat/tuya/POWER1 = {"POWER1":"ON"}
09:27:00 MQT: stat/tuya/POWER1 = ON
09:27:00 SRC: WebGui from 192.168.0.131
09:27:00 TYA: TX Packet: "55aa0006000502010001010f"
09:27:00 MQT: stat/tuya/POWER2 = {"POWER2":"OFF"}
09:27:00 MQT: stat/tuya/POWER2 = OFF
09:27:01 TYA: RX Packet: "55aa00070005020100010110"
09:27:01 TYA: RX Device -2 --> On State
09:27:01 SRC: Switch
09:27:01 MQT: stat/tuya/POWER2 = {"POWER2":"ON"}
09:27:01 MQT: stat/tuya/POWER2 = ON

from mqtt

09:28:05 SRC: MQTT
09:28:05 RSL: Received Topic cmnd/tuya/POWER3, Data Size 3, Data OFF
09:28:05 RSL: Group 0, Index 3, Command POWER, Data OFF
09:28:05 TYA: TX Packet: "55aa00060005030100010110"
09:28:05 MQT: stat/tuya/POWER3 = {"POWER3":"OFF"}
09:28:05 MQT: stat/tuya/POWER3 = OFF
09:28:05 TYA: RX Packet: "55aa00070005030100010111"
09:28:05 TYA: RX Device -3 --> On State
09:28:05 SRC: Switch
09:28:05 MQT: stat/tuya/POWER3 = {"POWER3":"ON"}
09:28:05 MQT: stat/tuya/POWER3 = ON
09:28:05 SRC: MQTT
09:28:05 RSL: Received Topic cmnd/tuya/POWER4, Data Size 3, Data OFF
09:28:05 RSL: Group 0, Index 4, Command POWER, Data OFF
09:28:05 TYA: TX Packet: "55aa00060005040100010111"
09:28:05 MQT: stat/tuya/POWER4 = {"POWER4":"OFF"}
09:28:05 MQT: stat/tuya/POWER4 = OFF
09:28:05 TYA: RX Packet: "55aa00070005040100010112"
09:28:05 TYA: RX Device -4 --> On State
09:28:05 SRC: Switch
09:28:05 MQT: stat/tuya/POWER4 = {"POWER4":"ON"}
09:28:05 MQT: stat/tuya/POWER4 = ON
09:28:06 MQT: tele/tuya/STATE = {"Time":"2019-04-21T09:28:06","Uptime":"0T01:23:52","Vcc":3.186,"SleepMode":"Dynamic","Sleep":0,"LoadAvg":999,"POWER1":"ON","Dimmer":1,"Fade":"OFF","Speed":1,"LedTable":"OFF","POWER2":"ON","POWER3":"ON","POWER4":"ON","Wifi":{"AP":1,"SSId":"Beacon 2.4G","BSSId":"D8:0D:17:6B:5F:7A","Channel":6,"RSSI":52,"LinkCount":1,"Downtime":"0T00:00:07"}}

@MikeSaint
Copy link

@Rambylon

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.

@blakadder
Copy link
Collaborator

@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

@Rambylon
Copy link
Author

@MikeSaint no. There is no further development in the matter. Still hoping for further development in the tuya driver.

@thirug010
Copy link
Contributor

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 .. ).
We will keep you posted once all the issues are resolved

Thanks
Thiru

@MikeSaint
Copy link

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.

@MikeSaint
Copy link

@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?

image

@MaliMrav
Copy link

MaliMrav commented Jul 8, 2019

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
+3V ---> +3V
GND ---> GND
TX ---> RXD0
RX ---> TXD0

Then you need to have a push-button (momentary) switch with one side to GND and the other side to GPIO0.

the sequence:

  1. wire up the USB Serial interface with your MCU. Note don't plug in the USB cable into your PC yet

  2. press and hold the programming switch and while holding the switch, place the USB cable into your PC.

  3. you can let go of the switch now, your MCU is now ready to be programmed.

  4. Once programmed you just power-cycle the MCU.

Every time you need to program it you need to follow the sequence.
Note: the reason you need to power-cycle it is because this is the cheapest method without needing to wire a reset switch.

@MaliMrav
Copy link

MaliMrav commented Jul 8, 2019

@MaliMrav, Thanks for your finding, I will use the serial data to update the code, Please share the details about the switch, I would try get and try it myself

thanks
thiru

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
capture.txt
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 0005 02 01 0001 01 11 <--- Switch # 02 and is ON
55AA 01 07 0005 03 01 0001 00 12 <--- Switch # 03 and is OFF
55AA 01 07 0005 04 01 0001 01 13 <--- Switch # 04 and is ON

55AA 01 07 0008 07 02 0004 000000001C <--- No clue
55AA 01 07 0008 08 02 0004 000000001D <--- No clue
55AA 01 07 0008 09 02 0004 000000001E <--- No clue
55AA 01 07 0008 0A 02 0004 000000001F <--- No clue

55AA 01 07 0008 65 02 0004 000000007A <--- No clue
55AA 01 07 0008 66 02 0004 000000F26D <--- I think this is the current
55AA 01 07 0008 67 02 0004 00000244C2 <--- I think this is the power or something (although P = V x I)
55AA 01 07 0008 68 02 0004 0000095BE1 <--- I think this is the voltage

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

image

@MaliMrav
Copy link

MaliMrav commented Jul 8, 2019

@MaliMrav , Random switching due to the unknown packets on the non-dimmer device was fixed already in the dev branch, Please take the latest dev branch code.

In the dev branch the SetOption63 --> 0 and SetOption38 --> 4 doesn't seem to work.
So the options to set the switches and remove the dim is only in the tuya-new, right?

Do I now need to hard-code the switch count?

@arendst
Copy link
Owner

arendst commented Jul 8, 2019

SetOption38 is wrong and is deleted on latest dev branch. Use SetOption41 instead as documented here #6039

@meingraham
Copy link
Collaborator

@arendst is this functionality no longer supported then?

set IRReceive protocol detection sensitivity minimizing UNKNOWN protocols

@arendst
Copy link
Owner

arendst commented Jul 8, 2019

@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.

@meingraham
Copy link
Collaborator

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.

@MaliMrav
Copy link

@MaliMrav, Thanks for your finding, I will use the serial data to update the code, Please share the details about the switch, I would try get and try it myself

thanks
thiru

Hi Thiru,

So the switches can be found at http://www.szmakegood.com/

the pics of the front and back of the 3 and 4 Gang Switches
3ch - back
4ch - back
3ch - front
4ch - front

@MaliMrav
Copy link

SetOption38 is wrong and is deleted on latest dev branch. Use SetOption41 instead as documented here #6039

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.
in my case there are 8 lines that are status values: (Voltage, power, and some I have not worked out yet.)
(see my previous post for more details.

so I've just disabled it by looking for a different value, for now:
else if (tuya_buffer[5] == 0) { //from 8 to 0

Regards,
MaliMrav

@tyjtyj
Copy link

tyjtyj commented Jul 21, 2019

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 ?

@christianzappa
Copy link

I have updated the tasmota to support the custom tuya devices, It can be flashed with USB or OTA with minimal firmware But not with Tuya-Convert directly ( it is 516kb bin file)

You can the following options to update the code
1 . Use the attached (.zip) files and update your Sonoff-Tasmota-6.5.0 Branch
2 . Use cloned the version of the Sonoff-Tasmota-6.5.0 here
Important this code is not tested on all tuya devices, update it on your own risk, make sure compare the serial data, if you need help please reach out to me

Summary of Changes:

./sonoff
settings.h sonoff.ino xdrv_01_webserver.ino xdrv_16_tuyadimmer.ino
./tools
decode-config.py

This code will support up-to 8 Tuya devices as per the TUYA-MCU Protocols. it can be all 8 Relays or 1 dimmer + 6 relays but only one Dimmer can be used at a time.

  • To Enable or Disable Dimmer control use SetOption63 --> 1-Enable 0-Disable
  • To Set No of devices / Relays / Dimmer use SetOption38 (Note: require re-boot to apply the change)
    Example 4 Gang SetOption38 - 4

Here is sample devices and SetOptions .

Steps use Tuya Dimmer as Switch (4Gang) .. Thanks to @Rambylon for Testing and Support

  1. Make sure the Serial Data is matching with your device tuya_4gang_wallpad_uk.xlsx
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 0 --> will disable the dimmer slider control
  5. SetOption38 as 4
  6. Select Module as Tuya dimmer
    image

Steps use Tuya Dimmer as Fan Dimmer and Light Switch (1 Dimmer, 1 Relay)

  1. Make sure the Serial Data is matching with your device
    Fan Dimmer Data.zip
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 1 --> will enable the dimmer slider control
  5. SetOption38 as 3 --> 1-SSR, 2-Dimmer, 3-Relay
  6. SetOption34 as 2 --> (Optional it will be set based on the feedback from MCU on the 1st dim packet)
  7. Select Module as Tuya dimmer

Notes:

  • Use Power 1 and Dimmer Control to turn ON/OFF and set the Dimmer Value
  • Use Power 3 for the control Light Switch (relay)
  • Power 2 is just dimmer control Just sent the dimmer packets. toggle buttn does not work
    image

Steps use Tuya Dimmer as Switch (3Gang) Not Tested

  1. Make sure the Serial Data ( first 3 switch) is matching with your device [tuya_4gang_wallpad_uk.xlsx] (https://github.com/arendst/Sonoff-Tasmota/files/3192203/tuya_4gang_wallpad_uk.xlsx)
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 0 --> will disable the dimmer slider control
  5. SetOption38 as 3
  6. Select Module as Tuya dimmer

Tuya-Updates.zip
Cloned Repo: https://github.com/thirug010/Sonoff-Tasmota-6.5.0-New-Tuya-Devices

How do youupload the ZIP file OTA using the Tasmota WebGUI?

@thirug010
Copy link
Contributor

@christianzappa,
Please upgrade to latest firmware it has the changes now

thanks
Thiru

@christianzappa
Copy link

@christianzappa,
Please upgrade to latest firmware it has the changes now

thanks
Thiru

Thanks @thirug010
OK, half working, what setoptions do I need to configure, also should I use Tuya dimmer for the module and template? 2 and 3 gang switch here

@thirug010
Copy link
Contributor

@christianzappa , Please share screenshot of the Tasmota web ui,

thanks
thiru

@christianzappa
Copy link

@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.

@MikeSaint
Copy link

MikeSaint commented Aug 8, 2019 via email

@meingraham
Copy link
Collaborator

@MikeSaint - SetOption38? That's an IR related option.

@thirug010
Copy link
Contributor

@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
Thiru

@christianzappa
Copy link

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...

@MaliMrav
Copy link

MaliMrav commented Aug 9, 2019

I have updated the tasmota to support the custom tuya devices, It can be flashed with USB or OTA with minimal firmware But not with Tuya-Convert directly ( it is 516kb bin file)

You can actually do it with Tuya-convert. The only
Thing is it’s a three stage process:

  1. do the tuya-convert
  2. load (via Web GUI) the minimal version of Tasmota
  3. load this firmware

@Tobias007
Copy link

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
12:36:04 WIF: Checking connection...
12:36:04 WIF: Connected
12:36:09 TYA: Send "55aa00000000ff"
12:36:09 RSL: tele/sonoff/RESULT = {"TuyaMcuReceived":"55AA000000010000"}
12:36:09 TYA: Heartbeat
12:36:09 TYA: Detected MCU restart
12:36:10 TYA: Set WiFi LED 3 (0)
12:36:10 TYA: Send "55aa000300010306"
12:36:10 RSL: tele/sonoff/RESULT = {"TuyaMcuReceived":"55AA0003000002"}
12:36:10 TYA: RX WiFi LED set ACK
12:36:20 TYA: Send "55aa00000000ff"
12:36:20 RSL: tele/sonoff/RESULT = {"TuyaMcuReceived":"55AA000000010000"}
12:36:20 TYA: Heartbeat
12:36:20 TYA: Detected MCU restart
12:36:21 TYA: Set WiFi LED 3 (0)
12:36:21 TYA: Send "55aa000300010306"
12:36:21 RSL: tele/sonoff/RESULT = {"TuyaMcuReceived":"55AA0003000002"}
12:36:21 TYA: RX WiFi LED set ACK
12:36:24 WIF: Checking connection...
12:36:24 WIF: Connected
12:36:31 TYA: Send "55aa00000000ff"
12:36:31 RSL: tele/sonoff/RESULT = {"TuyaMcuReceived":"55AA000000010101"}
12:36:31 TYA: Heartbeat

@blakadder
Copy link
Collaborator

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

@Tobias007
Copy link

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...

@Levynger
Copy link

Levynger commented Nov 15, 2019

I have Tuya Fan switch currently using version 6.7.2
what should be the module configuration ?

image
Capture

currently, the Light switch trigger Power3 (on mqtt), while both Light and FAN led are switched on when turning it back on.
the FAN switch and dimmer switches - just sends serial data to tasmota.. not triggering any MQTT topics

@markus-li
Copy link

@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?
image

@ascillato
Copy link
Contributor

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 Information

See Wiki for more information.
See FAQ for common questions/answers and links if none of your question is in the list
See Chat for more user experience.
See Community for forum.
See Code of Conduct

@buzurk26
Copy link

I have updated the tasmota to support the custom tuya devices, It can be flashed with USB or OTA with minimal firmware But not with Tuya-Convert directly ( it is 516kb bin file)
You can the following options to update the code
1 . Use the attached (.zip) files and update your Sonoff-Tasmota-6.5.0 Branch
2 . Use cloned the version of the Sonoff-Tasmota-6.5.0 here
Important this code is not tested on all tuya devices, update it on your own risk, make sure compare the serial data, if you need help please reach out to me

Summary of Changes:

./sonoff
settings.h sonoff.ino xdrv_01_webserver.ino xdrv_16_tuyadimmer.ino
./tools
decode-config.py
This code will support up-to 8 Tuya devices as per the TUYA-MCU Protocols. it can be all 8 Relays or 1 dimmer + 6 relays but only one Dimmer can be used at a time.

  • To Enable or Disable Dimmer control use SetOption63 --> 1-Enable 0-Disable
  • To Set No of devices / Relays / Dimmer use SetOption38 (Note: require re-boot to apply the change)
    Example 4 Gang SetOption38 - 4

Here is sample devices and SetOptions .
Steps use Tuya Dimmer as Switch (4Gang) .. Thanks to @Rambylon for Testing and Support

  1. Make sure the Serial Data is matching with your device tuya_4gang_wallpad_uk.xlsx
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 0 --> will disable the dimmer slider control
  5. SetOption38 as 4
  6. Select Module as Tuya dimmer
    image

Steps use Tuya Dimmer as Fan Dimmer and Light Switch (1 Dimmer, 1 Relay)

  1. Make sure the Serial Data is matching with your device
    Fan Dimmer Data.zip
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 1 --> will enable the dimmer slider control
  5. SetOption38 as 3 --> 1-SSR, 2-Dimmer, 3-Relay
  6. SetOption34 as 2 --> (Optional it will be set based on the feedback from MCU on the 1st dim packet)
  7. Select Module as Tuya dimmer

Notes:

  • Use Power 1 and Dimmer Control to turn ON/OFF and set the Dimmer Value
  • Use Power 3 for the control Light Switch (relay)
  • Power 2 is just dimmer control Just sent the dimmer packets. toggle buttn does not work
    image

Steps use Tuya Dimmer as Switch (3Gang) Not Tested

  1. Make sure the Serial Data ( first 3 switch) is matching with your device [tuya_4gang_wallpad_uk.xlsx] (https://github.com/arendst/Sonoff-Tasmota/files/3192203/tuya_4gang_wallpad_uk.xlsx)
  2. Reset Current Configuration --> it will make the device as basic sonoff
  3. Update the new firmware
  4. SetOption63 as 0 --> will disable the dimmer slider control
  5. SetOption38 as 3
  6. Select Module as Tuya dimmer

Tuya-Updates.zip
Cloned Repo: https://github.com/thirug010/Sonoff-Tasmota-6.5.0-New-Tuya-Devices

How do youupload the ZIP file OTA using the Tasmota WebGUI?

Hi Christian

Do you have the correct SetOptions for a single gang dimmer version please?
https://www.alibaba.com/product-detail/SAA-Approval-AU-US-Standard-Wifi_62476608176.html?spm=a2700.icbuShop.41413.21.d60012d9mcebtg&fullFirstScreen=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

No branches or pull requests