particle-iot / particle-cli

Command Line Interface for Particle Cloud and devices
Apache License 2.0
212 stars 92 forks source link

particle serial wifi --file doesn't work for P2 on 3.21.0 when there are no credentials before #717

Open Ivan-Stemy opened 6 months ago

Ivan-Stemy commented 6 months ago

Description

particle serial wifi --file doesn't work for P2 on 3.21.0 when there are no credentials before

Steps to reproduce

Since the update 3.21.0 whenever I try to insert credentials into a P2 from a json file, the same json as the one I have always successfully used, it fails in the same manner:

  1. Have any Operating system and bootloader installed on the P2. I've tried 5.3.1 (the one I've used for months) and the latest (5.7.0). I've also tried my own firmware and the tinker firmware. Also, don't have any credentials into the device yet, as it always works fine when there are.
  2. Go into listening mode, now commands such as particle serial identify are working correctly, even particle serial wifi which let's me discover and get connected to a network succesfully.
  3. Input particle serial wifi --file "credentials.json" with a file that worked previously with the format: { "network": "my_network", "security": "WPA2_AES", "password": "my_password" }

Expected result

Done! Your device should now restart.

Actual result

the command instantly goes into "Joining Wi-Fi network 'my_network'" and less than half a second later it says "Joining Wi-Fi network 'my_network' is taking longer than expected.". I don't think 0.1 seconds is supposed to be loger than expected.

After a while it returns: "Unable to join Wi-Fi network: Invalid state" in red.

This has happened in every single P2 I have, I've tried 5 with the same results. I also have P1s and they keep working fine.

Environment

Tell us about your setup: