particle-cli icon indicating copy to clipboard operation
particle-cli copied to clipboard

Improve Wi-Fi Setup Experience

Open keeramis opened this issue 1 year ago • 1 comments

Description

This PR introduces the new particle wifi xxx commands.

  • These commands are not supported on the following and the appropriate error messages are given
    • All Gen2 devices
    • All Gen3 cellular only devices

particle wifi add

  • Adds a wifi network to the device's filesystem
  • Does not connect to the network
  • Command supported starting 5.8.2 and 6.2.0

particle wifi join

  • Joins a new network or an existing known network with --ssid flag
  • Command supported starting device-os 0.9.0?

particle wifi list, particle wifi clear, particle wifi remove, particle wifi status

  • Command supported starting device-os 0.9.0?

In all the above cases, if a particular command is not supported on a given firmware version, a relevant error is returned.

How to Test

Run npm install which will have the latest necessary changes

Test away a wifi or non-wifi device

For the particle wifi add to work, use this device-os PR - https://github.com/particle-iot/device-os/pull/2763

Related Issues / Discussions

  • Particle-USB release 2.10.1
  • Device-OS https://github.com/particle-iot/device-os/pull/2763
  • Doc: https://www.notion.so/particle/CLI-Improved-WiFi-Configuration-8a2ee199e4484b428e0ee0c9b26d219a

Completeness

  • [x] User is totes amazing for contributing!
  • [ ] Contributor has signed CLA
  • [ ] Problem and solution clearly stated
  • [ ] Tests have been provided
  • [ ] Docs have been updated
  • [ ] CI is passing

keeramis avatar May 24 '24 11:05 keeramis

Hi @monkbroc @hugomontero! I updated this PR to have the necessary functionality in place. I added the right errors and briefly tested some scenarios with Hugo. If you could kindly test this, that'd be great for initial feedback. I am working on unit tests and e2e tests.

keeramis avatar May 24 '24 11:05 keeramis

This PR is ready for review @monkbroc @hugomontero 🙇

The tests fail with a Test file busy error as if the build was not found for ubuntu-latest

keeramis avatar Jun 03 '24 22:06 keeramis

I didn't get an error on wifi add on an Argon on 5.8.1

$ particle.js wifi add
? Would you like to scan for Wi-Fi networks? Yes
? Select the Wi-Fi network with which you wish to connect your device: bunker
? Wi-Fi Password xyz
Wi-Fi network 'bunker' added successfully.
To join this network, run particle wifi join --ssid <SSID>

monkbroc@beast:~/Programming/cli$ particle.js identify
Your device id is e00fce68a97a9afad515ab96
Your system firmware version is 5.8.1

monkbroc avatar Jun 04 '24 14:06 monkbroc

@monkbroc May you have a 5.8.1 based develop branch that has this control request working? CLI looks for Not supported error from the device-os.

I quickly tested on mine:

keerthyamisagadda@loaners-macbook-pro particle-cli (feature/wifi-improvements) $ npm start -- wifi add --file creds.json 

> [email protected] start
> node ./src/index.js wifi add --file creds.json

Unable to add Wi-Fi network 'D49-10': Not supported
This feature is likely not supported on this firmware version.
Update to device-os 6.2.0 or use 'particle wifi join --help' to join a network.
Alternatively, check 'particle serial wifi'.

keerthyamisagadda@loaners-macbook-pro particle-cli (feature/wifi-improvements) $ npm start -- serial identify

> [email protected] start
> node ./src/index.js serial identify

Your device id is e00fce6819ef5f971ea9563a
Your system firmware version is 5.8.0

keeramis avatar Jun 04 '24 14:06 keeramis

Indeed. I reflashed with 5.8.1 from the cloud and get the expected error :+1:

monkbroc avatar Jun 04 '24 15:06 monkbroc

I am merging this PR unless I hear otherwise

keeramis avatar Jun 04 '24 15:06 keeramis