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

Tuya Dimmer - need help #4543

Closed
h4nc opened this issue Dec 6, 2018 · 45 comments
Closed

Tuya Dimmer - need help #4543

h4nc opened this issue Dec 6, 2018 · 45 comments
Labels
awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting

Comments

@h4nc
Copy link

h4nc commented Dec 6, 2018

Hi,

I followed these instructions to set up my new tuya dimmer:

https://github.com/arendst/Sonoff-Tasmota/wiki/Tuya-Dimmer

I have two issues:

  1. The dimmer will be mounted in a bedroom. Is there away to turn off the led's when the dimmer is off?

  2. after setting up gpio13 to Rx and gpio15 to tx the device doesn't swith on off when I press the button on it.
    Before it worked, but the dimming buttons did not.
    I selectet the device ID SetOption34 2.
    Will this always be "2" or is it an ID of the device itself? Where can I find it?

@Jason2866
Copy link
Collaborator

Since there is not "the One" Tuya Dimmer nobody cant help without knowing which type you have

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

You are right, I'm sorry.

I have the EU model. I also noticed that the layout of my pcb is a little different. The esp is faced the opposite as the picture showed it the documentation.

It also says YDM_WIFI_SV4 instead of YDM_WIFI_SV2

img_7657-2

@Jason2866
Copy link
Collaborator

@chaosmaster Can you help? I have no Tuya device (yet)....

@ascillato2 ascillato2 added awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting labels Dec 6, 2018
@chaosmaster
Copy link
Contributor

chaosmaster commented Dec 6, 2018

@h4nc

The dimmer will be mounted in a bedroom. Is there away to turn off the led's when the dimmer is off?

Sorry, that's not possible, the LEDs are controlled by the MCU and can only switch between red and blue.
Only the WiFi (green) LED is controlled by Tasmota.

after setting up gpio13 to Rx and gpio15 to tx the device doesn't swith on off when I press the button on it.

This dimmer uses GPIO1 as TX and GPIO3 as RX (the default for "Tuya Dimmer").

I selectet the device ID SetOption34 2.
Will this always be "2" or is it an ID of the device itself? Where can I find it?

Everything else should be detected automatically in the current development branch.
Otherwise SetOption34 2 is correct for this device.
The ID depends on the type of Tuya-device and currently there are devices using 2 or 3

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

@chaosmaster
Thanks for the fast reply.

Sorry, that's not possible, the LEDs are controlled by the MCU and can only switch between red and blue.

Is there a line I can cut to disable this three leds that are not managed by tasmota.
If there is one line to cut, maybe its possible to connect it to the esp, so that it can be controlled by tasmota? Which pin would you recommend?

EDIT:
I tried it again. The dimmer already works. I had no light connected and I was confused that the slide value wouldn't change when i press those dimmer buttons.
So I attached a bulb and also the dimmer value changes in the console.

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

Every led has 4 pins. GND, BLUE, RED and?

It does seem like there is one line I could cut to trigger all blue and another to trigger als red lights.
I still want to use it in my bedroom, but the the leds lightning the whole room in blue in not an option.

How would you to it? Desolder the led's? Cut the lines to the leds?
I could also only cut the blue ones.
Best way for my still would be to be able to use them in tasmota by connecting them to the esp.

Any ideas are welcome!

Here are some pictures:
img_7662-3
img_7663-3
img_7664-3

@Jason2866
Copy link
Collaborator

  • The easiest mod would be cut trace(s)
  • For connecting to the ESP (it seems GPIO 12-16 are free)
    you have to add a transistor. GPIO from ESP doesnt deliver enough current to connect it direct.
    The function of the LEDs could be done...

@ascillato2
Copy link
Collaborator

Great to know, that now the dimmer is working for you.

Closing this issue as it has been answered.

Support Information

See Wiki for more information.
See Chat for more user experience.

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

I marked the Pins of the Power Switch in this picture.

As I would expect a two color led needs 3 pins. So why are there 4 pins per led?

I think a will cut the traces, but first I need to now what the traces are for.

49586903-c01c6e00-f962-11e8-8924-5fd099fc5193

@chaosmaster
Copy link
Contributor

chaosmaster commented Dec 6, 2018

@h4nc
You can check this post.
It describes what is connected where.
Although the LEDs aren't directly connected to the MCU, they are connected via the CR302-chip.
They are switched between blue and red by pulling the GPIO HIGH or LOW.
To disable them the GPIO can be configured as input.
You can also check out my custom MCU-firmware for this device, to disable the LEDs.
But be warned it isn't completely stable and I haven't had time to look further into it.

I suppose the have 4 pins since, they are all in fact RGB LEDs, although I believe only the top LED has green wired, I'm not sure though.
Actually, looking at it again, I believe the LEDs might just be two separate dice each with one GND and one VCC. and another extra die for the green LED.

Here you can find my custom MCU-firmware:
https://github.com/chaosmaster/tuya_mcu

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

Actually, looking at it again, I believe the LEDs might just be two separate dice each with one GND and one VCC. and another extra die for the green LED.

I don't think so. I followed the traces and also tried to meassure it. There are no pins connected, which would most possible mean GND.

However, I wanted to get rid of the blue lights.
So instead of cutting the traces which wouldn't be easy to undo I came up with the idea to desolder the resistors.
I like the idea to load a new firmware to the mcu. But as I have no experience with that it would most probably consum much time. So desoldering the resistors is easy, reversable and fast.

Here is a picture for other how want to disable the blue lights. This way you could also just leave one blue light (the middle one).

The resistors I removes are R5, R7, R9

img_7673-2

@h4nc
Copy link
Author

h4nc commented Dec 6, 2018

I still have one open question. I don't want to open a new issue for that.

Why do we have to connect NRST to GND for flashing the device? What does NRST stand for?

@chaosmaster
Copy link
Contributor

chaosmaster commented Dec 6, 2018

@h4nc
NRST is the reset-pin for the MCU, it's part of the MCUs programming-interface.
It needs to be pulled LOW during flashing the ESP, because the MCU is connected to the ESPs UART.

@TommyChausson
Copy link

@h4nc I've got a few question about the EU model, i manage to flash it with the last Tasmota firmware. It work when piloting it by button, by mqtt, by tasmota interface but when i use the switch (toggle or up/down button) no informations are sent by mqtt ? Is there a specific configuration in "Module parameters" interface ? Actually i have :

  • GPIO0 - Button 1
  • GPIO1 - Tuya Tx
  • GPIO3 - Tuya Rx
  • GPI14 - Led1

Thank's

@h4nc
Copy link
Author

h4nc commented Jan 24, 2019

no informations are sent by mqtt ?

Strange, mine works.

Is there a specific configuration in "Module parameters" interface ?

All I did was flashing the esp and setting it to "Tuya Dimmer Module" in the UI.
I did not change something in the parameters.

GPIO0 - Button 1
GPIO1 - Tuya Tx
GPIO3 - Tuya Rx
GPI14 - Led1

Mine looks the same.

@TommyChausson
Copy link

@h4nc Yes, VERY strange, when it boot it send MQTT infos (state etc...), That prove that MQTT info sending is working, only when i touch a button nothing is sent ! What's your tasmota version ?

@h4nc
Copy link
Author

h4nc commented Jan 24, 2019

What's your tasmota version ?
6.4.1

@kajmaj
Copy link

kajmaj commented Feb 19, 2019

I have Tuya Dimmer with 6.4.1(release-sensors), 2.3.0/1.5.3.
Everything works well but after restart (change configuration) it everytime went ON.
PowerOnState is 0

In hassio config retain: false
Is there anything possible to do with it?

@h4nc
Copy link
Author

h4nc commented Feb 19, 2019

Maybe adding this code to your automation.yaml could help, this will call the current state of all your sonoff. You could also change the topic to your tuya dimmer to only call its state.

- alias: 'Sonoff - State after Restart'
  initial_state: 'on'
  trigger:
  - event: start
    platform: homeassistant
  action:
    - service: mqtt.publish
      data:
        topic: cmnd/sonoffs/POWER

@kajmaj
Copy link

kajmaj commented Feb 19, 2019

I already have this automation:

  - alias: "power_state_on_ha_start_up"
    initial_state: "on"
    trigger:
    - platform: homeassistant
      event: start
    action:
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/power1"
        payload: ""
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/power2"
        payload: ""
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/Power3"
        payload: "" 
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/power4"
        payload: ""
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/power"
        payload: ""

In the case of Tuya it does not have any influence.

And this tuya config:

light:
- platform: mqtt
  name: "bedroom"
  state_topic: "stat/bedroom_dim/POWER"
  command_topic: "cmnd/bedroom_dim/POWER"
  availability_topic: "tele/bedroom_dim/LWT"
  brightness_state_topic: "stat/bedroom_dim/RESULT"
  brightness_command_topic: "cmnd/bedroom_dim/Dimmer"
  brightness_scale: 100
  brightness_value_template: >
    {% if value_json.Dimmer is defined %}
      {{ value_json.Dimmer }}
    {% else %}
        {{ state_attr('light.bedroom_dim','brightness') / 255 * 100 }}
    {% endif %}
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  retain: false

@h4nc
Copy link
Author

h4nc commented Feb 19, 2019

Try:

    - service: mqtt.publish
      data:
        topic: cmnd/sonoffs/STATE

@kajmaj
Copy link

kajmaj commented Feb 19, 2019

