WiFi.clearCredentials() not clearing credentials

On a Photon with firmware v0.4.5, the following code does not clear wifi credentials, yet always claims success by printing 1:

void setup() {

Since the mode is AUTOMATIC, every time I restart the firmware a connection to the cloud is somehow established, but I would expect this to fail and enter listening mode after the first restart.

Any ideas why this continues to connect?

I just tested this and after resetting credentials, the device doesn’t connect to WiFi as expected.

Can you provide some more info:

  • how many WiFI APs do you have registered with the device?
  • is there a WiFi.setCredentials() call in your application?
  • can you retry by clearing credentials manually (Press setup for 10 seconds), reconfigure WiFi and retry the application.

Thanks, :slight_smile:

Strange, I’ve only ever had it connected it to one network, but it could be that I’d called setCredentials manually at some point during testing. Could it have saved multiple entries for the same network?

  • How would I determine the number of registered APs? It should just be 1, or at least 1 that I can presently connect to.
  • No, though there might have been at one time.
  • This works to delete the credentials.

Now that I’ve manually erased the creds, I’ll retry the snippet I posted above and see if that works.

Ok, I went through the steps to erase credentials manually and reconfigure it and everything now works as expected. After running the snippet above and resetting, the firmware enters listening mode. I’m not sure what went wrong the first time I tried this.

Thanks, I’ll double-check the code to be sure there aren’t any hidden bugs.