Blog archive
RSS

Blog

Command-line activation of scenes from InControl

If you've ever wanted to integrate another program with InControl, one way to do it would be to use CURL to consume the hosted service.  This page will outline the steps needed to perform such a task.

This tutorial will assume you are doing this from a Windows computer. It should still work in a similar fashion on other OSes though.

Step 1: You need to get a copy of CURL. Some OSes such as Linux might already have this. If not, visit the CURL web page to download the appropriate version for your operating system.

Once you have that downloaded, extract the curl.exe to your hard drive.  To make this easier, put your CURL.EXE file in your C:\WINDOWS\SYSTEM32 folder. This isn't required, but makes it easier for the sake of this tutorial and helps prevent the "COMMAND IS NOT RECOGNIZED" errors that are common.

Step 2: Find out what your computer's IP address is. This is the computer where you have InControl installed. The quickest way to find this is to open up a CMD window (by clicking Start/Run and typing CMD). Once the window is open, type in ipconfig and hit enter. You should get output similar to this:

The important information is found on the line that says IPv4 address. In my case, it's 10.4.3.178 - make a note of this number because you'll need it later on.  Note: if you see many of these listed like I do, the most likely bet is that it's the only one with a value for Default Gateway. 

Step 3: Figure out your the scene's Guid ID that you want to activate.  A Guid is just a simple way to identify an object. Each scene in your system is assigned something unique. 

Go back to your CMD window now and be prepared to type in this command:

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{\"password\":\"yourPassword"\}" http://10.4.3.178:1178/zwave/getScenes

I've highlighted certain portions of the command that you'll need to change specifically for your own setup. If you use a password, replace yourPassword to match the password you setup. Just delete the text if you don't have one a password.

Replace 10.4.3.178 with the IP Address you noted from step 2.

Execute the command by hitting ENTER.  Here's how it should look -- and I want to point out that this may not be for the faint of heart! Indeed, it could appear to be as cryptic as the vertical lines from the Matrix. Don't worry though, I'll help you sort it out:

 

Look for your scene in that list. I've highlighted mine for example purposes. The one I'm interested in is named "Portable Sonos." What you want is the sceneID associated to that scene, in this case, it's the series of numbers/characters that starts with 90f18.  Grab the entire set of characters, including dashes up until the final quote and make a note of it. 

This ID will never change, so once you have it you can store it away somewhere and always use it to activate that scene.

Step 4: Activate the scene.

It's now time to use another curl command to activate the scene we picked. I'll once again highlight the portions that you'll need to change to match your own setup.

curl -X PUT -H "Content-Type:application/json;charset=utf-8" -d "{\"password\":\"yourpassword\",\"sceneId\":\"90f18fea-bd80-4c53-96a3-5b04429ca790\",\"activate\":\"1\"}" http://10.4.3.178:1178/zwave/activateSceneByGuid

That's it! If everything went well your scene should now be active. You can repeat this command anytime to turn that scene on again.

 

 

The garage door was left open... AGAIN?!

My kids are notorious for opening the garage door and leaving it open.  When a neighbor called me at 2 in the morning to let me know the garage was open, I decided that I was going to figure out a way to monitor the garage door from my computer. 

This job took me about 4 hours. My friends and neighbors will be shocked to find out I did it, because my wife is the handy-man around the house. She asks for the power tools for Christmas while I ask for the NewEgg & Best Buy gift cards.  If you are truly handy, this should be a quick and simple project.

The first step was to get me some z-wave hardware. I ordered an Evolve LFM-20 relay and an Aeon Labs Door / Window Sensor.  The LFM-20 would be used to actually open and close the door, while the sensor is used to tell me if the door is currently opened or closed.

Door sensors are sensitive to metal, otherwise I could have mounted them directly to my garage door railing. Instead, I needed to figure out how to raise them "above" the rails and still have the paired sensor halves match up.

I went to my local hardware store and purchased a "Garage Door Top Bracket." After removing part of it and forcefully bending it into a desired shape, I was able to mount it to my garage door along with a sturdy piece of 2x4. This piece would go up and down with the garage door. 

 

 

On the other side I mounted a 2x4 to the fixed side of the door. This part wouldn't be moving anywhere. Here is the finished sensor mount:

 

 

I purchased a $5 plug kit and wired it onto the black/white/green wires of my LFM-20 relay. My garage door opener is conveniently located right next to an outlet, so this worked out great.

 

The next step was to wire the Evolve switch into a parallel circuit with my existing garage door opener button. The "diagram" of how I did it looks like this (please don't mock my artistic ability!)

 

Using InControl, I'm able to monitor my garage door. When it's open past 9 PM, I get a text message at which point I can use my Android phone to close the door.