Smartphone Garage Remote | 04 | Smartphone Setup

At a basic level, our garage remote system can be operated by sending a POST command to the macro we designed. One method to accomplish this would be to create a webpage hosted on the Raspberry Pi with a button that will activate our macro. However, this is inelegant. Instead, we can use a series of Android software to perform this task.

Tasker task

The primary piece of software is the popular app Tasker. Tasker is a fantasic automation and control app that lets one accomplish essentially any task with their Android smartphone. I already use this app for many of my own personal tasks, so it was easy to add this new use case.

"Tasks" are a series of actions that can be lauched by any number of means. Tasker includes its own means as "profiles", but we will be launching our task with a separate method, discussed in the next section.

Our task could be as simple as sending an HTTP POST command to the approriate REST route, but we can include a little more logic to make our lives easier. The pseudocode for our task is written below,

If, %Home = 1
    HTTP POST → username:password@INTERNALip:port/macros/garage
    FLASH → "Open sesame!"

Else If, %NearHome = 1
    HTTP POST → username:password@EXTERNALip:port/macros/garage
    FLASH → "Open sesame!"

Else,
    FLASH → "Out of range"

Essentially, this task first tries to control our remote locally, then falls back to the web, then returns a failure message if neither of the previous go through.

Location context

The variable %Home is set to 1 by Tasker (through a seprate profile) if we are connected to our local home network. If we are not connected to our local network but are still near home, the variable %NearHome will be set to 1. This allows us to control the garage through the web by using the external IP address of our house and the port forwarding setup we created. This %NearHome state is determined through the Tasker geofencing plugin, AutoLocation.

The reason why we want be be near home when using our external IP solution is to prevent accidental activations when far from home. If we are away from the house, accidentally activating the system would open the garage, or close the garage if someone else is trying to use it. Not being able to see what is happening is uncomfortable, so preventing accidental usage when away from home is ideal.

Button configuration

Activating our Tasker task should be quick and easy. Fortunately, the latest versions of Android allow users to add their own custom buttons to the Quick Settings dropdown. This can be easily accomplished with the app Custom Quick Settings. This app ties into Tasker (among other sources), allowing users to activate tasks with the press of a button.

Final Product

At the end of all this tinkering, we get something that works seamlessly, every time! This project was a great exercise in using both hardware and software to accomplish a singular task. I look forward to my next project with the Pi!