wifi.setmode(wifi.STATION) wifi.sta.config("irun4fundotca","4189C8EFF3") print('\nSolar PV Controller - ESP8266 Server v1b\n') tmr.alarm(0, 1000, 1, function() if wifi.sta.getip() == nil then print("Connecting to AP...\n") else ip, nm, gw=wifi.sta.getip() macAdd = wifi.sta.getmac(); print("IP Info: \nIP Address: ",ip) print("Netmask: ",nm) print("Gateway Addr: ",gw,'\n') print("Mac Addr: ",macAdd,'\n') tmr.stop(0) end end) Relay1 = 0 Relay2 = 2 gpio.mode(Relay1, gpio.OUTPUT) gpio.mode(Relay2, gpio.OUTPUT) srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(client,request) local buf = ""; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); if(method == nil)then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); end local _GET = {} if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v end end buf = buf.."