response of Tuya Dimmer for STATE:
stat/bedroom_dim/RESULT = {"Time":"2019-02-19T18:35:15","Uptime":"0T08:27:51","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Dimmer":53,"Fade":"OFF","Speed":1,"LedTable":"OFF","Wifi":{"AP":1,"SSId":"HXXNET","BSSId":"F4:F8:6D:9B:94:A2","Channel":6,"RSSI":60}}

@h4nc
Copy link
Author

h4nc commented Feb 19, 2019

I use state to get an update of the DIMMER value.

So this too did not help you with your problem, right?

@kajmaj
Copy link

kajmaj commented Feb 19, 2019

Well, after first restart not. After restart it is OK. It seems to help
Will see during a day or two.
Thank you

@kajmaj
Copy link

kajmaj commented Feb 20, 2019

Everything is back, Tuya dimmer powers on after every reboot.
With mqtt disabled it is OK, with mqtt enabled it is back.
On Tuya, 6.4.1.16(8cb33b8-sensors), 2_5_0/3.0.0-dev(c0f7b44)
PowerRetain OFF

19:06:21 CMD: powerretain
19:06:21 MQT: stat/dimmer_1/RESULT = {"PowerRetain":"OFF"}

On Hassio config:
retain: false
In addition each Hassio reboot:

    action:
    - service: mqtt.publish
      data:
        topic: "cmnd/sonoffs/power"

Really do not know what else I could do.

@h4nc
Copy link
Author

h4nc commented Feb 20, 2019

Looks like something triggers your dimmer to turn on after the restart.
I do not have an empty payload like you showed in the example above in my config.
Maybe you want to comment that out and try again.

@kajmaj
Copy link

kajmaj commented Feb 20, 2019

I stopped the whole automation with empty payload. It has no influence. Reseting Tuya toggles power to on.

@h4nc
Copy link
Author

h4nc commented Feb 20, 2019

Ok, I have no more ideas. Maybe a clean flash could help, but I don’t know.

@joggs
Copy link

joggs commented Mar 7, 2019

If you've had retain enabled in your settings, that setting will be cached in hass/mqtt, no matter if you set it to disabled later on. When I had this problem I reinstalled my mqtt-service in home assistant and everything started working as expected.

@joggs
Copy link

joggs commented Mar 7, 2019

@h4nc I've got a few question about the EU model, i manage to flash it with the last Tasmota firmware. It work when piloting it by button, by mqtt, by tasmota interface but when i use the switch (toggle or up/down button) no informations are sent by mqtt ? Is there a specific configuration in "Module parameters" interface ? Actually i have :

  • GPIO0 - Button 1
  • GPIO1 - Tuya Tx
  • GPIO3 - Tuya Rx
  • GPI14 - Led1

Thank's

*And you did use "SetOption34 2" in the console as mentioned in the first post? After that change, my dimmer buttons started working as expected.

I have the same GPIO settings, although i changed the GPI14 to Led3 as Led1 gave me a constant flashing on one of the dimmer buttons

@marrobHD
Copy link

Mine wont flash :(.

resetting board
trying to connect
        flush start
        setting serial port timeouts to 1 ms
        setting serial port timeouts to 1000 ms
        flush complete
        espcomm_send_command: sending command header
        espcomm_send_command: sending command payload
        read 0, requested 1
trying to connect
        flush start
        setting serial port timeouts to 1 ms
        setting serial port timeouts to 1000 ms
        flush complete
        espcomm_send_command: sending command header
        espcomm_send_command: sending command payload

@telmomarques
Copy link

@TommyChausson did you ever solve your issue? I'm having the same problem, everything works but the Tasmota UI is not updated when I change something manually using the dimmer buttons...

@TommyChausson
Copy link

@telmomarques , Yes and it was a problem with my domotic system sent too much MQTT messages (i had something like infinite loop).

@tamirh-2
Copy link

hi,
i have the YDM_WIFI_SV4 model, how do i put it into flashing mode?

@jtauscher
Copy link

hi,
i have the YDM_WIFI_SV4 model, how do i put it into flashing mode?

GPIO0 & 15 need to be grounded.

@Dragao75
Copy link

Dragao75 commented Jul 9, 2020

Hi all, I have the same device (YDM_WIFI_SV4
But I can't seem to get it flashed...
I think I am in program mode (I see three blue led and the top one is also green)
but I am unable to communicate with the device.

I have tried grounding GPIO0 & 15 (also tried only grounding GPIO0)
esptool will not communicate. used baud rate 115200

What else can I do?

Never mind.. I found out what I was doing wrong
:) I am now able to read the flash.. SO I guess I am also able to write :)

The two pins on the top left need to be connected

Flash mode = only top green light!

You are right, I'm sorry.

