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.21k 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!

thxthx0 commented 5 years ago

Hi, 👍

the dimmer is also listed @ amzon: 'TOOGOO Wifi Smart Dimmer Module 220V-240V 150W'

For flashing/reading ESP8266 maybe also set pin marked 'RE' (Reset?) to GND - to disable ST MCU while flashing (same as for tuya-touch-dimmer).

Jason2866 commented 5 years ago

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)

With (s)serialsend you can test the commands like done for this device

HA-TB303 commented 5 years ago

I have exactly the same dimmer and I was able successfully to flash tasmota 6.5 to it using tuya-convert. Unfortunately I did not know at the time this is a "special" dimmer module using a seperate dimming chip which does seem to be supported in tasmota, but requires different tx and rx gpio's.

Before I fount that out, I flashed esphome. played around with that, but found there is no support for this special tuya dimming chip in esphome and tried to go back to tasmota. Flashed the tasmota minimal and then soft-bricked it somehow.

I now have to reflash by wire, but I'm not 100% sure how to proceed. Anyone having any luck flashing tasmota by wire and willing to share the wiring?

DeanoXX commented 5 years ago

I have flashed 1 via Tuya-convert and subsequently via Serial using the pins from the Lingan data sheet above.

From the edges of the Chip... GPIO0 to GND to put it into flash mode UTXD = TX URXD = RX

Used the GND + VCC from the board itself as they're easier.

I desolder from the dimmer board first...

20190608_171752

Cannot get my later 2 to flash at all. Via Serial or Tuya-Convert. very frustrating.

HA-TB303 commented 5 years ago

Tried, but mine won't flash either :(

thxthx0 commented 5 years ago

Did you try to set marked pin 'RE' (Reset?) to GND too, as mentioned above?

DeanoXX commented 5 years ago

I have tried that yes with no success.

thxthx0 commented 5 years ago

Thanks for trying it out. So we'll have to find other connections between ESP8266 and STM8S003F3 MCU - maybe cut traces.

Slofware commented 5 years ago

So problems are not flashing the ESP, so you could use Arduino software. But the problem is how and what you send to the chip which controls the dimming?

james-fry commented 5 years ago

Just ordered one from CN. Happy to be involved in testing when it arrives in a couple of weeks.

xbmcnut commented 5 years ago

I too have a dimmer now if anyone wants to me try things. I also have the switch (QS-WIFI-S03) which I believe is supported.

davidelang commented 5 years ago

note, I don't have the time to work on this right now, but it sounds like what's needed is to hook up a second esp8266 up with it's rx pin on the tx and rx pins of the dimmer (one at a time obviously) and record what goes back and forth between the two chips, at startup, and as you manipulate the controls (stock firmware on the dimmer)

David Lang

xbmcnut commented 5 years ago

If someone can show me how that would be connected, I'd be up for giving that a go. I've got various Wemos and NodeMCU floating about.

james-fry commented 5 years ago

Is there a manual for these devices? (can anyone link pdf or scan it? I searched high and low but I cant find anything) I am interested whether it supports manual dimming control from the push switch. There are other "in wall behind switch" dimmers that support:

keesschollaart81 commented 5 years ago

@james-fry That depends on the implementation on the firmware I guess. The Tuya implementation does not do 'press and hold' at least. But with Tasmota this should be possible, I think?

IMG_20190613_123031 3 IMG_20190613_123023 3

james-fry commented 5 years ago

@james-fry That depends on the implementation on the firmware I guess. The Tuya implementation does not do 'press and hold' at least. But with Tasmota this should be possible, I think?

Thanks that was super quick! :)

Actually it looks like it does support from the manual.

image

MortenVinding commented 5 years ago

I am interested whether it supports manual dimming control from the push switch. There are other "in wall behind switch" dimmers that support:

  • click = toggle light
  • press and hold = adjust brightness, release to set

Thats how it works yes. Actually all dimmers I have seen works that way, so I would be very surprised/disappointed if it didn't.

Don't think it has any advanced features like double/triple click though...

MortenVinding commented 5 years ago

note, I don't have the time to work on this right now, but it sounds like what's needed is to hook up a second esp8266 up with it's rx pin on the tx and rx pins of the dimmer (one at a time obviously) and record what goes back and forth between the two chips

Thats already been done, read DeanoXX comment:

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

