Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Temporarily Solved] Timed out while waiting for the device to (re)connect #1022

Closed
stulluk opened this issue Jan 7, 2022 · 17 comments
Closed

Comments

@stulluk
Copy link

stulluk commented Jan 7, 2022

Solution: I managed to install tasmota to all my Neo Wifi PowerPlug by using Rpi4b-4Gbyte model and with very old Debian 10.10 image. Newer ( bullseye ) images don't work. See last comments below.

Device: NEO COOLCAM WIFI PLUG EU : http://www.szneo.com/en/products/show.php?id=215
PC: Intel NUC with Ubuntu 21.04 focal (With built-in WIFI adapter)

Here is the failure:

ubuntu@ubuntu:~/tuya-convert$ rfkill unblock wifi && ./start_flash.sh 
tuya-convert v2.4.5
Checking for network interface wlp0s20f3... Found.
Checking UDP port 53... Occupied by systemd-resolve with PID 4769.
Port 53 is needed to resolve DNS queries
Do you wish to terminate systemd-resolve? [y/N] y
Attempting to stop systemd-resolved.service
Checking UDP port 67... Available.
Checking TCP port 80... Available.
Checking TCP port 443... Available.
Checking UDP port 6666... Available.
Checking UDP port 6667... Available.
Checking TCP port 1883... Available.
Checking TCP port 8886... Available.
======================================================
  Starting AP in a screen.
  Starting web server in a screen
  Starting Mosquitto in a screen
  Starting PSK frontend in a screen
  Starting Tuya Discovery in a screen

======================================================

IMPORTANT
1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
   This step is IMPORTANT otherwise the smartconfig may not work!
2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
   Make sure nothing else is plugged into your IoT device while attempting to flash.
3. Press ENTER to continue


======================================================
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.
Auto retry in 3s. ..................................................................................................................
Timed out while waiting for the device to (re)connect
======================================================
Attempting to diagnose the issue...
An ESP82xx based device connected according to your wifi log.
If this is the device you are trying to flash, another issue may be preventing it from flashing.
Otherwise, it could be that the device does not use an ESP82xx or it did not connect.
For additional information, check the *.log files inside the scripts folder.
Please include these logs when opening a new issue on our GitHub issue tracker.
======================================================
Do you want to try flashing another device? [y/N] y
======================================================

IMPORTANT
1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
   This step is IMPORTANT otherwise the smartconfig may not work!
2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
   Make sure nothing else is plugged into your IoT device while attempting to flash.
3. Press ENTER to continue


======================================================
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.
Auto retry in 3s. ..................................................................................................................
Timed out while waiting for the device to (re)connect
======================================================
Attempting to diagnose the issue...
An ESP82xx based device connected according to your wifi log.
If this is the device you are trying to flash, another issue may be preventing it from flashing.
Otherwise, it could be that the device does not use an ESP82xx or it did not connect.
For additional information, check the *.log files inside the scripts folder.
Please include these logs when opening a new issue on our GitHub issue tracker.
======================================================
Do you want to try flashing another device? [y/N] y
======================================================

IMPORTANT
1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
   This step is IMPORTANT otherwise the smartconfig may not work!
2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
   Make sure nothing else is plugged into your IoT device while attempting to flash.
3. Press ENTER to continue


======================================================
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
======================================================
Attempting to diagnose the issue...
An ESP82xx based device connected according to your wifi log.
If this is the device you are trying to flash, another issue may be preventing it from flashing.
Otherwise, it could be that the device does not use an ESP82xx or it did not connect.
For additional information, check the *.log files inside the scripts folder.
Please include these logs when opening a new issue on our GitHub issue tracker.
======================================================
Do you want to try flashing another device? [y/N] N
======================================================
Cleaning up...
Closing AP
Exiting...
ubuntu@ubuntu:~/tuya-convert$

Logs:
smarthack-mqtt.log
smarthack-psk.log
smarthack-udp.log
smarthack-web.log
smarthack-wifi.log

About 1 year ago, I succesfully converted 3 units ( exactly same model ) with tuya-convert. But now, I can not (tried on brand new two units, both failed)

I allways get this same error message:
Timed out while waiting for the device to (re)connect

