General area when it fits no where else

Moderator: Mmiscool

User avatar
By Mmiscool
#48650 I highly suggest using a method similar to the last post.

Set up a server that can be configured to use https and have that server talk to the esp devices on your internal network.

You probably don't want to have your esp connected directly to the outside work. I do occasionally for demonstrations and such but rarely for long periods of time. Remember that it only takes 4 connection to clog up the esp so that another client cant connect. That is to say it is one of your buddies who is mad at you who keeps hitting the refresh button in 4 tabs open on his browser.
User avatar
By forlotto
#48651 @livetv

Things will be static and local no need to look for anything my server is likely going to be a raspberry pi or a PC I am unsure of this currently which route I will take but either one should support PHP. Recieve --> Translate ---> Request --->Respond all connected to a local only router the only thing connected to the internet will be the server itself no internet on the devices just intranet.

Hrmmm ok php looks rather promising rather than ports I'll stick with standard port 80 as far as the server it will be on my side of the router a local server at my home a certificate could be created if need be...

What someone could do instead is just have certain commands that look encrypted instead...

The example does not quite reflect what I am trying to do via looking at the code.

so to turn the AC unit on http://serverip/9adfa-0 will turn my AC unit on for instance it would take quite some time to discern the difference between encrypted and encrypted look alike ...

Instead of the server addressing ports it would simply address the local ip rather than the port connected.


So here is the idea to turn my ACUnit on:

This is sent from remote host first
http://serverip/prTGs21zw=0 "On for my ac"
http://serverip/prTGs21zw=1 "Off for my ac"
http://serverip/prTGs21zw=r "Read Status Of My AC"

The server will receive this and translate it to:
http://192.168.1.133/msg?pin=1stat=0 "on for ac"
http://192.168.1.133/msg?pin=1stat=1 "off for ac"
http://192.168.1.133/msg?stat=r "read ac status"

Then it will make that request using curl I guess.

If the request is to return status then it should grab that data and respond.

I think your example is near perfect to show that this is possible the only thing lacking is instead of ports get local ip and a way of showing a response for the status via scraping or some other method.

While SSL is possible I don't think it will be huge for me I will not be broadcasting any door over the internet that is all going to be done locally only which would require a connection to my wifi AP.

Excellent example though the server is only there to translate my communications more or less and return data only when a return is requested I suppose I could just host status pages that can grab the status page from the device and translate the data each time there is a request to that page instead this way I could have a status page for each device on the device that would get visited by the server upon page view and then scraped and returned .

What I plan to do is very very basic there will be little to no interaction possible with the esp's and the outside world the server will check against a list of translatable commands translate if the command is good then send the translated command locally and return with 200 ok or 404 error or status data which as I said it may be beneficial to host a page for the status of each device should not hurt to have this viewable by the world.

I like it though php may be the way forward seems like it shouldn't be all that difficult just need to learn the PHP to do this obviously the best and quickest way is to learn from example then adapt everything I need around that basic construct this way things like syntax and such are fairly obvious as well.

@mmiscool

SSL encryption is not needed you want to turn on and off my lights have at it then I will learn my lesson lol or you want to see my temp sensors pffft whatever makes no difference to me I don't want to forward any ports to the internet at all instead just have the server make the intranet requests and parse the data for returns accordingly.

I will not be giving "buddies" my application and if I did and something were to happen it would be rather easy to make their application fairly useless with a modification or two. This is strictly for me and my significant other mainly. Nothing that needs to be secure will be addressable from the net and nothing at all is addressable from the net without first going through the server. The server will only be used to host status pages, maybe a password protected page down the road for weekly timer events for each device, and to translate the request to turn something on or off.

Real simplistic and secure.
User avatar
By villTech
#48656
forlotto wrote:Would be great to see you folks share some info, videos, code, and more on this one.
here is a video of what i newly add on my web app, device status monitor on my floor plan

6 flashing indicators, to show sensor sensor (esp) status around my house, if they are connected to the network and sending data.
green if sensor is online.
red if offline.
(it will still be updated to, Green - online, Gray - offline, Red - sensor triggered)

in the video:
when door sensor is powered up, and sensor LED indicator turned green, it means it is online.
and flashing indicator on the floor plan will turn green from red.
2 esp modules are not in the floor plan for it's outside my house, 1 on my gate, the other one my solar panel.
the small lcd in the video is my raspberry pi server.

here is how it works:
server - raspberry pi running apache, php5, mysql
client device - my esp modules
client browser - any pc in my network.

my server host the web application, php files, and mysql database.
when esp module send POST to php files in the server (2 seconds interval), php file will update the database.
when a client pc, open up the web page, webpage will load display according to the content on the database.
javascript timer is running on the webpage to update page content.

the browser, doesn't have direct connection to esp modules.

if i want to change the color on my sensor LED, a click from the web page will do a XMLrequest to a php file on my server.
php file will update the server.
then the server reply from esp POST has content to update its LED color.

same set up if i want to monitor and control these devices from the internet.
my server (raspberry pi) connects to an online server, requests its php file to gain access on its database.

now when we talk of security on internet, I will go for services like amazon AWS. i find their protocol and constant update of their protocol secured.
though nothing is really secured in the internet.
sooner or later this security will break. specially if it is not being updated.
faster, when someone gets interested to it.

so my suggestion is avoid hooking up critical stuff on the internet.
or stuff that others may get interested to.

and here is a photo of my door sensor:
Image
plus a 5V supply :lol: :lol: :lol:
User avatar
By villTech
#48657
forlotto wrote:my server is likely going to be a raspberry pi or a PC I am unsure of this currently which route I will take but either one should support PHP.


i used to run server for my ESPs on my mac, but that made me run my machine 24/7.
so i shifted to raspberrypi and openwrt router.

here is a guide to set up server on a raspi:
https://www.stewright.me/2015/08/tutori ... erry-pi-2/

you might also want to install ftp app like filezilla. ( see the last post)
http://ubuntuforums.org/showthread.php?t=1562419