{"action":"created","issue":{"url":"https://api.github.com/repos/spark/firmware/issues/574","labels_url":"https://api.github.com/repos/spark/firmware/issues/574/labels{/name}","comments_url":"https://api.github.com/repos/spark/firmware/issues/574/comments","events_url":"https://api.github.com/repos/spark/firmware/issues/574/events","html_url":"https://github.com/spark/firmware/issues/574","id":102565550,"number":574,"title":"[Photon] `WiFi.setCredentials` only works for networks currently in range?","user":{"login":"pomplesiegel","id":1450352,"avatar_url":"https://avatars.githubusercontent.com/u/1450352?v=3","gravatar_id":"","url":"https://api.github.com/users/pomplesiegel","html_url":"https://github.com/pomplesiegel","followers_url":"https://api.github.com/users/pomplesiegel/followers","following_url":"https://api.github.com/users/pomplesiegel/following{/other_user}","gists_url":"https://api.github.com/users/pomplesiegel/gists{/gist_id}","starred_url":"https://api.github.com/users/pomplesiegel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pomplesiegel/subscriptions","organizations_url":"https://api.github.com/users/pomplesiegel/orgs","repos_url":"https://api.github.com/users/pomplesiegel/repos","events_url":"https://api.github.com/users/pomplesiegel/events{/privacy}","received_events_url":"https://api.github.com/users/pomplesiegel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spark/firmware/milestones/10","html_url":"https://github.com/spark/firmware/milestones/0.4.5","labels_url":"https://api.github.com/repos/spark/firmware/milestones/10/labels","id":1208605,"number":10,"title":"0.4.5","description":"","creator":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":15,"state":"open","created_at":"2015-07-15T06:12:08Z","updated_at":"2015-08-22T21:15:20Z","due_on":"2015-09-01T22:00:00Z","closed_at":null},"comments":3,"created_at":"2015-08-22T20:38:08Z","updated_at":"2015-08-22T21:16:14Z","closed_at":null,"body":"While Photon was connected to our office network, I called `WiFI.setCredentials()` to hard-code a customer's WiFi creds into it before it went to the customer's home. \r\n\r\nFollowing `setCredentials` our code running in `SYSTEM_MODE(MANUAL)` calls \r\n\r\n````cpp\r\n  WiFi.off();\r\n  delay(500);\r\n  WiFi.on();\r\n  WiFi.connect();\r\n  Spark.connect();\r\n````\r\n\r\nAt this point it disconnects (flashing green), then connects back to the office network (still stored), as the new customer creds do not represent a network currently in range.\r\n\r\nHowever, when the Photon was put in range of the customer's AP, it still did not connect (instead flashing green). When the customer mimicked our office network using an iPhone hotspot and I again called  `WiFI.setCredentials()`with the network in range, it successfully connected to the customer's AP. \r\n\r\nDoes the Photon ignore/erase creds if they do not work upon the first try? "},"comment":{"url":"https://api.github.com/repos/spark/firmware/issues/comments/133755352","html_url":"https://github.com/spark/firmware/issues/574#issuecomment-133755352","issue_url":"https://api.github.com/repos/spark/firmware/issues/574","id":133755352,"user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"created_at":"2015-08-22T21:16:14Z","updated_at":"2015-08-22T21:16:14Z","body":"If you pull `develop` you'll be able to call\r\n```\r\n WiFi.setCredentials(\"ssid)\",4,\"password\", 8, WPA2, WLAN_CIPHER_AES);\r\n```\r\nWhich doesn't scan the network to find the cipher, so the AP can be added offline.\r\n"}}