Re: Accessing 8266 remotely via internet, rather than LAN
Posted: Mon Dec 28, 2015 7:37 am
All the simple answer is, all things to all people, knowledge is like air and it should be breathed freely....
http://freeboard.io/connect/
For anyone wishing to "Interact" via a protected NAT.....click the link above and research Thingspeak and Dweet.io, the snippet below will allow the fast response of the request for a json frame but this process as you can see from the link above will stream....without the need to present directly to the internet....the snippet would require port mapping
Code: Select all
else if(sPath=="/jsread")
{
ulJReqcount++;
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: application/json");
client.println("Connection: close");
client.println();
sResponse = ("{\r\n\"temperature\": [\r\n");
sResponse += pfTemp;
sResponse += ("\r\n],\r\n\"humidity\": [\r\n");
sResponse += pfHum;
sResponse += ("\r\n],\r\n\"dewpoint\": [\r\n");
sResponse += pfDew;
sResponse += ("\r\n],\r\"temperature1\": [\r\n");
sResponse += pfTemp1;
sResponse += ("\r\n],\r\n\"humidity1\": [\r\n");
sResponse += pfHum1;
sResponse += ("\r\n],\r\n\"dewpoint1\": [\r\n");
sResponse += pfDew1;
sResponse += ("\r\n],\r\n\"dstemperature1\": [\r\n");
sResponse += pT;
sResponse += ("\r\n],\r\n\"dstemperature2\": [\r\n");
sResponse += pT1;
sResponse += ("\r\n],\r\n\"dstemperature3\": [\r\n");
sResponse += pT2;
sResponse += ("\r\n],\r\n\"dstemperature4\": [\r\n");
sResponse += pT3;
sResponse += ("\r\n],\r\n\"dstemperature5\": [\r\n");
sResponse += pT4;
sResponse += ("\r\n],\r\n\"Systemv\": [\r\n");
sResponse += pfVcC/1000, 3;
sResponse += ("\r\n],\r\n\"Jsreqs\": [\r\n");
sResponse += ulJReqcount;
sResponse += ("\r\n],\r\n\"Uptime\": [\r\n\"");
sResponse += duration1;
sResponse += ("\"\r\n],\r\n\"TiMestamp\": [\r\n\"");
sResponse += TMnow;
sResponse += ("\"\r\n]\r\n}");
// Send the JSON response to the client
client.println(sResponse);
sResponse = "";
}
An example of the frame from 2 DHT22's and a few DS18B20's....
for visualisation use the Freeboard link or the Diags page....
http://82.5.78.180:94/diag
https://freeboard.io/board/PLCLH6
http://82.5.78.180:94/jsread
The road to contentment starts with the act of giving............