Btw: when I was poking around with my scope I noticed that one the the lines (can't remember if it was RX or TX) was very weak. It was not even able to drive the input of a FTDI chip or my logic analyser. Maybe it would be a good idea to add a current amplifier before the RX input of your serial port. Like a simple emitter follower Emitter-follower (the resister is probably not needed).

thxthx0 commented 5 years ago

Would be great if this thread could be reopened again because of the public interest 😄 and maybe support of the pros here 👍

This is a trailing edge phase dimmer (NON triac) with conventional pushbutton/switch control, wall installation and usable for most lights.

lowest price I found today €13,23 @Alixpress

james-fry commented 5 years ago

This is a trailing edge phase dimmer (NON triac) with conventional pushbutton/switch control, wall installation and usable for most lights.

AKA the holy grail :) As far as I am aware only zigbee and zwave solutions exist, and at 3+ times the price.

thxthx0 commented 5 years ago

Well now I'm not 100% sure, instruction manual says QS-WIFI-D01-TRIAC :(

I still haven't received my order, maybe somebody could be so kind to take a picture/ read marking of the black component in its TO-220 package.

edit: well, sure, it's definitely a Power MOS FET (and not TRIAC) :)

MortenVinding commented 5 years ago

Well now I'm not 100% sure, instruction manual says QS-WIFI-Do1-TRIAC :(

I still haven't received my order, maybe somebody could be so kind to take a picture/ read marking of the black component in its TO-220 package.

Well I have personally never thought about that. Has always assumed that any dimmer would use a Triac all though I have wondered how it would turn it off midway in a wave...

The front (and printing) of the triac/mosfet is not easy visible, but on I see what looks like two rectifier bridges, so by looking at this diagram: dim-f7 I assume it is intact a mosfet based dimmer.

I have tried it with LED bulbs, and it works so I guess it is a trailing edge dimmer.

Best picture I could get of the "TO220" component: IMG_1128 (technically not a TO220 I think, but never mind 😀) (the bridge rectifiers is the ones in front of it)

thxthx0 commented 5 years ago

That's great. Thank you @ MortenVinding

When I looked at the photos for the first time, I thought I could see bridge rectifiers with Power MOSFET in the background.

This actually seems to be MOSFET SVF12N60 or similar type SVF12N60F

Datasheet: http://www.silan.com.cn/english/product/apply/SVF12N60(F)(S)(K)%20Datasheet_2.20190103084411636821.pdf

Now we have all we wanted, just a little missing Tasmota integration 😄

thxthx0 commented 5 years ago

Got my WiFi Dimmer today and flashed it successfully with Tasmota, it's workin'...

I had to set pin RE (= STM8 MCU Pin4 NRST) to GND for backup and flash (and also GPIO0 to GND for flash mode) - didn't try Tuya-Convert.

As DeanoXX already found out, there seems to be only one simple command with dim level between 0 to 255 (00 = Off / FF = full on).

With Tasmota and SerialSend5 I can now adjust all brightness levels: off 0% -> SerialSend5 FF 55 00 05 DC 0A on 100% -> SerialSend5 FF 55 FF 05 DC 0A 0 - 100% -> SerialSend5 FF 55 xx 05 DC 0A

Push Button / Switch input 'S' is connected to GPIO13

Wifi-dimmer-generic

I can control the dimmer module well with virtual relays and rules,

but the manual push switch isn't working reliably yet, it doesn't always respond (?), and of course no 'Long Push' for dimming.

dr-apple commented 5 years ago

@thxthx0 10000x thanks for your work !!!!

@all very big thanks !!!!

jsponz commented 5 years ago

@thxthx0 Thanks!!!

Excellent.

james-fry commented 5 years ago

Great job. Thxthx @thxthx0 ;) Next I guess is more exploration on why the local control is shonky. Is long press dimming even a possibility with tasmota?

james-fry commented 5 years ago

Got my WiFi Dimmer today

Haha actually I found mine arrived today, too! Time to play!

jsponz commented 5 years ago

@thxthx0 If possible could you explain further the process? I am not familiar with SerialSend5...

Thanks!

thxthx0 commented 5 years ago

Hi, it's pretty simple:

... and so on.

BTW the 'switch issue' seems to be because ESP GPIO13 is also connected to MCU Pin10.

Is long press dimming even a possibility with tasmota?

I think in the depths of the Tasmota source it is possible ;), but hardly only with rules.

jsponz commented 5 years ago

@thxthx0 Thanks again!!!

james-fry commented 5 years ago

Since I only got the device today I am playing with the default f/w before I hack it. When I 1st turned it on I skipped configuration with the tuya app and went straight to testing switch functions... and now I cannot get back to pairing mode. I tried both (!) of the reset methods in the instructions but neither worked for me. (hold switch for 10+ secs, switch on/off 5 times) Any idea how to reset the device to pairing mode? (with original tuya f/w)

jsponz commented 5 years ago

