8000
Skip to content

Conversation

@thekeymeister
Copy link
Contributor
@thekeymeister thekeymeister commented Oct 26, 2025

Description:

If an MCU initiated WiFi reset is carried out on some Tuya devices, the MCU will not respond to any commands from Tasmota until it has determined a cloud connection has been established. This also occurs during initial setup of the device. At present, Tasmota will reset the WiFi settings, but doesn't give the MCU the status updates it expects, essentially soft locking it.

This will initially ACK the WIFI_RESET/WIFI_SELECT by sending a WIFI_STATE with an empty payload.

It then establishes the requested pairing mode from the received WIFI_RESET/WIFI_SELECT (0x00 = EZ mode, 0x01 = AP mode)

WIFI_STATEs are then sent to simulate the process of establishing a connection to Tuya servers, in the following order.

0x00 (Entered EZ pairing mode) or 0x01 (Entered AP pairing mode)
0x02 (Configured, but not connected)
0x03 (Router connected)
0x04 (Cloud connected)

Upon completion, the MCU is satisfied that a connection is established, and will allow control of the MCU via Tasmota. Without this, the device can be stuck and essentially becomes 'listen only'. We then continue with the existing functionality of resetting the current Tasmota WiFi settings.

As well as properly handling the WiFi reset procedure, this allows for initial setup to be done without ever having to connect to a Tuya server.

I've tested this on two YH002 blind motors (module swapped WBR3 to ESP-12S) - one previously used, one brand new out of the box. Both working fine. I've been unable to test with an ESP32 device as I haven't got any.

Related issue (if applicable):

I never formally created an issue, but my comment on this page explains the initial issue.
Basically, my 5 year old pressed some buttons on my Zemismart YH002 blind motor which started the WiFi reset procedure, and the device stopped responding to all commands from Tasmota, and would only report changes in position that were initiated by button presses on the unit itself.

I saw a post suggesting ESPhome may have handled this situation so moved these across to that in hope, however that didn't work for me either, so I delved deeper to fix the underlying issue. I've already had a PR merged for the same for ESPhome here, I felt it made sense to try and implement a fix here too.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.4
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

… MCU pairing logic

When WIFI_SELECT or WIFI_RESET is received, this sends a WIFI_STATE ramp 0x00/0x01 up to 0x05 to simulate successful WiFi connection up to 'cloud connected' to exit pairing mode and reallow Tasmota control of the MCU
@thekeymeister thekeymeister marked this pull request as ready for review October 26, 2025 15:05
Co-authored-by: Erik Kunze <eku@users.noreply.github.com>
@arendst arendst merged commit 890b3b6 into arendst:development Oct 27, 2025
Copy link
Contributor
@sfromis sfromis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last change 462d40d breaks the code, as removing the if leaves the ending "}" from the else part unmatched.

@arendst
Copy link
Owner
arendst commented Oct 28, 2025

Will fix asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0