-->
Page 1 of 1

Handle reading & writing pins on/off with remote http req

PostPosted: Sun Sep 27, 2015 11:53 pm
by forlotto
NOTE:: Please read the next posting as well for implementation!

I would like to see an easy way to:

Turn GPIO ON
Turn GPIO OFF
Read GPIO

And have it done by simply typing requesting it via an http reqest.

Turn ON GIPO 14 example:
http://NonlocalNodeMCUIPAddressHere/gpio14=ON
Turn OFF GPIO 14 example:
http://NonlocalNodeMCUIPAddressHere/gpio14=OFF
Read GPIO 14 example:
http://NonlocalNodeMCUIPAddressHere/gpio14=?status



Somehow if this was integrated it could make life a lot simpler we wouldn't have to rely so much on node memory.

Re: Handle reading & writing pins on/off with remote http re

PostPosted: Mon Sep 28, 2015 5:48 pm
by forlotto
For security purposes you could integrate it like so...

http://NodeNonLocalIP/**password_here**/function_here

So lets say our password is nodemcu in this case and our wan ip is 1.1.1.1 and we want to turn gpio 14 on
This would be the request:

http://1.1.1.1/nodemcu/gpio14=ON <--- Turning GPIO14 on is as simple as requesting this!

For this API we may want to consider somethings for example:

Maybe as a requirement to use this API a password has to be used.

This way if anyone makes requests without the password or the wrong password it is ignored.

so to recap:

In order to use this api you need to specify in init.lua a password:
Something like this ---> httprequestpassword(YourPasswordHere) or HRP(YourPasswordHere)
Obviously 2 things must be considered:
1.) password must have sanity checking such as length.
2.) Null or no passwords are not allowed.