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.2k stars 4.81k forks source link

Support for Wi-Fi Dimmer? #5737

Closed jsponz closed 5 years ago

jsponz commented 5 years ago

Is this Wi-Fi Dimmer supported?

https://www.aliexpress.com/item/Wifi-Smart-Dimmer-220V-240V-150W-Controller-Timer-Switch-light-Voice-Control-Works-With-Amazon-Alexa/32962631174.html?spm=a2g0s.9042311.0.0.27424c4dZ69TdG

I have used tuya-convert to flash Tasmota, and it works. I have it with Tasmota.

I can't find any Info about this device. I have tried Tuya Dimmer but no success (no switching, no dimming control from the Tasmota interface).

Thanks!

Jason2866 commented 5 years ago

No. Please read and this CONTRIBUTING

ascillato2 commented 5 years ago

Closing this issue as it has been answered.


Support Information (Guide)

See Wiki for more information. See Chat for more user experience. See Community for forum. See Code of Conduct

dr-apple commented 5 years ago

Hello i have have the same device, i flash tasmota 6.5, but what is the pin occupancy for the serial connection and switch ? Have any a idea ?

keesschollaart81 commented 5 years ago

I also recently bought this device and I'm very intersted in Tasmota support. It's the cheapest wifi AC dimmer out there (~15$ price point), very interesting!

jsponz commented 5 years ago

@dr-apple I have tried all the possible options with no success.

I guess there is also anything related to serial communication and/or chip identification.

@keesschollaart81 I am with you. It works ok. Robust and cheap.

Any help is welcome!

dr-apple commented 5 years ago

@jsponz thank you for the info, i have testet all options for the button but zero :-(

I've been looking for hours in the network for schematics, pin assignments, but I can not find anything about the thing or the structure ....

https://docs.tuya.com/en/hardware/WiFi-module/wifi-e1s-module.html

meingraham commented 5 years ago

You guys may be stuck between a rock and a hard place.

First let me ask if you have tried different Tuya Dimmer IDs (SetOption34)?

It is likely that the dimming function is not handled by the ESP chip itself. The dimming function is probably handled by a separate MCU. The dimming actions to perform are usually communicated via codes sent from the ESP chip to the MCU via the serial communications interface. The dimming codes vary from device to device, even revision to revision.

In order for Tasmota to work if installed on the dimmer, Tasmota needs to send the right codes when an action request is made to it and also receive codes to confirm the action completed or to know what the device is up to when a change is made physically at the device (i.e., a human made the change). If you know the codes, then these can be programmed into Tasmota rules or customized into the code itself and compiled into the firmware.

But first you have to know the codes. And for that you would have had to reverse engineer the original firmware. Of course, if you provision the device on the Smart Life app in order to see it operate, Smart Life may update the firmware and thus blocking the ability to use Tuya-Convert. And thus the rock and a hard place :grimacing:

If you backed up the original firmware, you may be able to flash it back onto your device to attempt the reverse engineering process. @digiblur went through that is some of his videos.

Regards.

Mike

keesschollaart81 commented 5 years ago

Impressive work from @digiblur 💯, super cool to see these videos.

Some pictures from inside of the device: https://ibb.co/pPhL3cL https://ibb.co/7Ysv6gR https://ibb.co/3pmzzVh https://ibb.co/s2Gg5S3 https://ibb.co/jLbc7Yg

Tuya Convert log

Original firmware binary

After flashing Tasmota is was able to configure it via the web interface and I tried some different combinations but without success. Module set to 'Tuya Dimmer (54)'. After trying some different RX/TX configuration and some random guesses for the SetOption34 I was not able to see any RX messages in the console (with web log level 4). Also no incoming data when manually switching the device.

What would be a next thing to try/work out? I don't think I'm able to solder/connect to the serial port myself (too small & no experience).

jsponz commented 5 years ago

@keesschollaart81 Thanks for your analysis. I spent some time as well. One of my devices is broken: it does not boot.

The other one is flashed with Tasmota, but nothing happens. Same result as you have.

dr-apple commented 5 years ago

if I could find out the pin assignment, then I would try to read the protocol and recreate .... I have to lie on the couch for 2 weeks, have time ;-)

