iRule iPhone/iPod touch remote and Indigo...

Posted on
Sat Jan 15, 2011 10:55 pm
ecrabb offline
Posts: 16
Joined: Feb 07, 2007
Location: Utah

iRule iPhone/iPod touch remote and Indigo...

I thought I'd just post here to say how thrilled I am to have iRule and Indigo working together. I guess thought it should have been more complicated, but it turned out to be cake. I used the http PUT strings, and I iRule is now talking directly to Indigo and and it's working flawlessly!

http://perceptiveautomation.com/wiki/do ... stful_urls

I'm stringing together multiple commands and devices, so for instance, when I press the "System Power On" button on my iPhone, it turns the PS3 on (IR via GC gateway), turns my preamp/processor on (via IP), turns on the projector hush box fan (via Indigo X-10), and turns the projector on (IR via GC gateway).

Then, I can tap the lights button to go the page for lighting control, tap a button, and it triggers my Indigo action group called "HT Lights Off", which turns off the overhead lights, turns off the screen splash and screen "halo" light, but leaves on the rope light on the lip of the riser.

So cool! I love Indigo and iRule!

Indigo + iRule = Home theater control nirvana.

SC

http://www.iruleathome.com
http://www.globalcache.com/products/gc-100
Last edited by ecrabb on Sat Jan 15, 2011 11:08 pm, edited 2 times in total.

Posted on
Sat Jan 15, 2011 11:00 pm
ecrabb offline
Posts: 16
Joined: Feb 07, 2007
Location: Utah

Re: iRule iPhone/iPod touch remote and Indigo...

Oh, one more question... Is there a URL to do the equivalent of pressing the blue dim/bright buttons on the X-10 wireless remotes? I didn't see it on the wiki page... There's one to set an absolute brightness level:

devices/office-lamp?brightness=27&_method=put

But I didn't see one for anything "relative".

Thanks!
SC

Posted on
Sun Jan 16, 2011 4:28 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: iRule iPhone/iPod touch remote and Indigo...

Unfortunately, the Indigo Web server doesn't currently have a hook for relative dim/brighten commands. I'll add it to the list, however, and we'll try to get it into a future version.

Image

Posted on
Sun Jan 16, 2011 4:49 pm
ecrabb offline
Posts: 16
Joined: Feb 07, 2007
Location: Utah

Re: iRule iPhone/iPod touch remote and Indigo...

No biggie, Matt! Awesome! Thanks!

SC

Posted on
Sat Feb 05, 2011 7:58 pm
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: iRule iPhone/iPod touch remote and Indigo...

I tried using the http put strings in the Indigo RESTful Overview, but I ran into two issues. I have Indigo running on my Mac mini, so for testing I sent the http put strings from a browser on my Macbook:

- Original example:
Code: Select all
http://127.0.0.1:8176/devices/Family-Room-Table-Lamps?toggle=1&_method=put


This works fine on the Mac mini, but does not work on my laptop. Safari can't find the server.
So I used Bonjour to find out the local name. I modified the put string, and it worked, but it asked me for a user name and password:

- Modified example:
Code: Select all
http://my-mac-mini-2.local.:8176/devices/Family-Room-Table-Lamps?toggle=1&_method=put


Once I logged in, it worked just fine, and I was able to send any of the put strings. I would like to come up with a general way to send the put strings to Indigo from any device or system on my network.

1. Is this the right address to send the put string on my local network?

2. What's the best approach to the username/password problem? Is there a way to send it in the put string?

Thanks in advance for your help.

Posted on
Sun Feb 06, 2011 7:13 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRule iPhone/iPod touch remote and Indigo...

The reason the "127.0.0.1" address only worked from the MacMini, is that's a special IP address that always means "this computer". So, you can us that address on any computer, and it will always point to itself. It's handy for certain situations, but not for yours.

