Controlling my garage port via internet

I'm sorry if this project doesn't seem very well defined at this point, but please bear with me. What I want is to be able to control my garage door over internet (or phone), using an ESP8266 connected wirelessly to my wifi-router connected to the internet.

What I plan so far is to have the ESP8266 module in the garage controlling a mosfet/transistor which in turn controls the garage opener (there is already a switch inside the garage and the door opens/closes when the wires are shorted and the mosfet/transistor is to be placed in parallell to this circuit). There are several tutorials on how to control an ESP8266 via the internet (http://www.instructables.com/id/Control-ESP8266-Over-the-Internet-from-Anywhere/?ALLSTEPS), however none of these as far as I can see offers any kind of security, e.g rolling codes or verification of some sorts. My question is how can I implement this as part of this project?

I'll be doing the same thing once my ESP8266 units arrive. From what I've been planning so far, with the great advice of some members here, is to go with an optocoupler instead of a transistor.

As for security, which point of access are you concerned about? The module? The port at your modem?

I would personally never connect something like a garage door to the internet. Everything is hackable, even websites that have a complete team of professional hackers and a couple of million dollars to prevent it. I think that the convenience of opening it with your phone does not outweigh the security risk. Just buy a remote that was made for that purpose.

(And I agree, hacking these remotes is just a matter of minutes, with the right tools, but you have to be within a 50m radius. That is the big difference. Throwing your garage opener on the internet is just an invitation, a challenge for hackers.)

But that’s only my opinion, of course

INTP: I'll be doing the same thing once my ESP8266 units arrive. From what I've been planning so far, with the great advice of some members here, is to go with an optocoupler instead of a transistor.

As for security, which point of access are you concerned about? The module? The port at your modem?

Yes. Optocoupler would be a better choice. Thanks.

I would think that the port would be the "weakest link", but I know next to nothing about this.

PieterP: I would personally never connect something like a garage door to the internet. Everything is hackable, even websites that have a complete team of professional hackers and a couple of million dollars to prevent it. I think that the convenience of opening it with your phone does not outweigh the security risk. Just buy a remote that was made for that purpose.

(And I agree, hacking these remotes is just a matter of minutes, with the right tools, but you have to be within a 50m radius. That is the big difference. Throwing your garage opener on the internet is just an invitation, a challenge for hackers.)

But that's only my opinion, of course

I already have a remote, however it's fixed to the car's keyes and there are times that I want to access the garage without having the keys, for instance when I use my bike. I always have my phone with me :).

I understand that everyone can access the port here, but what if it the phone sends a passphrase of a certain length to the router and passed to the ESP where it is checked against the same passphrase stored in a string on the ESP? Isn't the communication over internet between the cell phone and the router encrypted?

Lars81: Isn't the communication over internet between the cell phone and the router encrypted?

If you are connected to the same (secure) WiFi network it is. Otherwise it is not (unless you use https). If you use it on your local network only, and if the firewall of your router blocks traffic from outside, you should be a lot safer. However, hackers use all kinds of tricks to get past firewalls, and if they succeed (or if you connect it to the internet), a hacker has virtually unlimited time to intercept, guess or brute force your passkey, and get into your house.

Okay, so you only need it to work within normal sensible ranges, as in, you can see your garage, right? Internet proper isn't necessary at that point. Doesn't that esp module create an intranet or whatever it's called. Local wifi network, same SSID/WPA options are sufficient security. But why not just simple Bluetooth? Arduino, BT module, optocoupler, and an app like Ardudroid will do what you need, be secure, and your phone works as the transmitting remote.

INTP: Okay, so you only need it to work within normal sensible ranges, as in, you can see your garage, right? Internet proper isn't necessary at that point. Doesn't that esp module create an intranet or whatever it's called. Local wifi network, same SSID/WPA options are sufficient security. But why not just simple Bluetooth? Arduino, BT module, optocoupler, and an app like Ardudroid will do what you need, be secure, and your phone works as the transmitting remote.

Primary use will be within short distance of the garage, yes. As you mention the ESP can be set up as a server and I believe it offers the option to have encryption, so that's a way to do it I guess. But I was hoping to do it via internet so that I eventually can add a sensor to the ESP that senses whether the door is open or closed also.

Perhaps you can point me in some direction to where to start looking for tutorials on the wifi connection?

I don't have my ESP units yet, I've just been reading whatever pops up on Google and Youtube.

Lars81: Perhaps you can point me in some direction to where to start looking for tutorials on the wifi connection?

I learned a lot by looking at the built in examples of igrr's (Ivan Grokhotkov) ESP8266 Arduino IDE plugin, and modifying them.

PieterP: I learned a lot by looking at the built in examples of igrr's (Ivan Grokhotkov) ESP8266 Arduino IDE plugin, and modifying them.

Yes, they are good.

Okay, so I think I have decided the rough basics here. The ESP8266 is to be mounted in the garage and controlling a optocoupler which controls the garageopener. The ESP is then connected to the wifi-router and acts as a web server.

Using the "WifiWebServer"-example with the ESP8266 library I can then send commands via the web-browser on the phone, e.g "192.168.114/gpio/1. (I have to include some code which turns the pin low afterwards).

That will work when using the web-browser, but let's say I want to make an app (basically just a simple button with "open/close" that sends this text/code, how can that be done, in very rough terms? (Not the programming of the app itself, but how the app should communicate to the ESP8266?