Connecting to your home from the internet

One of the things most people want to eventually do with their home automation systems is to connect to them while away from home.

While many products have that capability built-in (think Nest Thermostat), many don’t. Further, there are many situations where you may want to establish your own ability to connect rather than pay fees that products may charge to support internet connectivity.

Before you begin, it’s good to understand that the internet is basically a 1-way system. People think that information is being “sent” to them, but in reality, your computer or web browser or email application is calling out to a server and asking for information. It would be like having a cellphone where the number changes randomly. That wouldn’t be a problem if all you ever did was dial-out. Since we’re dealing with a system that was designed to be 1-way, and with internet service providers that don’t really want to encourage their customers to host devices or servers in their house (you can read more about that here), it takes a bit of work to get everything setup to enable you to do that.

There are several things to work on to enable “home made” home automation remote access.  The main things you need to address is your IP address, how your router is setup, and how devices inside your home are connected to the router. This can be a bit daunting, but once you have this working for your first device, the vast majority of the work is done, and it will work for years, and adding new devices in your home becomes quick and easy.

Router IP Address –  If you are like the vast majority of residential internet access customers in North America, you probably have a “dynamic IP address”. The IP address is essentially your “phone number”, but as the name suggests, it’s dynamic.  So the IP address you need to know to connect with your home router can and will change periodically, you need a way to have a consistent “address” to reach out to when you are away from home. The key to doing that is to use a Dynamic DNS service. A Dynamic DNS service works with your router, or has a small app that runs on your PC, that monitors whatever your current IP address is. It then keeps a record of that, and they give you a fixed URL, so whenever you use that, their service will direct your communications to whatever IP address your service provider has given your modem.  There are free and paid services, you can check out an article with a good list of options here in an article written by Joel Lee. When you are selecting a service, make sure they offer port forwarding (more later).   This service needs a way to communicate back to their servers and let them know your current IP address. That can be accomplished either via the settings in your router, or a small app that runs in the background of a PC (that you leave running at home).  Your router may have a “Dynamic DNS” setup option, if so use that. If not, you may need to leave a PC running. Once you have Dynamic DNS working, you should now be able to connect from anywhere on the internet to your home router. You’ll use an address such as: MyHome.dyndns.org to connect to your home router.

Device IP Addresses – Just like your router’s IP address, all the devices inside your home that connect to the internet also have an IP address. They can also get a different IP address each time they reconnect to your router. So if a device is turned off, or you have a power failure and all your devices reconnect, they can be assigned IP addresses that may be different than the previous time they connected. So even if you can connect to your router, you have a similar problem getting to a specific device.  The good news is you can reserve IP addresses inside your home for specific devices, so whenever they connect to your router, they are given the same IP address.  Your router should have a LAN Setup capability in the administration area, that lets you reserve IP addresses.  Fortunately every internet connected device does have a fixed, never-changing address, called a Mac Address. The LAN Setup menu on your router setup will let you specify which IP address will be given to devices based on their MAC address. You can use the Attached Devices section of your router administration menu to get a list of all the devices (wired and wireless) connected to your router. This list will show you the IP address assigned, the device name (if the device manufacturer included that in its networking) and the MAC address. Make sure that each device (such as a webcam or home automation controller) that you want to access remotely has had an IP address reserved for it.  If you can’t determine which device has what MAC address, you may want to disconnect the device, look at the Attached Devices menu (maybe take a picture with your smartphone), connect your new device, refresh the list and see what’s been added. The new MAC address that now appears should be the device you’re trying to manage.  Once you have each of the devices you want to connect to remotely, you can now assign them a Port Number.

Port Numbers – Port numbers are the way you use an IP address to not just reach the router in your home, but a device connected to that router. You’re effectively using a 2-part address, the first-part is to your router, and the second part is to a device connected to that router. So assuming you’re using a Dynamic DNS address to reach your router, to connect to a device inside your home, you may use an address such as: MyHome.dyndns.org:18433.   The :18433 that was added to the end of the address is the port number, and that tells your router to connect you to a specific device.  Since you’ve already reserved a specific IP address for each device you want to connect with, you can assign each of them a port number using the “Port Forwarding / Port Triggering” menu on your router. For each device you’ll “Add Custom Service” and tell the Router what port number you want to associate with which IP address.  Once this is setup, you should be able to directly connect to a device in your home from anywhere on the internet.

How to Connect – Home automation devices have different ways that you can interact with them. Some devices (such as a NEST Thermostat) come with free applications that are specifically designed to control the device. If the device comes with the connection service you probably don’t need to do any of the things described above. If the device doesn’t come with a connection service, or you want to use a 3rd party software program to control the device, you’ll need to enter the DNS address and port number in the software so it knows how to connect to the device. Other devices have built-in web-based interfaces so you can interact with them directly. Webcams often have control software built into them, so you can control them over a simple web browser.

A word about security…. Once you begin opening-up your router to remote access, you significantly increase the ability of someone other than you to get into your home systems. This should be no problem if you are thoughtful about security.  Please ensure that each device you connect has a username and password that is unique and NOT the default that came with the device. Also make sure that your router administration user name and password is not the default that it came with. Connecting devices and leaving the default username/password settings is the #1 way you will make your system(s) vulnerable to being connected to by others.