TUYA Dimmer Switch

Moderators: Voyager, BertB, rtenklooster, Stuntteam, Martinus, grovkillen, TD-er

Post Reply
Message
Author
galak
Normal user
Posts: 3
Joined: 04 Jun 2018, 04:16

TUYA Dimmer Switch

#1 Post by galak » 04 Jun 2018, 04:40

I was looking for some help with trying to get a TUYA based dimmer switch flashed:

Here are a few links to the various device.

https://www.amazon.com/Benuo-UPGRADED-V ... itch&psc=1
https://www.amazon.com/Oittm-Lighting-I ... mer+switch
https://www.amazon.com/MIUO-Schedule-As ... mer+switch

The dimmer seems to be a combo of a Nuvoton 8-bit micro (N76E003) + A Tuya (TYWE3S) + Byd IT Capacitive Touch Key Controller (BF6911A22) from what I can tell. It seems like there is a UART connection between the Nuvoton & TYWE3S, but not usre how the touch key controller is connected. There doesn't seem to be any GPIOs on the TYWE3S

What I'm seeing when I try esptool to flash is:

Connecting........_____....._____....._____....._____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header

=====

On a normal boot I see this on the UART:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0

2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

OS SDK ver: 1.4.2(23fbe10) compiled @ Sep 22 2016 13:09:03
phy v

=====

On boot with GPIO0 to GND:


ets Jan 8 2013,rst cause:2, boot mode:(1,6)

=====

Trying to read the ESP8266 firmware and I get:

$ esptool.py --baud 9600 --port /dev/tty.usbserial-00000000 read_flash 0x00000 0x100000 dimmer.bin
esptool.py v2.3.1
Connecting........_____....._____....._____....._____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header

galak
Normal user
Posts: 3
Joined: 04 Jun 2018, 04:16

Re: TUYA Dimmer Switch

#2 Post by galak » 04 Jun 2018, 16:41

Here are some images of the switch.
IMG_4881.JPG
IMG_4881.JPG (2.56 MiB) Viewed 1031 times
IMG_6836.JPG
IMG_6836.JPG (1.28 MiB) Viewed 1031 times
IMG_9718.JPG
IMG_9718.JPG (1.44 MiB) Viewed 1031 times
IMG_8149.JPG
IMG_8149.JPG (1.42 MiB) Viewed 1031 times
IMG_0788.JPG
IMG_0788.JPG (1.54 MiB) Viewed 1031 times
IMG_1946.JPG
IMG_1946.JPG (1.59 MiB) Viewed 1031 times

dxfantome
Normal user
Posts: 11
Joined: 25 Apr 2018, 09:29

Re: TUYA Dimmer Switch

#3 Post by dxfantome » 13 Jun 2018, 12:22

Hello I am too intérréssé by the evolution of your search.
Because I look too for a solution of firmware alternative for a switch "dimmer" tuya

viewtopic.php?f=5&t=3244&sid=2ccfd73c9a ... c&start=30

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#4 Post by digiblur » 21 Aug 2018, 14:51

Have you had any luck with this switch/dimmer? I was able to read/dump the firmware on the switch without issue. Trying to figure out what they did with the UART on the TX/RX pins and how it is talking to the chip doing the actual dimming.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#5 Post by enesbcs » 21 Aug 2018, 20:54

First of all, this is very experimental feature, because i do not own any dimmer device, so i am unable to test it. So absolutely no warranty... in theory this plugin should work with a standard Tuya dimmer.
If anyone needs support, please provide me at least test data from P020 Ser2Net plugin, or you can send me a dimmer switch to Hungary. :)

1. Make sure to disable serial logging (None) under Tools/Advanced
2. Enable Serial MCU controlled switch plugin
3. Set switch type to Tuya, number of relays to "2/Dimmer"
4. restart espeasy if something seems odd

You can freely rename Relay0 and Relay1 values inside the plugin. The first value holds the actual state of the relay, the second holds the dim value between 0-255.
commands:
set switch on:
relay,0,1
set switch off:
relay,0,0

set dimmer to 10%
ydim,25

set dimmer to 90%
ydim,229

Attached binary is compiled for 4M flash with 1M SPIFFS size.
Last edited by enesbcs on 16 Sep 2018, 10:36, edited 1 time in total.

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#6 Post by digiblur » 05 Sep 2018, 14:54