The Bonjour address will work as long as you are using a Mac to access the MacMini (well, that's 90% true), but I'd use a different method so it will work from any device on your local network. I'd find out the IP address of that MacMini on your network, and use that. My guess is it starts with "192.168.1." or "10.0.0.".

To find out your exact address, go into the MacMini and pull down the Apple menu and choose "System Preferences". Then go into the Network setting (you may need to click "Show All" first) and find your network connection on the left. It's probably "Airport" if your MacMini is on WiFi, but it may be "Ethernet" - click on it to select it. Then click on "Advanced" at the bottom right of the window, and then on the "TCP/IP" tab at the top. There is should list an "IP4 Address". You can then use that IP address (instead of 127.0.1 or the Bonjour address) from any computer on your network, in this case your house, including the MacMini. Note that if you change routers, or replace your MacMini, that IP address might change, but you can always check it again using the same method. And yes, it can be fixed so it never changes.

As for the user/password issue, check out the thread on viewtopic.php?f=9&t=6439 . It shows the issue in passing a user/pass in the format http://user:password@the.ip.add.ress . It can be a little tricky, so let me know if you need further help.

Dave

Posted on
Mon Feb 07, 2011 1:43 am
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: iRule iPhone/iPod touch remote and Indigo...

It works! Thanks so much for the help.

For completeness, in case anyone else wants to set up an iRule gateway to Indigo for http put strings from the Indigo RESTful Overview:

1. Indigo is running on my Mac mini. In System Preferences/Network, I set up:
- Configure IPv4: Using DHCP with manual address
- IP Address: 10.0.1.100

I did this so that the IP address of the Mac Mini (which is connected via wired ethernet) would never change through DHCP when I restarted it (I am using an Airport Express Router, which assigns DHCP addresses from 10.0.1.2 to 10.0.1.200).

2. Check to see if Authentication (User and Password) is required in your Indigo Local Server (Indigo4/Start Local Server.../Require Authentication)

3. If there is no Authentication checked, then the http put string for Indigo to toggle my Family Room Lamps from any machine on my network is:

Code: Select all
http://10.0.1.100:8176/devices/Family-Room-Table-Lamps?toggle=1&_method=put


If there is Authentication checked, then you need to put your username:password@ in the put string like this:

Code: Select all
http://teejay6:secretpassword@10.0.1.100:8176/devices/Family-Room-Table-Lamps?toggle=1&_method=put


4. For iRule:
- the HTTP Gateway on the iRule iPhone and iPad app is:
    - No Authentication: 10.0.1.100:8176/
    - Authentication checked: teejay6:secretpassword@10.0.1.100:8176/

- the iRule Builder Devices/Actions/Device/Network Codes are the same with or without Authentication:
- 'Light Toggle On/Off' Properties
    - name: Light Toggle On/Off
    - data: /devices/Living-Room-Table-Lamp?toggle=1&_method=put

The result is a general gateway, with device specific commands. It is really very cool.

Posted on
Mon Feb 07, 2011 9:53 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: iRule iPhone/iPod touch remote and Indigo...

Just an FYI - while you may never have a problem with it, you should never manually assign an IP address that DHCP may assign - so since your AE assigns ranges from .2 - .200, you should use something outside that range - like 201. Or just change the AE assign range to .9-.99 or something.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 07, 2011 2:26 pm
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: iRule iPhone/iPod touch remote and Indigo...

Thanks. I changed the address to .201 and it still works perfectly.

Posted on
Mon Feb 07, 2011 2:50 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: iRule iPhone/iPod touch remote and Indigo...

How would you send a command to your system when outside the house? Use your IP address then string :8176 etc?

Posted on
Mon Feb 07, 2011 6:21 pm
dstrickler offline
User avatar
Posts: 340
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRule iPhone/iPod touch remote and Indigo...

hamw wrote:
How would you send a command to your system when outside the house? Use your IP address then string :8176 etc?

Yes, just make sure your firewall port 8176 (via TPC) is open to map from the outside address to the inside address (10.0.1.201). Same thing you do when you're using the iTouch client remotely. But beware...

When you open up your port to the outside world via your firewall, you must, must, must use a username/password combo. Hackers are sure to get in without it, and when they do, it's a living hell. Seriously.

So open up the port and enjoy how it works, but please use a a secure password!

Dave

Posted on
Tue Feb 08, 2011 9:54 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: iRule iPhone/iPod touch remote and Indigo...

Or, better yet, use the Prism Reflector. No firewall fidgeting or security issues...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 21, 2011 11:02 pm
rlust offline
Posts: 93
Joined: Jan 12, 2009
Location: Ohio

Re: iRule iPhone/iPod touch remote and Indigo...

Just trying out iRule, and trying to get a button to control a light.

I am trying to use http put
Here is the data that I assigned the button, but it is not working.
devices/Office?toggle=1&_method=put

I have the device set to my ip address of the indigo server and the port set to 8176

Any ideas on what I am doing wrong?

Thanks for any help!

Posted on
Mon Feb 21, 2011 11:54 pm
ecrabb offline
Posts: 16
Joined: Feb 07, 2007
Location: Utah

Re: iRule iPhone/iPod touch remote and Indigo...

rlust wrote:
I am trying to use http put
Here is the data that I assigned the button, but it is not working.
devices/Office?toggle=1&_method=put

I have the device set to my ip address of the indigo server and the port set to 8176

Hmm... That all looks good to me... The only thing I can think of is that maybe you're using the wrong device type in the builder, or the iRule gateway is misconfigured on your device.

Check those two things:
1) In the builder, make sure you're putting your commands in the "Network Codes" device subtype.
2) In iRule, make sure add the gateway as "HTTP", and connect the Indigo device from the builder to that.

Your command looks fine, so see if maybe of one of those two things isn't quite right. If not, post back and we can go from there.

Cheers,
SC

Posted on
Tue Feb 22, 2011 12:30 am
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: iRule iPhone/iPod touch remote and Indigo...

rlust wrote:
Just trying out iRule, and trying to get a button to control a light.

I am trying to use http put
Here is the data that I assigned the button, but it is not working.
devices/Office?toggle=1&_method=put

I have the device set to my ip address of the indigo server and the port set to 8176

Any ideas on what I am doing wrong?

Thanks for any help!



1. Try putting the "/" in front of the data. This is how I set up mine (as Network Code in the Device in iRule Builder):

/devices/Office?toggle=1&_method=put

2 HTTP Gateway: do you have a password on your Indigo Server? Under menu item Indigo 4 -> Start Local Server, if you have "Require Authentication" checked with a User and Password, you have to set up the gateway in iRule as (substitute your User, PW, and IP address of course)

user:password@10.0.1.201:8176/

Otherwise, it is just 10.0.1.201:8176/

Hope this helps. Once the gateway it works, it is very cool.

Who is online

Users browsing this forum: No registered users and 2 guests