%
zout("
"..node_id.."")
%>
<%
zout(""..node_id.." 200112.1919
")
%>
Home...
Menu:
<%
if _GET.SetupWIFI == "true" then
print("On demande le setup wifi depuis le browser !")
wifi_setup_ok=(math.floor(100*node.random()))
zout("
Etes-vous vraiment certain ?
Si oui, faites: ")
zout(' Ok
')
end
%>
<%
if (wifi_setup_ok ~= nil) and (_GET.SetupWIFI == tostring(wifi_setup_ok)) then
print("On confirme le setup wifi depuis le browser !")
zout("
Choisir comme WIFI AP: setup_gadget puis aller sur: http://192.168.4.1
")
file.putcontents("_setup_wifi_", "toto")
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
%>
<%
if _GET.RESTART == "true" then
print("oups restart...")
zout("
oups restart...
")
tmr.create():alarm(5*1000, tmr.ALARM_SINGLE, function()
print("on restart...")
node.restart()
end)
end
%>
<%
zout("Etat de la LED:")
if gpio.read(zLED) == 1 then zout("OFF") else zout("ON") end
zout("
")
%>
<%
if zRELAY ~= nil then
zout("Etat du RELAY:")
if gpio.read(zRELAY) == 0 then zout("OFF") else zout("ON") end
zout("
")
end
%>
<%
a,b,c = wifi.sta.getip()
if a ~= nil then
zout("
IP: "..a.."
\n".."MASK: "..b.."
\n".."GATEWAY: "..c.."
\n")
a=nil b=nil c=nil
end
collectgarbage() zout("RAM: "..node.heap().."
")
%>
<%
zout("
Etat des GLOBALS !
\n")
zout("\n")
for k,v in pairs(_G) do
if k ~= "lua_code" then
v = tostring(v)
zout("")
zout("| "..k.." | ") zout(""..v.." | ")
zout("
\n")
end
end
zout("
")
%>
Restart !