Bon j'ai enfin trouvé le problème, c'est quand il y a déjà une config wifi de ok que cela sortait automatiquement du setup wifi après la connexion. Maintenant avant de passer en setup wifi je vide la connexion wifi manuellement. Je dois encore sécuriser la demande de setup wifi pour ne pas le faire automatiquement en remote avec un code aléatoire
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
-- Petit script pour initaliser la couche WIFI
|
||||
|
||||
function wifi_init()
|
||||
print("\n wifi_init.lua zf200110.1956 \n")
|
||||
print("\n wifi_init.lua zf200111.1219 \n")
|
||||
|
||||
function wifi_init_end()
|
||||
wifi_init1:unregister() i=nil
|
||||
@@ -25,6 +25,7 @@ function wifi_init()
|
||||
file.remove("_setup_wifi_")
|
||||
print("setup wifi...")
|
||||
enduser_setup.start(function()
|
||||
print("on est sortit du setup wifi et on restart !")
|
||||
node.restart()
|
||||
end)
|
||||
print("setup wifi out...")
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<title>SonOff home page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>SonOff home page 200109.1940</h1>
|
||||
<h1>SonOff home page 2001011.1233</h1>
|
||||
<a href="/">Home...</a><br>
|
||||
<h2>Menu:</h2>
|
||||
<h3>
|
||||
|
||||
SonOff API LED
|
||||
<a href="api_sonoff.html?LED=on"> On</a>
|
||||
<a href="api_sonoff.html?LED=off"> Off</a><br>
|
||||
@@ -31,10 +33,13 @@
|
||||
end
|
||||
end
|
||||
if (_GET.SetupWIFI == "true") then
|
||||
--zout("<br><br>Choisir comme WIFI AP: setup_gadget puis aller sur: http://192.168.4.1<br><br>")
|
||||
print("On demande le setup wifi depuis le browser !")
|
||||
zout("<br><br>Choisir comme WIFI AP: setup_gadget puis aller sur: http://192.168.4.1<br><br>")
|
||||
file.putcontents("_setup_wifi_", "toto")
|
||||
file.putcontents("_toto_", "toto")
|
||||
tmr.create():alarm(3*1000, tmr.ALARM_SINGLE, function()
|
||||
tmr.create():alarm(5*1000, tmr.ALARM_SINGLE, function()
|
||||
print("on restart pour le setup wifi")
|
||||
wifi.sta.config{ssid="", pwd="", auto=true, save=true}
|
||||
wifi.sta.autoconnect(1) wifi.sta.connect()
|
||||
node.restart()
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user