What I tried:

  • Use different computer with a RTL8812BU USB WIFI adapter
  • Use a Khadas Edge Arm64 linux SBC with builtin WIFI module
  • killall wpa_supplicant
  • modify scripts to stop network manager ( systemctl stop NetworkManager for ubuntu ) correctly
  • Move WIFI PLUG's to another place / room
  • Change WIFI channel to 5 or 6 in hostapd.conf
  • Register both samples to original TUYA mobile app, smoke test to make sure they work correctly

Ready to provide more logs if necessary.

What are your suggestions ?

@MacSass
Copy link

MacSass commented Jan 9, 2022

Sorry, I don´t have any suggestions for a solution - but the same issue I think.
I have 5 Maxcio plugs, bought at the same time. 2 I could flash with no problem - 3 I´m not able to flash and stuck at:

SmartConfig complete.
Auto retry in 3s. ..................................................................................................................
Timed out while waiting for the device to (re)connect
======================================================
Attempting to diagnose the issue...
An ESP82xx based device connected according to your wifi log.
If this is the device you are trying to flash, another issue may be preventing it from flashing.
....

The devices go from blinking fast to a state where they either do nothing (no blinking) or they switch the relay about avery 2 minutes ...

For troubleshooting I tried to connect one of them to the official Tuya cloud - which worked right away with no problem (and rendered the device unflashable due to immedeate firmware update - now that one errors out with "firmware is to new...", which is expected).
So now I have 2 plugs left that I´m not able to flash and that just get stuck. I tried to connect a iPhone, an Android phone and even a Windows PC to the vtrust-flash, but that did not make any difference ...

Attached my logs from one try - but I can´t find out from them why the flash does not proceed ...
smarthack-mqtt.log
smarthack-psk.log
smarthack-udp.log
smarthack-web.log
smarthack-wifi.log

Any help would be highly appreciated ... thanks.

@stulluk
Copy link
Author

stulluk commented Jan 9, 2022

@MacSass I looked at your WIFI and WEB logs, they are pretty similar to mine.

Somehow, device starts getting "upgrade.bin" ( What is that binary by the way? ) and then just starts over and over again. In your case, I see some other weird files, such as "connecttest.txt" and "wpad.dat" ( What are they ? )

I wish there has been a clear sequence diagram in this repository ( I am volunteer to write & document it ) to explain how it works, how it mocks tuya's server to intercept upgrade process, what are the contents of this repository, what to do when it fails ( an extensive troubleshooting section )

I hope authors might have a look at our logs, and give us some advices.

@MacSass
Copy link

MacSass commented Jan 9, 2022

Hi @stulluk, thanks for looking at those ...
I suspect(!!!) that upgrade.bin might the intermediate firmware that get´s flashed on the devices and then connects to vtrust-flash for the next steps ...
That´s just what I suspect, unfortunately I´m not savy enough to understand the scripts, but would agree that a kind of "flow" of what happens when, with some explanation of the outputs of the steps would be very helpful to better understand what his going on.

Let´s see if one of the authers finds the time to throw in some breadcrumbs for us to help us understand better ...

PS: I will check my logs for "upgrade.bin", the "doing it over and over" might explain why I´m hearing the device flipping the relay periodically about every 1-2 minutes ...

@MacSass
Copy link

MacSass commented Jan 10, 2022

Hi, just fyi: I tried the pycryptodomex downgrade mentioned here: #1013 (comment)
just to see if that makes any difference for "our" issue - but for me it does not - it stays exactly the same ...

@MacSass
Copy link

MacSass commented Jan 13, 2022

I tried the change mentioned here: #1023 but that did not make a difference, still can´t get my devices flashed.
I´m not sure what is going on - from my understanding it is waiting for the device to re-connect with IP 10.42.42.42 which does not seem to happen.

Also I do not understand the full flow but the rough steps for me seem to be something like:

  • Create AP with SSID vtrust-flash (done by scripts/setup_ap.sh)
  • Create fake update webserver to deliver the upgrade files to the device later (done by scripts/fake-registration-server.py)
  • Have user connect any device like mobile phone (not sure what this is used for later)
  • Broadcast / Multicast specially structured packets to network broadcast address and device addresses (done by scripts/smartconfig/main.py and the other scripts in same folder)
  • Wait for iot device to connect to vtrust-flash with IP 10.42.42.42 (which does not seem to happen for us) - (monitored by start_flash.py)
  • Install intermediate firmware upgrade.bin???? (not sure). I guess intermediate FW allows to backup orginal and takes the command to install the selected final firmware file (via curl in firmware_picker.sh)
  • Backup original firmware
  • Flash e.g. tasmota-minimal.bin to device (via curl in firmware_picker.sh)