It works great, but I have some questions (sorry but I am not an expert in Tasmota... yet):

Thanks!

HA-TB303 commented 5 years ago

Hi finally I managed to get the dimmer flashed by wire.

I have tasmota running now, set up as:

image

And wired as:

image

But when I send the commands via the console nothing happens...:(

09:59:23 MQT: tele/%topic%/INFO3 = {"RestartReason":"Power on"}
09:59:31 MQT: tele/%topic%/STATE = {"Time":"2019-06-20T09:59:31","Uptime":"0T00:00:14","Vcc":3.182,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"Wifi":{"AP":2,"SSId":"XXXXX","BSSId":"XXXXXXXXXXXXXX","Channel":11,"RSSI":54,"LinkCount":1,"Downtime":"0T00:00:04"}}
10:01:15 CMD: Baudrate 9600
10:01:15 MQT: stat/%topic%/RESULT = {"Baudrate":9600}
10:01:32 CMD: SerialSend5 FF55FF05DC0A
10:01:32 MQT: stat/%topic%/RESULT = {"SerialSend":"Done"}
10:01:40 CMD: SerialSend5 FF550005DC0A
10:01:40 MQT: stat/%topic%/RESULT = {"SerialSend":"Done"}
10:01:48 CMD: SerialSend5 FF558005DC0A
10:01:48 MQT: stat/%topic%/RESULT = {"SerialSend":"Done"}
10:02:01 MQT: tele/%topic%/UPTIME = {"Time":"2019-06-20T10:02:00","Uptime":"0T00:02:43"}
dr-apple commented 5 years ago

I once tested it and it's great! But the problem is that you can not dim LEDS with it :-( lightbulb goes .... what have you already tested?

HA-TB303 commented 5 years ago

I have tested with a 12v LED powersupply and a 12v LED behind it, but I measured the voltage output, and there is none.

jsponz commented 5 years ago

I have tested with several LED bulbs and it works. I have tested with LED bulbs and transformer.

dr-apple commented 5 years ago

@jsponz please post a link for the led und trafo ;-)

dr-apple commented 5 years ago

Here a video for my LED and Trafo tests: https://youtu.be/8gcd-AqhbHE

jsponz commented 5 years ago

Sure. I will do it tomorrow ;-)

dr-apple commented 5 years ago

@jsponz thanks ;-)

jsponz commented 5 years ago

I have watched your video. From my experience, the trafo is critical. In some cases, on the trafo, they use to write "flicker free".

I will send you pictures.

james-fry commented 5 years ago

With stock tuya f/w its working fine for my 0-100% with a philips dimmable LED bulb

dr-apple commented 5 years ago

Yes, also think that it lies on the transformer, the LEDs are dimmable ...

dr-apple commented 5 years ago

@james-fry is the p. led on a trafo or directly on 230V ?

thxthx0 commented 5 years ago

Hi, you can and must use halogen or normal incandescent light bulbs, dimmable LED light bulbs, dimmable LED transformers, dimmable power supplies... e.g. https://www.amazon.de/s?k=led+trafo+dimmbar

@jsponz: baudrate isn't lost in my setup (?) but you can define a rule to set baudrate every startup

Rule1 1
Rule1 on System#Boot do Baudrate 9600 endon 

for switch you need a virtual relay (e.g. Relay1 @ GPIO14) and rule, but don't expect to much, it might work five times out of ten atm.

Rule2 1
Rule2 on Power1#State=0 do SerialSend5 FF 55 00 05 DC 0A endon on Power1#State=1 do SerialSend5 FF 55 FF 05 DC 0A endon

@HA-TB303: I can't see any error, maybe a bad connection...

james-fry commented 5 years ago

@james-fry is the p. led on a trafo or directly on 230V ?

Dimmable bulb directly in 240v

dr-apple commented 5 years ago

@thxthx0 thank you for this info: https://www.amazon.de/s?k=led+trafo+dimmbar

DeanoXX commented 5 years ago

Got my WiFi Dimmer today and flashed it successfully with Tasmota, it's workin'...

I had to set pin RE (= STM8 MCU Pin4 NRST) to GND for backup and flash (and also GPIO0 to GND for flash mode) - didn't try Tuya-Convert.

Can I ask what setup you used to flash ?

TTL/Serial USB ? 3.3v or 5v ? Which tool ?

Will have another go at mine !

jsponz commented 5 years ago

@jsponz please post a link for the led und trafo ;-)

As promised the pictures:

1) This is with a "flicker free" trafo:

led3

2) This is a 220V dimmable LED from Sylvania:

led2

3) This is a good quality dimmable LED driver:

led1

I hope that helps.