Webserver not working on cell signal.
Posted: Sun Feb 22, 2015 8:01 pm
Hey guys...
I'm trying to create a remote control for my thermostat.
In my project when my phone is connected to the same wifi network as the ESP then everything works but when i switch it to cell data it doesn't. any idea's?
Modified Code from Rui Santos
http://randomnerdtutorials.com/esp8266-web-server/
As far as how the thermostat project is going i took apart my honeywell unit and it has a complicated(heat-off-cool) switch, i was hoping it was a on off on switch but its a slider type with 20 pins and to reproduce its function would require 8 relays
I'm trying to create a remote control for my thermostat.
In my project when my phone is connected to the same wifi network as the ESP then everything works but when i switch it to cell data it doesn't. any idea's?
Code: Select all
wifi.setmode(wifi.STATION)
wifi.sta.config("XXX","XXXXXXX")
print(wifi.sta.getip())
led1 = 3
led2 = 4
gpio.mode(led1, gpio.OUTPUT)
gpio.mode(led2, 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.."<h1> A/C Control panel </h1>";
buf = buf.."<p> <a href=\"?pin=AC\"><button>Ac</button>";
buf = buf.."<p> <a href=\"?pin=Heat\"><button>Heat</button>";
buf = buf.."<p> <a href=\"?pin=OFF\"><button>OFF</button>";
local _on,_off = "",""
if(_GET.pin == "AC")then
gpio.write(led1, gpio.HIGH);
gpio.write(led2, gpio.LOW);
--elseif(_GET.pin == "OFF1")then
-- gpio.write(led1, gpio.LOW);
elseif(_GET.pin == "Heat")then
gpio.write(led2, gpio.HIGH);
gpio.write(led1, gpio.LOW);
elseif(_GET.pin == "OFF")then
gpio.write(led2, gpio.LOW);
gpio.write(led1, gpio.LOW);
end
client:send(buf);
client:close();
collectgarbage();
end)
end)
Modified Code from Rui Santos
http://randomnerdtutorials.com/esp8266-web-server/
As far as how the thermostat project is going i took apart my honeywell unit and it has a complicated(heat-off-cool) switch, i was hoping it was a on off on switch but its a slider type with 20 pins and to reproduce its function would require 8 relays