keesschollaart81 commented 5 years ago

Maybe @jsponz can disassemble his broken device and expose the chip so that we can see which Tuya device it compares with / which pins we have?

digiblur commented 5 years ago

Which pins did you try for TX/RX?

jsponz commented 5 years ago

@keesschollaart81 Of course!

It is already disassembled :-)

Tomorrow I will send you pictures.

keesschollaart81 commented 5 years ago

@digiblur same as described here

I also tried to point the Tuya Tx107 and Rx108 to the GPIO1 and 3. Also swapped 107 and 108 in both configs. Every test I tried to toggle the input switch but the logging is always the same

By the way, the bulb seems to be on the lowest brightness after power on. The input switch does not turn on/off the light.

jsponz commented 5 years ago

@keesschollaart81 the same happens here with the original firmware. I have reported it and they have told me that it is a production issue. A new device is on the way with this fix. I will confirm as soon as I have it...

However, after flashing one unit with Tasmota (as it is right now without support for this device), I see that the light is always off, so I guess it is firmware related.

keesschollaart81 commented 5 years ago

After I set TuyaRx18 to GPIO16 it does not boot any more... :-/

dr-apple commented 5 years ago

You must reset the esp with 3 x ac power on / off with 2 sec sleep, after that, the esp has delete the config make a hotspot....

jsponz commented 5 years ago

@dr-apple, @keesschollaart81 the same happened here and esp did not boot up anymore.

I will try later, when taking pictures.

Jason2866 commented 5 years ago

Not all GPIOs can be used for all. See https://github.com/arendst/Sonoff-Tasmota/wiki/Expanding-Sonoffs#restrictions

keesschollaart81 commented 5 years ago

@jsponz any update?

jsponz commented 5 years ago

@keesschollaart81 Sorry, I have a personal issue. Tomorrow I will take the pictures.

jsponz commented 5 years ago

As promises, please find attached the pictures.

IMG_20190515_073344 IMG_20190515_073437 IMG_20190515_073406 IMG_20190515_073457 IMG_20190515_073841 IMG_20190515_073418

Jason2866 commented 5 years ago

It seems there is a sort of ESP module hooked on a PCB with a MCU. The type of the MCU cant be identified on the photos. Next step is to identify type of MCU and someone hast to hook up a logic analyzer and sniff commands that needs to be sended and are received from the ESP to activate on off and dimming. If this is done and providing this detailed information someone can implement this type of dimmer in Tasmota. Tbh i dont believe this will happen because there are already supported easy to buy dimmers available.

CJS0815 commented 5 years ago

@Jason2866 Please, can you say me what Types/Models of dimmers for in-wall? (only box without switch or push-button) is supported by tasmota? 5 Days ago I've buyed 4pc of the parts above - shit happens

sorry for my english :-(

dr-apple commented 5 years ago

The Model is : QS-WIFI-D01-TRAIC

CJS0815 commented 5 years ago

You mean TRIAC?

Not available in Europe :-( Not on aliexpress

Do you have a dealer for me?

dr-apple commented 5 years ago

? show the first post here, it from ali and came frome china ?

CJS0815 commented 5 years ago

??? I dont understand !?!

The part from the first post was actual not supported - or did I read complete wrong? I asked for a supported module like this from the first post, but even supported ...

Jason2866 commented 5 years ago

There is none.

dr-apple commented 5 years ago

yes but you have asked : Not available in Europe :-( Not on aliexpress

Do you have a dealer for me?

and i have mean, you mean this this device ;-)

CJS0815 commented 5 years ago

No , sorry (I tell you, my english is ....)

What type or models do you mean with "because there are already supported easy to buy dimmers available"?

dr-apple commented 5 years ago

@CJS0815 from you: sorry (I tell you, my english is ....)

my too ;-) sorry

CJS0815 commented 5 years ago

Is this Wi-Fi Dimmer supported? 20190517_132935 20190517_132748 20190517_132619 20190517_132411

The product was dealed with documentation in germany

Is thera a chance to get it together with Tasmota?

dr-apple commented 5 years ago

Here the new version V5: https://ex-store.de/2-Kanal-WiFi-WLan-Relay-V5-Blackline-fuer-Unterputzmontage

Is this tasmota ready ? YES https://github.com/arendst/Sonoff-Tasmota/wiki/EXS-Relay-V3.1-&-V5.1

jsponz commented 5 years ago

@keesschollaart81 Any update? :)

