Did you know that you can enjoy many members-only features simply by quickly registering (no CAPTCHA!)?
Registering gives you access to our giveaways, forum features, increased search performance, access to our Download Library, create your own blog & gallery, and more!
Once you have registered, stop by in 'Hello World', and introduce yourself.
- Turn WiFi of when you arrive at home.
- remind you every 60 seconds that you missed an important call, while turning the ringer volume up every time it reminds you.
- Save your battery by turning the screen brightness down at night (or whenever you put your house into night mode, tutorial coming soon!)
- Automatically back up your phone when connected to your home network
- Announce SMS/E-mail messages using TTS when driving.
- Start music playback as soon as you get into your car.
Now that Tasker has repeatedly been mentioned in a home automation context, I thought it was time to create a simple tutorial showing how you can create a widget to execute a simple automation task, or turn on/off a device such as your lights, using the built-in web server of your home automation controller.
Tasker can emulate a web browser in order to retrieve data. This is the feature we will be using for this tutorial. I will show you how you can figure out the correct commands you have to send, in case you have a home automation controller with an undocumented web server, or are trying to do something which no one else has tried before.
There are 3 major steps to this process:
- Learn: We need to figure out what command is sent whenever we click that 'on' button when accessing the home automation controller webserver.
- Create: We need to create a task in Tasker, and link it to a widget, using the data we learned in step 1.
- Execute: We now should be able to control the light/event/task by pushing the Widget installed on your Android desktop.
- A home automation controller with web services enabled (such as HomeSeer, CQC, Vera, etc.).
- Tasker. I'm going to assume you are already familiar with this app, if you aren't, feel free to ask for more help in the comments section, or use your favorite search engine to find the many Tasker tutorials. There is a trial version, and the screenshots should offer plenty of assistance with helping you start from scratch.
- Access to the network which is running the web server. Do NOT expose your home automation server to the internet, especially for this tutorial. I will create another guide soon, covering multiple ways of securely controlling your setup while not at home.
- If possible, create a separate account for use with Tasker only. This makes it easier to kill remote access should the account become compromised, and might help with troubleshooting any problems.
In order to figure out what URL & data is sent whenever you activate a light/task via your home automation web server, we need to monitor these requests coming from your browser. But before that, I need to quickly explain (in a simplified way) the types of requests your browser sends to a web server. There are 2 types/methods, and in this example, let's assume we are trying to control a light with an ID # of 4, and we are trying to turn it on. The URL is the string found in the address bar of your browser.
- GET: The browser sends any variables as part of the URL.
Example: http ://127.0.0.1/control.php?light=4&action=on
This is a fictional example which controls a light with ID # 4, and turns it on. Extremely simple, and if this is how your home automation system works, simply save the URL you see once you click the on/off button, and you can move on to the next step.
- POST: The browser sends the variables in the background.
Example: http ://127.0.0.1/control.php
As you can tell, the variables are not visible to the casual observer. A POST command is a little bit more secure, because your browser caches URLs (and appended variables). This is also the reason that almost every site relies on POST for authentication, so your credentials won't be exposed via the browser history, or proxy servers logging URLs. Imagine if your bank used ://my.bankurl.com/givememoney.php?user=john&pass=foobar. This would obviously get ugly really fast. POST requests are also not cached, and aren't restricted in length, while the length of a URL (GET) is limited.
If your web server relies on GET for control, just note the URL and proceed to the next step. If your web server uses POST, then we need to install a tool which can display the variables we are sending to the web server whenever we activate a light/task.
To make this process easy, I recommend you install Fiddler, which is a web debugging proxy, and should work with your preferred browser. There are other tools, such as Tamper Data, Firebug & Live HTTP Headers for FireFox, or Chrome's internal Developer Tools (use F12 to activate). In order to keep this tutorial browser-agnostic and simple, I will be using Fiddler to capture the POST data, and HomeSeer as my home automation controller, but the concept is the same for any other home automation controller.
Start up the Fiddler software, wait for it to finish loading, and proceed with activating a task/device via the web interface.
Fiddler logs all data your web browser sends out and receives, so you should be able to catch the POST data, including the required variables. Just pay attention to the URL you see in your browser's address bar, and look for the server address and path in the Fiddler window (Inspectors > WebForms tab).
The screenshots below show the data transmitted when I issued the ON command, an OFF command, and when I executed an event via the HomeSeer web server.
[attachment=5167:tasker-automation-tutorial-device-on.png] [attachment=5166:tasker-automation-tutorial-device-off.png] [attachment=5168:tasker-automation-tutorial-execute-event.png]
Once you have this data, you can move on to the next step, where we will create a Tasker task & widget. If you have problems with this step, don't hesitate to post in the comments below.
Note: The Rover plugin for Homeseer uses the GET method, so if you want to skip the 'difficult' part, just point your Tasker widget to the Rover plugin instead.
It's now time to create the Tasker task & widget. Let's start with the task, as the widget is just a shortcut which points to this task.
- Select the 'Tasks' tab on your Tasker screen.
- Add a task by clicking the green + symbol.
- Enter a name. Keep in mind that this is the name which will appear under the icon on your Android home screen. For this tutorial, I am entering 'LightOn'.
- You should now be in the Action screen.
- Since a widget requires an icon, let's select an icon for this task by clicking the last button at the bottm, next to the 'tools icon', and above the icon with the play button.
- We now have to add an action to this task. Select the button with the blue plus symbol.
- We are looking for the HTTP Get or HTTP Post action, which can be found in the 'Net' category.
- If your home automation controller uses GET, then select HTTP Get, otherwise, select HTTP Post. For this tutorial, I am selecting HTTP Post, but I will include an HTTP Get example in the screenshots.
- You should now be seeing the screen which allows you to configure the HTTP Post parameters.
- Under 'Server:Port', specify the credentials and IP address of your server. Example: http ://user:[email protected]
- Under 'Path', specify the rest of the URL as you see it in your browser. In this example, I will specify '/stif' as this is what HomeSeer uses.
- 'Data/File' are the variables you want to send to the server. In this HomeSeer based example, we need to send the device ID, and the type of action, both variables can be found with Fiddler in the previous step. I also included an example for the OFF command, and an event execution in the screenshots below. The variables we are adding are:
- You don't have to fill out any of the other fields, unless you want to process the server response, or adjust other connectivity parameters.
- That's it! Use the green check mark button to save your work. I also recommend you test the action by pressing the button with the blue play symbol. This will verify the tasks works before we move to the next step.
All we have to do now is create the widget (a clickable icon in the Android world) now that we have created the task.
There are 2 types of Android Tasker widgets: 'Widget' and 'Shortcut'. For more information about the differences, check out the Tasker site. In this tutorial, I am going to select the standard shortcut (Task Cut).
Add a widget via the Android Widget screen (sometimes, you can press & hold on the home screen to activate this screen, or in the newer Android releases, go to the screen which lists your applications, and select the 'WIDGETS' tab on top.
- Select the 'Task Cut' widget.
- A 'Task Selection' windows should now appear, and list all the tasks you have defined. Select the task we created earlier, 'LightOn' in my example.
- Once selected, you should now see the actions associated with your task. Confirm the details by pressing the button with the green check mark.
- That's it. You should now see an icon on your home screen.
Tapping the icon should activate the task you defined earlier. I highly recommend you put these widgets in a 'folder' on your home screen, to avoid accidental activation, plus it gives you quick access to all your home automation widgets.
This is an extremely simple example of how to interact with your home automation system. You could take it a step further now, and process the web server response, or change the widget icon based on the state of the device.
You could use this widget to open your garage door (do this via an event, so you can do some safety checks, etc.), turn on your outside lights, reboot your cable modem or internet router, anything you can think of, as long as it comes with a web server.
As mentioned earlier, you really shouldn't expose your web server directly to the internet. I will publish a guide soon which will show several ways of accessing your system remotely, in a more secure fashion.
If you have any questions or comments, post them below, I will answer them as soon as possible.
In an attempt to make this process easier, I would like to ask the community to share the 'Path' and a 'Data' example for their home automation controller if it isn't covered by this tutorial already (host/port isn't needed). Whenever someone posts a new Path/Data in the comments, I will add it to this article (with proper credit if desired). This should make it really easy for anyone to get this working without having to analyze the HTTP Post data.
Dynamic data (such as the ID of a device) is underlined, make sure to replace this with the actual value. Only data in green should be added to your Tasker Action.
HomeSeer (2.x) - Control Device
HomeSeer (2.x) - Execute Event
- Mar 11 2013 07:44 AM
- by Dan (electron)
[attachment=4877:largeWDRR-372R.jpg]About a year ago I came across an amazing little device that could really come in handy in the Home Automation world. It's available at Fry's and other retail establishments and ranges from $28-$38 from what I'm seeing. It's the Wayne Dalton Garage Door Conversion Module.
The idea behind it is that it's for converting antiquated or incompatible garage doors to work with most HomeLink and Car2U systems as well as the WD keychain remotes. What gets missed is that it's really a simple relay closure device that's compact and is compatible with most of these in-vehicle transmitters! Here's a link to it on amazon.
As you can see from the pictures here, it's very simple and compact... most garages have the dedicated outlets for the garage door openers with a free outlet - it's designed to go there, and has a spot for a screw to hold it in... In my case, it's plugged in there, but I'm not wiring it into the opener - instead it's connected to a wire that goes to an M1XIN that's in the garage (I put the original 14" Elk can in the garage with an M1XIN, M1XOVR and M1RB for sprinklers, inputs, etc).
The range is decent - but anyone with HomeLink should know that it's much lower range and less responsive than the opener's own control... that's life. So what can I do with it?
Well, that depends on what you have to work with. You could hook it into your security system (Elk, HAI) as a zone input - I'll get to that later. You can even hook it to one of the many input modules (Global Cache, Simply Automated, etc) - Anything that can serve as an input when 2 wires are touched together. In my case, I'm working with an Elk, and as mentioned above, I already have an input expander in the garage and an extension of the databus. That made life really simple!
Even if you don't have a full Home Automation system, just pairing one of these with an input adapter for whatever lighting system you use can give you basic control of lights or other things around the house. Also, if you don't have an input expander handy, you can always pair it with something like the UPB input module above and program your HA system to watch for those links - saving some wiring hassles but still getting the same effect.
Once connected to the panel, I have a few options. I could set it to a normal non-alarm zone and run it entirely through rules... that would work fine and I could do whatever I want. However in my case, this "third button" is set to serve a single purpose - which is to close all garage doors and arm the alarm away. Because of that, I went even easier - and set the zone definition to Keyswitch Momentary Arm Away. That means any time the button is pressed, it does the Arm Away and runs the associated rules, which include turning off the garage lights and closing any open garage doors. This is my visual indicator that all went well. If the garage door doesn't close, there was a problem Arming Away.
Also, if you really do have incompatible doors, it's a good retrofit option for old openers.
One tip - for HomeLink you sometimes have to program it to a remote, then teach the newly programmed button to the opener. You can purchase one of these remotes to train it, or do like me and use one of the spare buttons on your garage door opener remote (they usually have 3 buttons) or pick up a generic remote from Home Depot or Lowes.
- Integrate with existing gate or garage doors that aren't compatible
- Build a "smart" garage door opener remote - that only operates within certain conditions (using rules that decide when it works when it doesn't, then having the security panel actually open/close the door). If you have a car you leave outside you can use rules to disable its button while armed vacation/away or something like that; or disable the buttons when the alarm is armed night.
- Make a smart button that, if the door is open when pressed arms the system and turns off all the lights; if pressed when closed, it turns on the lights around the house and in the garage. Or something that gives you a 10-minute bypass on the garage door before unbypassing and starting entry timer (for better control of the entry timers).
- Have dedicated open/close buttons for running rules and actions if you want.
- Turn on/off porch lights
- Turn on/off christmas lights
- Arm the alarm
- Check the status of the alarm (have it flash lights or chirp the alarm to verify status).
- Set back the temperature in the house; or restore it.
- Trigger any rule on the automation panel you can think of!
I am not a fan of keeping garage door openers in the cars or having homelink setup where someone can activate it to gain access to your home.
This is the first home I've used it in - previously we had security systems in our cars and I bought the expansion modules for the car alarms that had relay outputs that could be programmed for the garage - that way the remote was on our keychain not the car.
Here we park in the garage 99% of the time - and if we don't, I just disable the GDO at night. I don't recommend programming any buttons for any sort of "disarm" functions - I firmly believe that any disarm function should require a user to enter info known only to them (no keyfobs, keyless entry, etc).
Different cars act differently; If I recall, the BMW and the Mercedes didn't let the buttons function without the key; GMC, Ford, Nissan do...Don't use this to do something like a "Disarm Security System Silently" if your cars are always parked outside - that'd just be bad. In my case if someone broke in, the worst they'd do is arm the alarm... not the end of the world.
Disclaimer: As always, neither the author or Cocoontech take any responsibility for how you implement this; use good sense and avoid letting this built-in button become a method of breaching your home security.
- Dec 27 2017 06:43 PM