Open rickyelopez opened 1 year ago
Bump. Anybody have any ideas about what's going on, or any suggestions for me to debug further?
This appears to be the low-power protocol used for battery powered devices. It's different, one indication is that it stays in protocol 0 the whole time. That's the difference between the 55:AA:00:02:00:00:01
that it's sending compared to the 55 aa 03 02 00 00 04
(version 3) that you're expecting. I started working on this at one point, but didn't get it finished.
Interesting, yeah that makes sense since this is a battery powered device, and I've definitely observed some other oddities coming from low-power modes. Is that work something that you could follow up on, or that you could point me to so that I can try to continue where you left off?
I have the same problem.
I have curtain motor powered from mains but it looks like they put the protocol for battery powered devices in it.
I can control it, but since ESPHome receives 55:AA:00:03:00:01:03:06
and doesn't know what to do with it, it's stuck on waiting for init therefore never runs TuyaCover::setup()
with configuration.
I tried to debug it somehow; I tried to put some LOGV
commands to tuya.cpp
message handling and finally in the main loop:
void Tuya::loop() {
while (this->available()) {
uint8_t c;
this->read_byte(&c);
this->handle_char_(c);
ESP_LOGV(TAG, "hit");
}
process_command_queue_();
}
and for some reason I didn't get any hit logs after receiving this particular message (message logged via uart_debug
). But it worked for all other messages like config query and heartbeats, which is strange.
Maybe hardware debug would tell me more, unfortunately I don't have any way to try it now.
Same issue with BCM500DS-TYW Curtain Motor.
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=0
[V][tuya:148]: MCU Heartbeat (0x01)
[V][tuya:383]: Sending Tuya: CMD=0x01 VERSION=0 DATA=[] INIT_STATE=1
[C][tuya.cover:107]: Tuya Cover:
[C][tuya.cover:122]: Position has datapoint ID 101
[V][tuya:120]: Received Tuya: CMD=0x01 VERSION=0 DATA=[58.53.37.36.42.59.35.51.31.75.4B.4F.36.67.6A.43.31.2E.30.2E.30 (21)] INIT_STATE=1
[V][tuya:383]: Sending Tuya: CMD=0x02 VERSION=0 DATA=[] INIT_STATE=2
[V][tuya:120]: Received Tuya: CMD=0x02 VERSION=0 DATA=[] INIT_STATE=2
[V][tuya:201]: Configured WIFI_STATE periodic send
[D][tuya:456]: Sending WiFi Status
[V][tuya:383]: Sending Tuya: CMD=0x03 VERSION=0 DATA=[03] INIT_STATE=3
[C][tuya:033]: Tuya:
[C][tuya:038]: Configuration will be reported when setup is complete. Current init_state: 3
[C][tuya:041]: If no further output is received, confirm that this is a supported Tuya device.
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=3
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=3
[V][tuya:148]: MCU Heartbeat (0x01)
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=3
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=3
[V][tuya:148]: MCU Heartbeat (0x01)
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=3
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=3
[V][tuya:148]: MCU Heartbeat (0x01)
EvkaPC➜ ~ cat /tmp/blind.log | grep "tuya\|uart"
[C][uart.arduino_esp8266:059]: Setting up UART bus...
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
[D][uart_debug:158]: >>> "U\xAA\x00\x00\x00\x00\xFF"
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=0
[V][tuya:148]: MCU Heartbeat (0x01)
[V][tuya:383]: Sending Tuya: CMD=0x01 VERSION=0 DATA=[] INIT_STATE=1
[D][uart_debug:158]: <<< "U\xAA\x00\x00\x00\x01\x01\x01"
[C][uart.arduino_esp8266:102]: UART Bus:
[C][uart.arduino_esp8266:103]: TX Pin: GPIO15
[C][uart.arduino_esp8266:104]: RX Pin: GPIO13
[C][uart.arduino_esp8266:106]: RX Buffer Size: 256
[C][uart.arduino_esp8266:108]: Baud Rate: 9600 baud
[C][uart.arduino_esp8266:109]: Data Bits: 8
[C][uart.arduino_esp8266:110]: Parity: NONE
[C][uart.arduino_esp8266:111]: Stop bits: 1
[C][uart.arduino_esp8266:113]: Using hardware serial interface.
[C][tuya.cover:107]: Tuya Cover:
[C][tuya.cover:122]: Position has datapoint ID 101
[D][uart_debug:158]: >>> "U\xAA\x00\x01\x00\x00\x00"
[V][tuya:120]: Received Tuya: CMD=0x01 VERSION=0 DATA=[58.53.37.36.42.59.35.51.31.75.4B.4F.36.67.6A.43.31.2E.30.2E.30 (21)] INIT_STATE=1
[V][tuya:383]: Sending Tuya: CMD=0x02 VERSION=0 DATA=[] INIT_STATE=2
[D][uart_debug:158]: <<< "U\xAA\x00\x01\x00\x15XS76BY5Q1uKO6gjC1.0.0\xC5"
[D][uart_debug:158]: >>> "U\xAA\x00\x02\x00\x00\x01"
[V][tuya:120]: Received Tuya: CMD=0x02 VERSION=0 DATA=[] INIT_STATE=2
[V][tuya:201]: Configured WIFI_STATE periodic send
[D][tuya:456]: Sending WiFi Status
[V][tuya:383]: Sending Tuya: CMD=0x03 VERSION=0 DATA=[03] INIT_STATE=3
[D][uart_debug:158]: <<< "U\xAA\x00\x02\x00\x00\x01"
[C][tuya:033]: Tuya:
[C][tuya:038]: Configuration will be reported when setup is complete. Current init_state: 3
[C][tuya:041]: If no further output is received, confirm that this is a supported Tuya device.
[D][uart_debug:158]: >>> "U\xAA\x00\x03\x00\x01\x03\x06"
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=3
[D][uart_debug:158]: >>> "U\xAA\x00\x00\x00\x00\xFF"
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=3
[V][tuya:148]: MCU Heartbeat (0x01)
[D][uart_debug:158]: <<< "U\xAA\x00\x00\x00\x01\x01\x01"
[V][tuya:383]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=3
[D][uart_debug:158]: >>> "U\xAA\x00\x00\x00\x00\xFF"
[V][tuya:120]: Received Tuya: CMD=0x00 VERSION=0 DATA=[01] INIT_STATE=3
[V][tuya:148]: MCU Heartbeat (0x01)
[D][uart_debug:158]: <<< "U\xAA\x00\x00\x00\x01\x01\x01"
Similar issue with BCM700D-TY01 curtain motor.
Previously I was connecting an esp in parallel to the existing chip (WBR1-IPEX) There, it seems the MCU was initialized correctly (afaik), at least the esp received and showed the datapoints correctly. (101 for position, 102 for control), even if the stop, up, down values are mixed up..
Once I removed the original chip and only kept the ESP however I do not receive anything from the MCU anymore, however I can still control it by sending values to the datapoints... Debugging shows me a similar issue to the issue above:
[15:48:59][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF [15:48:59][D][uart_debug:114]: <<< 55:AA:00:00:00:01:01:01
"Configuration will be reported when setup is complete. Current init_state: 3"
Any chance that this can get addressed at some point?
The problem
I have a WiFi Temperature and Humidity sensor (this one, the wifi version) with a Tuya MCU and a CB3S. I swapped out the CB3S for an ESP12-e and loaded ESPHome onto it, but the Tuya initialization gets stuck at init_state 3.
I've done more investigation based on the data on these pages: one, two, three.
Seems like everything is working as it should up until step 3, "Query working mode of the module". ESPHome sends
55:AA:00:02:00:00:01
as it should, but the MCU just echoes it back, which is not (as far as I can tell) one of the allowed responses. From the pages linked earlier, the MCU should only be able to respond with either55 aa 03 02 00 00 04
(for "coordinated processing mode of the MCU and the module", whatever that means) or55 aa 03 02 00 02 05 00 0b
(for "self-processing mode of the module", again, whatever that means).Am I missing something here? Is this actually allowed but it means something else?
After that, ESPHome sends a command which I can't find a reference for anywhere:
55:AA:00:03:00:01:03:06
. Not sure what this means, but after that the MCU requests a functional test by responding with55:AA:00:07:00:00:06
, which ESPHome appears to just ignore since the next thing it sends is55:AA:00:00:00:00:FF
.After that, ESPHome just goes back to sending
55:AA:00:00:00:00:FF
over and over again, with no response until the MCU powers on again, at which point it responds with55:AA:00:00:00:01:01:01
. This pointed me to this page which refers to a bluetooth mode.So it seems like on first startup it behaves in wifi mode as expected until ESPHome sends a command it doesn't recognize, but then the next time it powers on it tries to go into some kind of bluetooth mode?
One other thing that I noticed is that the version string decodes into
{"p":"q29ebws5adwye1l8","v":"1.0.0"}
which, importantly (I think?) is missing them
(mode) attribute. Could that be part of the problem?Which version of ESPHome has the issue?
2022.6.2
What type of installation are you using?
Docker
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
ESP12-E
Component causing the issue
Tuya
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response