CJS0815 commented 5 years ago

@dr-apple

Sorry, its not a new version, that is another version - the V5 is only a Switch-Relay I speak from another product called V4 Dimmer-Modul The pictures I've send above are from this V4 dimmer-Modul

keesschollaart81 commented 5 years ago

To be clear @CJS0815 I believe @jsponz and I are talking about the device linked in the opening post with pictures here https://github.com/arendst/Sonoff-Tasmota/issues/5737#issuecomment-490588738 and here https://github.com/arendst/Sonoff-Tasmota/issues/5737#issuecomment-492511979. This: https://github.com/arendst/Sonoff-Tasmota/issues/5737#issuecomment-493426380 is a completely (non dimmer) different device, let's not mess up this thread :-) which is about a very cheap Tuya based 220V AC dimmer.

As said, my first one got bricked. I now have a new one but I have not yet flashed it and I'm not sure I will do that, as long as there is no additional progress.

Looking at the pictures of @jsponz the ESP chip looks quite different from the one @digiblur got to work in his video. I guess unless someone with more experience/tools spends time on it, we have to use it as it comes with Tuya's firmware...

jsponz commented 5 years ago

@keesschollaart81 thanks for your clear summary.

I had one issue with the first two units. When switching it off, there was a minimum level of light. That happened with the original firmware and hardware. They have kindly sent me two new units and they work as expected. When off, it is off :-)

It is worth to make it work with Tasmota. It is cheap, robust and good quality. It works with LED lamps, incandescents, etc. It shouldn't be so complex, considering that the main effort is made for the other modules.

Sorry but I can't do it. I don't have my debugging tools in my current location...

MortenVinding commented 5 years ago

As you might have seen in #5859 I'm also trying to make this dimmer work with Tasmota. Did try the Tuya convert road but did not manage to make it work. But glad you did, that probably means there is hope. I will try the convert later then on a fresh installed Ubuntu or something.

Anyway I took one for the team and took mine to pieces, also removing the RF shield. Did some measurements to find the pinout of this special module: IMG_1112

The MCU on the back is a STM8S003F3: https://www.st.com/resource/en/datasheet/stm8s003f3.pdf And TX and RX is connected to the ESP's TX and RX pins.

The same MCU seems to be used in dimmer they are talking about here:

469

But it's hard to tell if the firmware is the same.

Hope this is of help for some...

dr-apple commented 5 years ago

Thank you for your class support! Would not it be possible to connect to TX / RX in parallel and to record the commands sent by the ESP with original firmware to MCP?

