{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1024","repository_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1024/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1024/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1024/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1024","id":132121381,"number":1024,"title":"enduser_setup does not seem to honor failed wifi authentication after one successful WiFi connection","user":{"login":"vishwaraj00","id":7369612,"avatar_url":"https://avatars.githubusercontent.com/u/7369612?v=3","gravatar_id":"","url":"https://api.github.com/users/vishwaraj00","html_url":"https://github.com/vishwaraj00","followers_url":"https://api.github.com/users/vishwaraj00/followers","following_url":"https://api.github.com/users/vishwaraj00/following{/other_user}","gists_url":"https://api.github.com/users/vishwaraj00/gists{/gist_id}","starred_url":"https://api.github.com/users/vishwaraj00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishwaraj00/subscriptions","organizations_url":"https://api.github.com/users/vishwaraj00/orgs","repos_url":"https://api.github.com/users/vishwaraj00/repos","events_url":"https://api.github.com/users/vishwaraj00/events{/privacy}","received_events_url":"https://api.github.com/users/vishwaraj00/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-02-08T11:46:02Z","updated_at":"2016-02-11T18:28:08Z","closed_at":null,"body":"I have connected NodeMcu to WiFi by using enduser_setup module accessing the softAP in my Android device and entering SSID and password in the html setup page. I faced two situations afterwards:\r\n1: If the WiFi authentication fails, NodeMCU keeps retrying and does not connect to WiFi successfully.\r\n2: If the WiFi itself is out of reach or the device itself moves to a different WiFi zone, NodeMCU keeps trying and cannot find a valid WiFi SSID.\r\n\r\nIn both these cases, NodeMCU does not fall back to the original WiFi setup state. Hence, my device remains out of reach and the only solution seems like I need to re-flash, so that I can access the SoftAP and the html setup page.\r\n\r\nThis is the code I used for enduser_setup:\r\n\r\n```\r\nenduser_setup.start(\r\n   function()\r\n        print(\"Connected to wifi as:\" .. wifi.sta.getip())\r\n   end,\r\n   function(err, str)\r\n        print(\"enduser_setup: Err #\" .. err .. \": \" .. str)\r\n   end\r\n);\r\n```\r\nThis is the relevant code, which I even tried to look at [But I couldn't get much]:\r\nhttps://github.com/nodemcu/nodemcu-firmware/blob/c8037568571edb5c568c2f8231e4f8ce0683b883/app/modules/enduser_setup.c\r\n"},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/182996132","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/1024#issuecomment-182996132","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/1024","id":182996132,"user":{"login":"robertfoss","id":523260,"avatar_url":"https://avatars.githubusercontent.com/u/523260?v=3","gravatar_id":"","url":"https://api.github.com/users/robertfoss","html_url":"https://github.com/robertfoss","followers_url":"https://api.github.com/users/robertfoss/followers","following_url":"https://api.github.com/users/robertfoss/following{/other_user}","gists_url":"https://api.github.com/users/robertfoss/gists{/gist_id}","starred_url":"https://api.github.com/users/robertfoss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertfoss/subscriptions","organizations_url":"https://api.github.com/users/robertfoss/orgs","repos_url":"https://api.github.com/users/robertfoss/repos","events_url":"https://api.github.com/users/robertfoss/events{/privacy}","received_events_url":"https://api.github.com/users/robertfoss/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T18:28:08Z","updated_at":"2016-02-11T18:28:08Z","body":"So NodeMCU will only every try to connect to the last WiFi it was set to\nconnect to. If you move the NodeMCU to a location where the old wifi is no\nlonger available and you want it to connect to a new WiFi, you will have to\nmake sure that enduser_setup.start() is run _somehow_. Either run it\nmanually, or make sure the code is in init.lua and restart the NodeMCU\nboard.\n\nOn Thu, Feb 11, 2016 at 1:23 PM, Vishwaraj Anand <notifications@github.com>\nwrote:\n\n> I didn't know about this init.lua thing. But, if I put the same code in\n> init.lua then won't it ask for WiFi credentials everytime NodeMCU has been\n> restarted? I wanted the password to be asked only when the credentials that\n> are already entered are not working for connecting to any WiFi successfully.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/nodemcu/nodemcu-firmware/issues/1024#issuecomment-182990470>\n> .\n>\n"}}