enesbcs wrote:
21 Aug 2018, 20:54
First of all, this is very experimental feature, because i do not own any dimmer device, so i am unable to test it. So absolutely no warranty... in theory this plugin should work with a standard Tuya dimmer.
If anyone needs support, please provide me at least test data from P020 Ser2Net plugin, or you can send me a dimmer switch to Hungary. :)

1. Make sure to disable serial logging (None) under Tools/Advanced
2. Enable Serial MCU controlled switch plugin
3. Set switch type to Tuya, number of relays to "2/Dimmer"
4. restart espeasy if something seems odd

You can freely rename Relay0 and Relay1 values inside the plugin. The first value holds the actual state of the relay, the second holds the dim value between 0-255.
commands:
set switch on:
relay,0,1
set switch off:
relay,0,0

set dimmer to 10%
ydim,25

set dimmer to 90%
ydim,229

Attached binary is compiled for 4M flash with 1M SPIFFS size.
Could you provide more details on this so I could compile one myself since the the module on this dimmer only has a 1MByte of flash.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#7 Post by enesbcs » 05 Sep 2018, 15:30

galak wrote:
04 Jun 2018, 04:40
SPI Mode : QIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
Interesting. Devices with 8mbit flash typically can be flashed at DOUT mode, not QIO.
Earlier, when i am unable to flash a device, i missed the mode, sometimes GND->GPIO-0, and if there are something other connected at the RX/TX of the ESP, than it may also interfere...

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#8 Post by enesbcs » 05 Sep 2018, 15:36

digiblur wrote:
05 Sep 2018, 14:54
Could you provide more details on this so I could compile one myself since the the module on this dimmer only has a 1MByte of flash.
1MB and 4MB version attached at this post for testing purposes.

For compilation you need minimum Arduino core for ESP8266 WiFi chip 2.4.0 because previous versions serial buffer fixed at 32 bytes, which is almost nothing, Tuya needs more.
Then you have to download P165 plugin from playground, copy into the ESPEasy 2.x source files, compile for the necessary platform and flash in the correct flashing mode. :)
https://github.com/letscontrolit/ESPEas ... Switch.ino
Last edited by enesbcs on 16 Sep 2018, 10:35, edited 1 time in total.

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#9 Post by digiblur » 13 Sep 2018, 04:03

enesbcs wrote:
05 Sep 2018, 15:36
digiblur wrote:
05 Sep 2018, 14:54
Could you provide more details on this so I could compile one myself since the the module on this dimmer only has a 1MByte of flash.
1MB and 4MB version attached at this post for testing purposes.

For compilation you need minimum Arduino core for ESP8266 WiFi chip 2.4.0 because previous versions serial buffer fixed at 32 bytes, which is almost nothing, Tuya needs more.
Then you have to download P165 plugin from playground, copy into the ESPEasy 2.x source files, compile for the necessary platform and flash in the correct flashing mode. :)
https://github.com/letscontrolit/ESPEas ... Switch.ino
So I got it setup this evening with the 1M flash, was acting weird on me, so I flashed the regular mega from github, factory defaulted, setup then flashed this one over top and it was all good then. I setup the switch as you said and sent the commands and relay 0,1 and relay 0,0 worked just fine. It turned things off and on without issue. The Ydim commands didn't do anything when I sent them, the other MCU must have just ignored them. I didn't get an error or anything from espeasy. I tried to turn on the SerNet thing and set it to 9600 8,N,1 then attached to the port via telnet, no commands would come across. I assume it was using that baud rate based on the Tuya docs. I'm trying to flash back to the Tuya firmware and see if I can do some additional digging. Pretty cool to see it close!

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#10 Post by digiblur » 13 Sep 2018, 04:31

enesbcs wrote:
05 Sep 2018, 15:36
digiblur wrote:
05 Sep 2018, 14:54
Could you provide more details on this so I could compile one myself since the the module on this dimmer only has a 1MByte of flash.
1MB and 4MB version attached at this post for testing purposes.

For compilation you need minimum Arduino core for ESP8266 WiFi chip 2.4.0 because previous versions serial buffer fixed at 32 bytes, which is almost nothing, Tuya needs more.
Then you have to download P165 plugin from playground, copy into the ESPEasy 2.x source files, compile for the necessary platform and flash in the correct flashing mode. :)
https://github.com/letscontrolit/ESPEas ... Switch.ino
I think this might be what you are looking for.... I can see what it's doing in that last byte. It corresponds to the brightness from 1 to 255. Something probably just needs a small tweak in your plugin. Captured this from a serial monitor on the switch as I was turning it up and down via the app(cloud).