I have the EU model. I also noticed that the layout of my pcb is a little different. The esp is faced the opposite as the picture showed it the documentation.

It also says YDM_WIFI_SV4 instead of YDM_WIFI_SV2

img_7657-2

@Dragao75
Copy link

Although this topic is closed I am hoping someone will read my post :)
I was able to flash the dimmer with tasmota. But I am unable to dimm the light.
I can dimm the light via the buttons but not via webinterface. I even don't have a slider in the webinterface.
So my guess is I am using the wrong module (Using Tuya MCU 54)

How can I troubleshoot this?
(when I touch the buttons nothing is shown in the console)

@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

@jtauscher
Copy link

Although this topic is closed I am hoping someone will read my post :)
I was able to flash the dimmer with tasmota. But I am unable to dimm the light.
I can dimm the light via the buttons but not via webinterface. I even don't have a slider in the webinterface.
So my guess is I am using the wrong module (Using Tuya MCU 54)

How can I troubleshoot this?
(when I touch the buttons nothing is shown in the console)

I think I had the same problem and it really sucked - took me hours to find out whats missing but actually its pretty simple.
Go to the console in the web interface and enter those two commands one by one:

TuyaMCU 21,2
DimmerRange 1 255

That should enable the slider etc. Hope that helps.

Cheers

@hamodcraft22
Copy link

heyyyy so i just stumbled across this and i have a simple question....

will this work with a "Tuya Fan" Device?

after further investigation every thing is the same about the "motherboard" like just take a look
IMG_0587
IMG_0590

the only differences are the (2018) which in mine is 2019 , and the face plate which has a fan rather then a light icon

@peepshow-21
Copy link

peepshow-21 commented Dec 19, 2020

Hi,

Struggling a bit with that last part of this :(

Issue 1.

I have installed Tasmota (9.2.0) & configured it. I can see the slider;

image

My module config is;
image

If I move it, I see events in the logs;
image

But the lights do not change they just stay on.

If I set it to zero, it goes off. any other value is on (at whatever value the switch left it). Toggle button works fine too. The dimmer will go up and down using the hardware buttons on the switch, although it can be via sluggish in showing those events in the console.

I've turned weblog 4 on and used the hardware buttons to find the range;
image
As per the dimmer section here (https://tasmota.github.io/docs/TuyaMCU/)
Although the documentation show this;
image
which is a little different that what I get.

Which goes from 11 to 255, so I've done this;
*dimmerrange 11,255

No matter what I try, I can seem to get the light to do anything other than on/off via Tasmoto.

Issue 2.

If I press the ON button on the switch, it fades in up the values to come on slow. Same with OFF, if I press that, it fades down the values until off. This is VERY annoying, especially off. When you press it, it looks like nothing has happened so you press it again. Such a stupid implementation. Is there a config, so you press off and it just goes off? I think I'll remove them if there isn't, or wife will never let me add anything else in house EVER!! :)

Any ideas?

@peepshow-21
Copy link

Just as an update for anyone else. GPIO12 was the issue. In another thread on this dimmer it said it needed set, as above. It doesn't, it need to be 'None'!! then it works.

I needed GPIO14 set to 3 for me, to turn the green LED off on button 1, otherwise the top one glows Cyan.

image

Only thing I wish though was that the hardware off button turned it off instantly, not fade to off. It's annoying...

@jtauscher
Copy link

Problem is, the buttons dont talk with your ESP but withe the STM chip on your PCB. That cant be changed, as far as I know.

I wonder if there is a dimmer with same optics, touch etc but trailing edge instead of leading edge - anybody?

Trailing edge is much better for LEDs lights in general.

@ghost
Copy link

ghost commented Jan 15, 2022

Recently bought a konesky smart dimmer (from amazon). Date on the board 20210930. Still works with tasmota (flashed via serial interface).
There are problems with recent tasmota versions. Requires remapping of dimming for the MCU, etc and still does not turn off when dim value is set to <= 9. Reports OFF via mqtt but does not turn off.

However it works flawlessly out of the box with older tasmota versions. I'm using tasmota-6.5.0-core-2.4.2.

Three years ago I bought a few simillar dimmers (ie physical identical to this one). Have been using these since then, flashed with tasmota 6.5.0, without a single problem so far.

@alecsandes
Copy link

Hello!

I got the same dimmer and I want to flash out the tuya fw.
Doing some digging, I didn't find where to connect what.

Ok, RX and TX is clear, than GND is GND and VCC is 3v3
Now, GPIO0 to GND?
And the upper shunt, what is it?
I see in the picture that the wires are soldered o the chip, can't I use the side pins? if yes, which ones are to connect to?

Date on board 20220930.
Will esphome run on it as well?

TIA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting
Projects
None yet
Development

No branches or pull requests