How I fixed tuya-convert Nous A1 SmartConfig complete. Resending SmartConfig Packets loop

Problem:

While trying to flash a device using tuya-convert, you see an error message like

======================================================
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID                  vtrust-flash
Sending wifiPassword          
Sending token                 00000000
Sending secret                0101
................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
................
SmartConfig complete.
Resending SmartConfig Packets
..............
Timed out while waiting for the device to (re)connect

and the flash procedure fails.

Solution

You can see the actual error log in scripts/smarthack-psk.log. In my case the error was the one described in our previous post How I fixed tuya-convert Nous A1 could not establish sslpsk socket: [SSL: NO_SHARED_CIPHER] no shared cipher

The current version of ./install_reqs.sh does not install the sslpsk module correctly (the error message is somewhat hidden at the top of the log). Install it manually using

sudo -H python3 -m pip install --upgrade sslpsk