I would test it myself, but unfortunately I already have tasmota on it :-(

Sorry for my very bad English :-(

MortenVinding commented 5 years ago

Sorry just realized that my link to #469 did not work. It’s fixed now. Have you tried to configure your like in that issue?

I can try to analyze the traffic on the RX and TX pins, if my module survived the dismantling yesterday (did require quite a bit of heat!) And my logic analyzer and me is still getting to know each other, so might not succeed.

dr-apple commented 5 years ago

I once connected a USB 2 serial adapter, as described in the picture. But unfortunately nothing comes :-( Have Tasmota still on it, there should be so by 3.3V, GND, U0RXD and U0TXD serial output at 115200?

Have already turned U0TXD and U0RXD, unfortunately, no success :-(

The ESP goes and I get on it by WLAN ;-)

MortenVinding commented 5 years ago

Have Tasmota still on it, there should be so by 3.3V, GND, U0RXD and U0TXD serial output at 115200?

From the other issue it seems it's using 9600 baud. #469

Have you tried the firmware mentioned here: #469

Unfortunately it seems that it is still not ready for daily use, but it should provide basic functionality.

MortenVinding commented 5 years ago

Just realised it's basically the same ESP module used here: Link

thxthx0 commented 5 years ago

or this: image

edit some pics for the template repo: Wi-Fi-Dimmer

dimmer-template

dimmer-flash-lingan

dimmer-wiring-diagram

dimmer-flash-1-LM1

dimmer-flash-2

dimmer-flash-3-mcu

dimmer-flash-4

dimmer-1

dimmer-2

dimmer-3

dimmer-4

dimmer-5

dimmer-6

DeanoXX commented 5 years ago

I have a couple of the same dimmer. I had an original from about feb - that flashed OK with Tuya-convert and I have had Tasmota and ESPHome on - havent yet got it all working..

I have 2 more recently arrived. They wont flash with Tuya-convert. I have one running the orig firmware and can see the serial commands being sent on the ESP TX pin.

When it boots it has some text including... "fireware info name:esp_QL_TD ,version:1.0.1 ,PRODECT_KEY:wnqaw70uBCsDqgZT"

When connected to the Smartlife app I can see the commands from the ESP to MCU. they dont appear to be std Tuya. At no point can I see anything come from the MCU in return....

These are typical bytes sent - each line is for a button press/slider move in the app FF 55 00 05 DC 0A
FF 55 71 05 DC 0A FF 55 FD 05 DC 0A FF 55 FC 05 DC 0A FF 55 FC 05 DC 0A FF 55 FE 05 DC 0A FF 55 FF 05 DC 0A FF 55 FF 05 DC 0A

The third byte is the dim level (00 = Off, FF = Full on, anywhere in between according to the dimmer slider)

But I cannot get the latest versions into a mode it will flash. Using the pinouts above and keeping GPIO 0 to ground doesnt seem to do anything different (it does work with the 1st Tuya converted module)

MortenVinding commented 5 years ago

or this:

image

Wow great find thxthx0! Wonder if this dimmer is actually made by "Lingan"? Seems they are making lots of wifi devices besides there ESP modules...

MortenVinding commented 5 years ago

I have a couple of the same dimmer. I had an original from about feb - that flashed OK with Tuya-convert and I have had Tasmota and ESPHome on - havent yet got it all working..I have 2 more recently arrived. They wont flash with Tuya-convert. I have one running the orig firmware and can see the serial commands being sent on the ESP TX pin.When it boots it has some text including..."fireware info name:esp_QL_TD ,version:1.0.1 ,PRODECT_KEY:wnqaw70uBCsDqgZT"

Nice info DeanoXX! That might explain why I failed with Tuya-convert on my dimmer.

I did however also fail to get any sensible info from serial logging also. That's very intereresting, how did you see that? What baud rate does it use? (and bits, stop bits etc). Was the module connected to the dimmer when you logged it? (mine wasn't).

Still hase wires connected to my module, so will try to dump the firmware from that.

Wish Shelly would make a dimmer so we didn't have to mess with this...

jsponz commented 5 years ago

@DeanoXX, Great news!!

The same happened to me. On the first two units, I could use tuya-convert. On the second two units (the first ones were faulty and I could not switch off the light), I could not. In the next days I will take a look on this.

With your info, code could be updated... 👍

DeanoXX commented 5 years ago

Output is from the u0txd pin . 9600,n,8,1 Definitely works with the esp/mcu separated from the dimmer element. Pretty sure I have had it with them connected.

Pretty sure the switch input is GPIO13 but need to test more. I have one untouched. May see if that will flash via serial out of the box. If these would flash easily they would be a very good match for what I want.

Unfortunately I’m away for the next couple of days..so will be a while before I can get further.