I might have a lot wrong and incomplete - would be great if someone who has more knowledge could look into the issue or provide some more hints what to do ...

@infocfc
Copy link

infocfc commented Jan 19, 2022

Looks like exactly the same issue current Raspberry images have.
#999 (comment)

Which isn't too surprising that you see the same issue on Ubuntu.

@kintel
Copy link

kintel commented Feb 13, 2022

I had exactly the same problem on Ubuntu 21.10 on an Asus chromebook SN60. After finding this ticket, I tried again on an RPi4 running Debian 10.10 and it worked on first try!

@stulluk
Copy link
Author

stulluk commented Feb 13, 2022

I had exactly the same problem on Ubuntu 21.10 on an Asus chromebook SN60. After finding this ticket, I tried again on an RPi4 running Debian 10.10 and it worked on first try!

Thank you so much for your feedback. I currently don't have a ready NEO device at hand, but I will try when I get with my RPi4b.

@stulluk
Copy link
Author

stulluk commented Mar 7, 2022

I had exactly the same problem on Ubuntu 21.10 on an Asus chromebook SN60. After finding this ticket, I tried again on an RPi4 running Debian 10.10 and it worked on first try!

@kintel I get new NEO Wifi PowerPlugs. I have a Rpi4b-4Gbyte model at hand. But I can't find Debian 10.10 image for it. And with newer images ( Debian 11 ), this issue still persists.

Could you please provide the link, where do you download this Debian 10.10 image ?

Or, if you can't find, can you dump your SDcard image with Debian 10.10, and upload to gdrive, so I can download & try ?

@kintel
Copy link

kintel commented Mar 9, 2022

There are some older packages here: https://downloads.raspberrypi.org/raspios_arm64/images/
Not such exactly what versions they are, but some of them should be variations of Debian 10.x.

@stulluk
Copy link
Author

stulluk commented Mar 9, 2022

There are some older packages here: https://downloads.raspberrypi.org/raspios_arm64/images/ Not such exactly what versions they are, but some of them should be variations of Debian 10.x.

My bad. I installed this: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-05-28/2020-05-27-raspios-buster-arm64.zip on my Rpi4b -4Gbyte model, and it just worked out of the box !

I will write a blog post accordingly and provide ready made SDcard image for it.

Thank you @kintel !

@stulluk stulluk changed the title Timed out while waiting for the device to (re)connect [Temporarily Solved] Timed out while waiting for the device to (re)connect Mar 9, 2022
@stulluk
Copy link
Author

stulluk commented Mar 10, 2022

Here is the blog post for the ones interested: https://www.drejo.com/blog/neo-tuya-tasmota/

I hope this dependency issue with newer debian & ubuntu issues will be fixed in this repository.

@stulluk stulluk closed this as completed Mar 10, 2022
@kintel
Copy link

kintel commented Mar 10, 2022

Awesome!

@tfcarlin
Copy link

This worked for me as well with a SWB1: [https://www.amazon.com/dp/B07MFTRMM3?psc=1&ref=ppx_yo2ov_dt_b_product_details]

@Bulwagga
Copy link

Bulwagga commented Jan 6, 2023

I had similar issues trying to install from Bullseye and Ubuntu 22.10. I flashed a minimal Buster environment, installed tuya-convert, and my XS-SSA06 flashed within seconds. Thank you!

@KiralyCraft
Copy link

Same here, I used 2020-05-27-raspios-buster-armhf.img on my 3B+ and it worked instantly. Follow stulluk's guide, it worked wonders. On Bullseye it just kept disconnecting the device from the AP, but on buster it worked. Strange, here's to another dump of the SSD :)

@zionusxx
Copy link

Raspberry Pi 4b with Raspberry Pi OS (Bullseye):

I had an issue with flashing a device because mosquito did not work.
With a configuration file mosquito.conf with those settings it did work:
bind_address 0.0.0.0
allow_anonymous true

Bevor that, it did not bind to the wifi interface and did not allow anonymous login.

#1128

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

No branches or pull requests

8 participants