brandond / esphome-tuya_pir

ESPHome support for cheap WiFi PIR sensors
66 stars 21 forks source link

Messages out of order, so esphome times out and reboots. #21

Open pandabear41 opened 3 years ago

pandabear41 commented 3 years ago

Using the door sensor. It is different hardware packaging, but same MCU and Tuya module. The MCU is sending the messages out of order, so the ESP times out and reboots. Not sure why. To fix, on line 320 where we set state to SB1_STATE_BOOT_COMPLETE_ACK to SB1_STATE_RUNNING_NORMAL to just ignore last ACK and process the message. Any ideas why this is happening?

ESP -> MCU: 55 aa 00 01 00 00 00 MCU -> ESP: 55 AA 00 01 00 24 7B 22 70 22 3A 22 64 73 6D 6A 75 66 65 6D 7A 6F 63 63 33 33 6F 30 22 2C 22 76 22 3a 22 31 2e 30 2e 30 22 7d ae Text: Uª...${"p":"dsmjufemzocc33o0","v":"1.0.0"}. ESP -> MCU: 55 aa 00 02 00 01 02 04 MCU -> ESP: 55 aa 00 02 00 00 01 ESP ->MCU: 55 aa 00 02 00 01 03 05 MCU -> ESP: 55 aa 00 02 00 00 01 ESP -> MCU: 55 aa 00 02 00 01 04 06 MCU -> ESP: 55 AA 00 05 00 05 01 04 00 01 01 10 MCU -> ESP: 55 AA 00 05 00 05 03 04 00 01 02 13 MCU -> ESP: 55 AA 00 02 00 00 01