Page 1 of 1

Can I get a value from an external web server

Posted: 02 Dec 2019, 18:56
by sparkes
Hi You group of IOT masters

I'm trying to get an ESP to check an external server for a value but I don't know how (or if) I can receive responses?

For example an ESP with a button

1. Button gets pressed
2. ESP Sends unique value to web server via SendToHTTP
3. Server processes value in php and responds with either value 0 or 1 for example
4. ESP runs rule depending on received return value of 0 or 1

I really hope somebody understand what I'm getting at.

Obviously I don't want to expose the ESP to the internet directly but if the request comes from the ESP then is safer.

Re: Can I get a value from an external web server

Posted: 02 Dec 2019, 20:23
by grovkillen
Currently not possible. But you may want to add it as a feature request on GitHub. Please look through the open issues to see if it has already been suggested.

Re: Can I get a value from an external web server

Posted: 03 Dec 2019, 00:49
by sparkes
That's a real shame I had grand plans.

I'll try and add a feature request.

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 00:28
by Flying Domotic
May I suggest you doing it differently?
For example, sensor send the value to the server, and server sends back a command to the sensor (like relay on/off)?
We often do like this with automation systems ;-)

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 00:44
by sparkes
That would work for a local server but unfortunately the server is a web server and not local so security is an issue and we don't want to be exposing the esp8266 to the internet.

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 09:58
by Flying Domotic
Got it!

You so have to ask for a change (or do it yourself), and manage errors/timeouts if server don't answer for any reason.

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 10:48
by iron
sparkes wrote: 02 Dec 2019, 18:56
I'm trying to get an ESP to check an external server for a value but I don't know how (or if) I can receive responses?

...snip...

Obviously I don't want to expose the ESP to the internet directly but if the request comes from the ESP then is safer.
Hello,

If the server is "external" how will this stop from exposing your ESP to the internet ?

-D

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 13:40
by sparkes
iron wrote: 04 Dec 2019, 10:48
sparkes wrote: 02 Dec 2019, 18:56
I'm trying to get an ESP to check an external server for a value but I don't know how (or if) I can receive responses?

...snip...

Obviously I don't want to expose the ESP to the internet directly but if the request comes from the ESP then is safer.
Hello,

If the server is "external" how will this stop from exposing your ESP to the internet ?

-D
We're asking for it which means we're opening the connection then then closing it. Just like when the ESP uses the NTP server to get the time! I'm not an expert...

It's also behind a router and it's ip address will change - so we can't target it very easily.

We're asking for a value instead or being sent it.

I think?

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 14:12
by TD-er
Maybe the related issue on Github will clarify things a bit?
https://github.com/letscontrolit/ESPEasy/issues/2796

Re: Can I get a value from an external web server

Posted: 04 Dec 2019, 14:53
by sparkes
TD-er wrote: 04 Dec 2019, 14:12 Maybe the related issue on Github will clarify things a bit?
https://github.com/letscontrolit/ESPEasy/issues/2796
Yep thats my request... :lol: