Need to give the possibility for another person to be able to update Wifi credentials or change Wifi SSID without having access to registered (claimed) devices Particle account.
I am open to read about some workaround or low cost solutions.
I just read this information about need to be connected and is not working in listening mode
I contacted the Particle support few days agos and I can’t receive a good answer and for this reason I start this thread. I want to ear about others peoples like me how you deal with the Wifi of your customers when Wifi is changing ? You not drive in the field to fix the problem right ?
I think that could be key: when connecting... so if the Argon was connected to a wifi router at some point and this router changed config, the device will be in connecting mode.
Hence, this can work with your devices, if let's say you configured them once when you tested them for the first time (with your home router). Then you ship it to a customer, the Argon comes up, NOT in listening mode, but it will go in connecting mode (searching for your home wifi) and it will not be able to connect to it. So if the lib works in this state, you might be good to go.
Reading the docs, I hope "when the argon is connecting" maps to this device mode Looking for Internet.
I fear that if @Dan-Kouba meant this device mode instead: Connecting to the Cloud things can get... complicated.
Dan, I have tried with other devices and the results are the same. The library only works if the Argon is connected to a Wifi already (pulsing Cyan). I will play around a bit on my side but wont get my hopes up. This would be a game changer should we be able to perform WiFi setup from any mode.
I guess one way out of this would be:
set the wifi of the device to something any customer can create a hotspot for. Example: ssid=mywifi passwd=password
(I think that setting above can be done in code even - add wifi credentials)
tell the customer to create a hotspot on their phone with that info: mywifi/password
then the customer can open the web page (provided by the library) on a computer or an app (that will need to be created) that will connect via Bluetooth to the Argon
once connected, the customer can set the new wifi ssid and password
the device resets
we all cross fingers
the device connects to the cloud
we all celebrate!
I imagine something like the above has chances of working. But it needs to be tested.
Gustavo.
Hey guys, great discussion here. Just wanted to chime in and add my notes:
Since the library runs in the user loop, and requires setup() to be run beforehand, it falls under the same restrictions that any user code does. If you are using your Argon in Automatic mode, the user loop won’t run until the device is connected, meaning my library will not allow setup of WiFi credentials until that process completes.
Gustavo, your solution should work, but I believe the simplest solution is to run the device in Manual mode and manage the initial connectivity states on your own. That would allow for my library code to operate regardless of connectivity state.
Here is my test about your library and btw thanks in advance.
I erased all Wifi credentials on my Argon
I created a dummy firmware using exaclty your code file “automatic_mode_example.ino” and flashed
Using your page Web BLE Argon Setup Example I was able to find my Argon using my Android phone and I paired together.
Launching the Scan networks and find one of my Networks, I set credentials Wifi.
At this moment, the Argon was again in listerning mode, I hit reset button and the Argon breathing blue cyan, mean connected. Right !
My second test was to disable my Wifi network. From my Unify, I disabled the Wifi Network and the Argon starting to blink green. I repeated the step 3, paired my Argon but when I Scan for Networks, nothing append.
You can see the attachment and the serial log here.
By this test I wanted to simulate when a Wifi networks is lost, not available or password changed.
Let me know if your library can done this kind of use case.
[Disconnected]
[Connected]
0000023219 [system] WARN: Failed to load session data from persistent storage
0000039381 [wiring.ble] TRACE: Connected by Central device.
0000039472 [system.ctrl.ble] TRACE: Connected
0000047503 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000047503 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000047504 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000047505 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000049931 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000049932 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000097002 [wiring.ble] TRACE: Disconnected by remote device.
0000097049 [system.ctrl.ble] TRACE: Disconnected
0000130735 [system] ERROR: sock_send returned -1 118
0000130735 [comm.dtls] WARN: mbedtls_ssl_write returned ffffffff
0000130739 [comm.protocol] ERROR: Event loop error 3
0000130739 [system] WARN: Communication loop error, closing cloud socket
0000145765 [hal] WARN: Unable to parse AP info
0000151975 [hal] WARN: Unable to parse AP info
0000158190 [hal] WARN: Unable to parse AP info
0000175221 [wiring.ble] TRACE: Connected by Central device.
0000175247 [system.ctrl.ble] TRACE: Connected
0000178631 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000178632 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000178632 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000178633 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000184333 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000184334 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000193256 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000193257 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000193257 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000193258 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000196768 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000196768 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000210176 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000210176 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000210177 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000210178 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000215417 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000215417 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000221021 [wiring.ble] TRACE: Disconnected by remote device.
0000221066 [system.ctrl.ble] TRACE: Disconnected
0000226464 [wiring.ble] TRACE: Connected by Central device.
0000226466 [system.ctrl.ble] TRACE: Connected
0000232496 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000232496 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000232497 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000232498 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000234068 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000234069 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000254950 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000254951 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000254951 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000254952 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000257155 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000258933 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000258933 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000258934 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000258935 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000258935 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000258936 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000258937 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000259585 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000259586 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000259586 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000259587 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000260170 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000261385 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000263050 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000263635 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000265149 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000265149 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000265150 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000265151 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000265151 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000265152 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000265153 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000265153 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000265154 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000265154 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000265155 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000265156 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000265156 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000265157 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000265158 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000265158 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000265159 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000265159 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000265160 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000265161 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000265161 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000265162 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
[Disconnected]
[Connected]
0000007215 [wiring.ble] TRACE: Connected by Central device.
0000007294 [system.ctrl.ble] TRACE: Connected
0000010548 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000010549 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000010549 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000010550 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000012503 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000012503 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000037683 [wiring.ble] TRACE: Disconnected by remote device.
0000037696 [system.ctrl.ble] TRACE: Disconnected
0000042555 [wiring.ble] TRACE: Connected by Central device.
0000042601 [system.ctrl.ble] TRACE: Connected
0000046232 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000046233 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000046234 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000046234 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000049831 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000049831 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
0000103607 [wiring.ble] TRACE: Disconnected by remote device.
0000103620 [system.ctrl.ble] TRACE: Disconnected
0000120594 [wiring.ble] TRACE: Connected by Central device.
0000120627 [system.ctrl.ble] TRACE: Connected
0000122299 [app.BLEWiFiSetupManager] TRACE: Added message to the queue: {"msg_type":"scan"}
0000122299 [app.BLEWiFiSetupManager] TRACE: State Transition: 1 -> 2
0000122300 [app.BLEWiFiSetupManager] TRACE: String RX: {"msg_type":"scan"}
0000122301 [app.BLEWiFiSetupManager] INFO: key=msg_type value=scan
0000124432 [app.BLEWiFiSetupManager] INFO: WiFi Scan Complete
0000124432 [app.BLEWiFiSetupManager] TRACE: State Transition: 2 -> 1
The goal would be to check if this will make work your second case:
You mentioned in that case nothing happened, so I wonder if there is a hotspot to which the argon can temporarily connect to, when you scan for networks you will get results.