arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.06k stars 4.78k forks source link

Adding a new template/module for a new Wallpad 4CH Touch Switch (Tuya TYWE3S based device) #5545

Closed Rambylon closed 5 years ago

Rambylon commented 5 years ago

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)

christianzappa commented 5 years ago

@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 commented 5 years ago

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.

meingraham commented 5 years ago

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

thirug010 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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

ashoktvm commented 4 years ago

Somebody please help m,e I have flashed tasmota into this device. But now I am unable to make it work even though the tasmota page https://www.aliexpress.com/item/32892761529.html?spm=a2g0o.productlist.0.0.5843a0acRZtCQk&algo_pvid=18f14273-d820-406b-bf1e-25021049a0e8&algo_expid=18f14273-d820-406b-bf1e-25021049a0e8-11&btsid=2e2f30d0-fd39-4c36-b252-a85a5359f850&ws_ab_test=searchweb0_0,searchweb201602_10,searchweb201603_53

ascillato commented 4 years ago

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 commented 4 years ago

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