55AA0006000803020004000000BCD2
55AA0006000803020004000000FC12
55AA0006000803020004000000FF15
55AA00060008030200040000001D33
55AA0006000803020004000000576D
55AA000600080302000400000099AF
55AA0006000803020004000000CCE2

55AA00060008030200040000005167
55AA00060008030200040000007F95
55AA0006000803020004000000BCD2
55AA0006000803020004000000ED03
55AA0006000803020004000000FF15
55AA0006000803020004000000384E

EDIT:
I see the issue...the order-id is a 03 instead of 02.:

void sendmcudim(byte dimvalue)
{
Serial.write(0x55); // Tuya header 55AA
Serial.write(0xAA);
Serial.write(0x00); // version 00
Serial.write(0x06); // Tuya command 06 - send order
Serial.write(0x00);
Serial.write(0x08); // following data length 0x08
Serial.write(0x02); // dimmer order-id?
Serial.write(0x02); // type=value
Serial.write(0x00); // length hi
Serial.write(0x04); // length low
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write( dimvalue ); // dim value (0-255)
Serial.write( byte(21 + dimvalue) ); // checksum:sum of all bytes in packet mod 256
Serial.flush();
}

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#11 Post by digiblur » 13 Sep 2018, 05:16

enesbcs wrote:
05 Sep 2018, 15:36
digiblur wrote:
05 Sep 2018, 14:54
Could you provide more details on this so I could compile one myself since the the module on this dimmer only has a 1MByte of flash.
1MB and 4MB version attached at this post for testing purposes.

For compilation you need minimum Arduino core for ESP8266 WiFi chip 2.4.0 because previous versions serial buffer fixed at 32 bytes, which is almost nothing, Tuya needs more.
Then you have to download P165 plugin from playground, copy into the ESPEasy 2.x source files, compile for the necessary platform and flash in the correct flashing mode. :)
https://github.com/letscontrolit/ESPEas ... Switch.ino
Talking to myself here tonight....ha! But it WORKS!!! YES!!! Modified your last piece to this:

void sendmcudim(byte dimvalue)
{
Serial.write(0x55); // Tuya header 55AA
Serial.write(0xAA);
Serial.write(0x00); // version 00
Serial.write(0x06); // Tuya command 06 - send order
Serial.write(0x00);
Serial.write(0x08); // following data length 0x08
Serial.write(0x03); // dimmer order-id?
Serial.write(0x02); // type=value
Serial.write(0x00); // length hi
Serial.write(0x04); // length low
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write( dimvalue ); // dim value (0-255)
Serial.write( byte(22 + dimvalue) ); // checksum:sum of all bytes in packet mod 256
Serial.flush();

Changed the order-id and checksum, added one to each.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#12 Post by enesbcs » 13 Sep 2018, 07:34

digiblur wrote:
13 Sep 2018, 05:16
Talking to myself here tonight....ha! But it WORKS!!! YES!!! Modified your last piece to this:

void sendmcudim(byte dimvalue)
{
Serial.write(0x55); // Tuya header 55AA
Serial.write(0xAA);
Serial.write(0x00); // version 00
Serial.write(0x06); // Tuya command 06 - send order
Serial.write(0x00);
Serial.write(0x08); // following data length 0x08
Serial.write(0x03); // dimmer order-id?
Serial.write(0x02); // type=value
Serial.write(0x00); // length hi
Serial.write(0x04); // length low
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write( dimvalue ); // dim value (0-255)
Serial.write( byte(22 + dimvalue) ); // checksum:sum of all bytes in packet mod 256
Serial.flush();

Changed the order-id and checksum, added one to each.
Thank you for your debugging, the dataset i see used order-id "2", so i suspect, that there are maybe devices with accepting id 2 and 3 also.
I will upgrade the source, with selectable ID. (2/3)
Your dimmer values returns in which TaskValue inside the plugin?

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#13 Post by digiblur » 13 Sep 2018, 18:03

enesbcs wrote:
13 Sep 2018, 07:34
digiblur wrote:
13 Sep 2018, 05:16
Talking to myself here tonight....ha! But it WORKS!!! YES!!! Modified your last piece to this:

void sendmcudim(byte dimvalue)
{
Serial.write(0x55); // Tuya header 55AA
Serial.write(0xAA);
Serial.write(0x00); // version 00
Serial.write(0x06); // Tuya command 06 - send order
Serial.write(0x00);
Serial.write(0x08); // following data length 0x08
Serial.write(0x03); // dimmer order-id?
Serial.write(0x02); // type=value
Serial.write(0x00); // length hi
Serial.write(0x04); // length low
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write(0x00); // ?
Serial.write( dimvalue ); // dim value (0-255)
Serial.write( byte(22 + dimvalue) ); // checksum:sum of all bytes in packet mod 256
Serial.flush();

Changed the order-id and checksum, added one to each.
Thank you for your debugging, the dataset i see used order-id "2", so i suspect, that there are maybe devices with accepting id 2 and 3 also.
I will upgrade the source, with selectable ID. (2/3)
Your dimmer values returns in which TaskValue inside the plugin?
Thank you for your work and posts on this! It helped shove me over the edge on working on this thing again. I think where I failed on not picking up the data before was I wasn't sending the data from the cloud doing my snooping which made perfect sense after I realized my mistake after flashing ESPeasy on it and the switch still worked with the scaling lights on the front.

I'm not 100% familiar with the TaskValue thing, I'll dig around, I was just sending commands to it over HTTP URLs with CURL. I'm more of a Tasmota guy as that was the one I started with. I'll get back with you on it later this evening (US here).

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#14 Post by enesbcs » 13 Sep 2018, 18:28

digiblur wrote:
13 Sep 2018, 18:03
Thank you for your work and posts on this! It helped shove me over the edge on working on this thing again. I think where I failed on not picking up the data before was I wasn't sending the data from the cloud doing my snooping which made perfect sense after I realized my mistake after flashing ESPeasy on it and the switch still worked with the scaling lights on the front.

I'm not 100% familiar with the TaskValue thing, I'll dig around, I was just sending commands to it over HTTP URLs with CURL. I'm more of a Tasmota guy as that was the one I started with. I'll get back with you on it later this evening (US here).
You are welcome. Of course commands is the main "engine" of the plugin, altough on the Device page, you can see the relay(s) and if dimmer selected, then dimmer state at the right. (values names can be renamed at the plugin settings - in theory if dimmer id is 2 then at the second value, if id is 3 than the third value) When the device changes it's state, either by the buttons or with commands, a SendData event is generated, which sends the task values to the selected controller. (mqtt) Or it can be captured by Rules events for further processing. "Rules" is a very versatile tool, in modern Tasmota version's it is also appeared, but in ESPEasy it has more options. I dare to say that ESPEasy is the Swiss Army Knife firmware. :)

update - source fixed, now Dimmer#2 or Dimmer#3 has to be selected at plugin settings:
https://github.com/enesbcs/ESPEasyPlugi ... Switch.ino
Attachments
tuyavalues.jpg
tuyavalues.jpg (17.65 KiB) Viewed 302 times

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#15 Post by digiblur » 14 Sep 2018, 01:05

Unfortunately no values are shown. I'll have to do some probing on the RX side of the chip to see what packets are coming across to obtain the states from the manual user input.

EDIT: Snooped on the on the comms being sent to the ESP8266 from the dimming circuit. This is in uint8 display to make things easier. I wrote the "= ON" "= 5 " etc out to the right.

85 170 0 14 0 0 13 85 170 0 7 0 5 1 1 0 1 1 15 = ON (toggled)
85 170 0 14 0 0 13 85 170 0 7 0 5 1 1 0 1 0 14 = OFF (toggled)


85 170 0 7 0 8 3 2 0 4 0 0 0 176 199 = 5 (5 leds displayed)
85 170 0 7 0 8 3 2 0 4 0 0 0 100 123 = 3 (3 leds)
85 170 0 7 0 8 3 2 0 4 0 0 0 25 48 = 1 (1)

Will take a look at the plugin to see what needs to be tweaked shortly...

EDIT:

And a few in HEX...

55 AA 00 0E 00 00 0D 55 AA 00 07 00 05 01 01 00 01 00 0E
55 AA 00 0E 00 00 0D 55 AA 00 07 00 05 01 01 00 01 01 0F
55 AA 00 07 00 08 03 02 00 04 00 00 00 B0 C7
55 AA 00 07 00 08 03 02 00 04 00 00 00 64 7B

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#16 Post by enesbcs » 14 Sep 2018, 07:17

digiblur wrote:
14 Sep 2018, 01:05
55 AA 00 0E 00 00 0D 55 AA 00 07 00 05 01 01 00 01 00 0E
55 AA 00 0E 00 00 0D 55 AA 00 07 00 05 01 01 00 01 01 0F
55 AA 00 07 00 08 03 02 00 04 00 00 00 B0 C7
55 AA 00 07 00 08 03 02 00 04 00 00 00 64 7B
If you've selected Dimmer#3 in plugin the above datasets seems ok.

This is not needed, skipped = [55 AA 00 0E 00 00 0D]

[3] 7 means reporting; [10] 0=off,1=on state
_________|_________________|________
55 AA 00 07 00 05 01 01 00 01 00 0E
55 AA 00 07 00 05 01 01 00 01 01 0F
______________|_____________________
[5] 5 bytes following

[3] 7 means reporting; [13] dim value
_________|________________________|____
55 AA 00 07 00 08 03 02 00 04 00 00 00 B0 C7
55 AA 00 07 00 08 03 02 00 04 00 00 00 64 7B
______________|_|______________________
[5] 8 bytes following, [6] 3 = dimmer id

if Dimmer#2 selected then the dim value of ID 0x03 is not saved to uservar.
Can you see anything interesting in ESPEasy logs, when switching?

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#17 Post by digiblur » 14 Sep 2018, 17:03

I haven't recompiled since you updated the plugin yet. I was just trying to verify the inbound states to the ESP before I flashed again. With the binary over 500k it's a such a pain to flash since I have to disconnect the ribbon cables, attach to the programmer, etc each time. I miss my easy OTA/HTTP flash with Tasmota. I tried to trim down ESPEasy down but it's still over 500k, not sure what else to remove.

I'll recompile, reflash, and try the new config again. Much appreciated.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#18 Post by enesbcs » 14 Sep 2018, 18:36

digiblur wrote:
14 Sep 2018, 17:03
I haven't recompiled since you updated the plugin yet. I was just trying to verify the inbound states to the ESP before I flashed again. With the binary over 500k it's a such a pain to flash since I have to disconnect the ribbon cables, attach to the programmer, etc each time. I miss my easy OTA/HTTP flash with Tasmota. I tried to trim down ESPEasy down but it's still over 500k, not sure what else to remove.
I'll recompile, reflash, and try the new config again. Much appreciated.
Try 2 step OTA with ESPEasyUploaderMega:
viewtopic.php?p=27461#p27461

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#19 Post by digiblur » 14 Sep 2018, 19:38

enesbcs wrote:
14 Sep 2018, 18:36
digiblur wrote:
14 Sep 2018, 17:03
I haven't recompiled since you updated the plugin yet. I was just trying to verify the inbound states to the ESP before I flashed again. With the binary over 500k it's a such a pain to flash since I have to disconnect the ribbon cables, attach to the programmer, etc each time. I miss my easy OTA/HTTP flash with Tasmota. I tried to trim down ESPEasy down but it's still over 500k, not sure what else to remove.
I'll recompile, reflash, and try the new config again. Much appreciated.
Try 2 step OTA with ESPEasyUploaderMega:
viewtopic.php?p=27461#p27461
I'll check that out as I don't want to break this switch taking apart the various pieces each time to flash as it doesn't like being flashed with all the other pieces hanging off of it. Thanks again.

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#20 Post by digiblur » 15 Sep 2018, 05:47

I recompiled and selected the 3/Dimmer#3 and while things work fine with the commands via curl, it shows 0's across the board on the state. Changing the switch manually and even refreshing the page doesn't update the states.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#21 Post by enesbcs » 15 Sep 2018, 08:42

digiblur wrote:
15 Sep 2018, 05:47
I recompiled and selected the 3/Dimmer#3 and while things work fine with the commands via curl, it shows 0's across the board on the state. Changing the switch manually and even refreshing the page doesn't update the states.
Interesting.. and the ESPEasy logs writes nothing?

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#22 Post by digiblur » 16 Sep 2018, 01:31

enesbcs wrote:
15 Sep 2018, 08:42
digiblur wrote:
15 Sep 2018, 05:47
I recompiled and selected the 3/Dimmer#3 and while things work fine with the commands via curl, it shows 0's across the board on the state. Changing the switch manually and even refreshing the page doesn't update the states.
Interesting.. and the ESPEasy logs writes nothing?
Nothing odd.

133: INIT : SPI not enabled
152: SerSW : Init Yewe 3 btn
156: INFO : Plugins: 35 [Normal] [Testing] [Development] (ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3)
157: WIFI : Set WiFi to STA
189: WIFI : Connecting xxxx attempt #0
1524: WD : Uptime 0 ConnectFailures 0 FreeMem 28168
3969: WIFI : Connected! AP: xxxxx (xxxxxx) Ch: 11 Duration: 3779 ms
4992: WIFI : DHCP IP: 192.168.xx (ESP-Easy-0) GW: 192.168.xx SN: 255.255.255.0 duration: 1022 ms
4996: Webserver: start
15789: SerSW : SetDim 25
20391: SerSW : SetDim 50
22144: SerSW : SetDim 150
23383: SerSW : SetDim 255
24622: SerSW : SetSwitch r0:0
25159: SerSW : SetSwitch r0:1
25855: SerSW : SetDim 255
28843: SerSW : SetDim 125
29904: SerSW : SetDim 25
31524: WD : Uptime 1 ConnectFailures 0 FreeMem 23960

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#23 Post by enesbcs » 16 Sep 2018, 10:34

digiblur wrote:
16 Sep 2018, 01:31
I recompiled and selected the 3/Dimmer#3 and while things work fine with the commands via curl, it shows 0's across the board on the state. Changing the switch manually and even refreshing the page doesn't update the states.
I've tested with my 1 button Tuya switch and got the same results... after several recompile and reflash, i found out, that neither 2.4.1 nor 2.4.2 did not work, only the core 2.4.0 responds the status changes. :( I suspect some serial buffer underrun errors but did not figured yet, so please use core 2.4.0 for this device for now. Testing binaries attached.
(Attachment transferred to SerSwitch support thread first entry)
Last edited by enesbcs on 16 Sep 2018, 22:03, edited 1 time in total.

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#24 Post by digiblur » 16 Sep 2018, 15:41

enesbcs wrote:
16 Sep 2018, 10:34
digiblur wrote:
16 Sep 2018, 01:31
I recompiled and selected the 3/Dimmer#3 and while things work fine with the commands via curl, it shows 0's across the board on the state. Changing the switch manually and even refreshing the page doesn't update the states.
I've tested with my 1 button Tuya switch and got the same results... after several recompile and reflash, i found out, that neither 2.4.1 nor 2.4.2 did not work, only the core 2.4.0 responds the status changes. :( I suspect some serial buffer underrun errors but did not figured yet, so please use core 2.4.0 for this device for now. Testing binaries attached.
Flashed your build and no change except for the core version of course. Still shows zeros on the status when I run my script through with the commands. I think I should have more time this evening to make me a little sketch with various serial commands and log the response back a little easier to see what is going on.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#25 Post by enesbcs » 16 Sep 2018, 16:01

digiblur wrote:
16 Sep 2018, 15:41
Flashed your build and no change except for the core version of course. Still shows zeros on the status when I run my script through with the commands. I think I should have more time this evening to make me a little sketch with various serial commands and log the response back a little easier to see what is going on.
Please double check settings in ESPEasy Tools menu ->Advanced:

Enable Serial port: checked
Serial log level: None

Then try to disable/save/enable the P165 plugin device, and if no change, reboot device.

digiblur
Normal user
Posts: 13
Joined: 21 Aug 2018, 14:48

Re: TUYA Dimmer Switch

#26 Post by digiblur » 16 Sep 2018, 16:28

enesbcs wrote:
16 Sep 2018, 16:01
digiblur wrote:
16 Sep 2018, 15:41
Flashed your build and no change except for the core version of course. Still shows zeros on the status when I run my script through with the commands. I think I should have more time this evening to make me a little sketch with various serial commands and log the response back a little easier to see what is going on.
Please double check settings in ESPEasy Tools menu ->Advanced:

Enable Serial port: checked
Serial log level: None

Then try to disable/save/enable the P165 plugin device, and if no change, reboot device.
That did it! I had the serial port enabled, I was thinking that was part of the debug process so I had that disabled to prevent any conflicts. Interesting that the outbound serial worked with it disabled.

User avatar
enesbcs
Normal user
Posts: 202
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: TUYA Dimmer Switch

#27 Post by enesbcs » 16 Sep 2018, 17:54

digiblur wrote:
16 Sep 2018, 16:28
That did it! I had the serial port enabled, I was thinking that was part of the debug process so I had that disabled to prevent any conflicts. Interesting that the outbound serial worked with it disabled.
Good news.
If Serial is not enabled than "PLUGIN_SERIAL_IN" is never called by ESPEasy so communication will be one way. :)
On the other hand, if _Serial logging_ is enabled, than it may interfere the comm line.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests