iRed2 users, UNITE!

Posted on
Mon Apr 11, 2011 6:34 pm
Mark offline
User avatar
Posts: 99
Joined: Apr 21, 2005
Location: California

Re: iRed2 users, UNITE!

Oh, one more one last thing! :)

I don't program my IRLinc to control devices or scenes. In fact, it's programmed to receive codes that intentionally do not control anything in my home! I then teach these dummy codes to a universal remote.

Indigo routes the IRLinc's received codes through an attachment script that parses the codes into AppleScript handlers. From there, they can run anything I want. Anything Indigo can do, and anything else AppleScript can do. The possibilities are endless. No more so than an IRTrans, but I would not characterize them as having "limited uses." No, their weakness is their inability to be programmed by Indigo or anything else intuitive, requiring painstaking manual setup instead...

Posted on
Mon Apr 11, 2011 7:31 pm
dstrickler offline
User avatar
Posts: 275
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRed2 users, UNITE!

Mark wrote:
Oh, one more one last thing! :)

I don't program my IRLinc to control devices or scenes. In fact, it's programmed to receive codes that intentionally do not control anything in my home! I then teach these dummy codes to a universal remote.

Indigo routes the IRLinc's received codes through an attachment script that parses the codes into AppleScript handlers. From there, they can run anything I want. Anything Indigo can do, and anything else AppleScript can do. The possibilities are endless. No more so than an IRTrans, but I would not characterize them as having "limited uses." No, their weakness is their inability to be programmed by Indigo or anything else intuitive, requiring painstaking manual setup instead...


Sounds like we programmed Indigo in a similar way. For the most part, Devices/Modules set variables (via Triggers), and Triggers act on the variable settings, sometimes running scripts. While it may seem redundant to some, the flexibility with the variables pays off in spades.

Dave

Posted on
Mon Apr 11, 2011 7:36 pm
dstrickler offline
User avatar
Posts: 275
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRed2 users, UNITE!

Mark wrote:
Not all IR devices are compatible with each other. Kind'a like DVDs and their players. You'll notice on the IRTrans site they sell a special flavor for a certain type of IR signal. Are your IR lights "normal" or something exotic?


I've been trying to find out the manufacture of the IR light switches without taking apart the wall switch. I bet it's Lutron, but in any event, I doubt it's something exotic. You can buy them at Home Depot.

And yes, the IRTrans are going to be difficult to return. Norm at MacHomeStore has been more than generous when I've needed to return something from Insteon. I doubt I'll have the same luck with an IRTrans crosses the Pond. Thus I want to make super sure it's the right unit to get.

Dave

Posted on
Mon Apr 11, 2011 8:01 pm
Mark offline
User avatar
Posts: 99
Joined: Apr 21, 2005
Location: California

Re: iRed2 users, UNITE!

Well, even if it doesn't work with your IR lights, I'm sure you'll find many other uses for it. I've got mine doing some very cool things.

Worse case, there is a market for them here. I sold one of mine without much effort ( but now wish I hadn't).

Posted on
Mon Apr 11, 2011 9:18 pm
hamw offline
Posts: 891
Joined: Mar 31, 2008

Re: iRed2 users, UNITE!

Mark wrote:
Oh, one more one last thing! :)

Indigo routes the IRLinc's received codes through an attachment script that parses the codes into AppleScript handlers. From there, they can run anything I want. Anything Indigo can do, and anything else AppleScript can do.


Mark,

I am also using the IRLinc, but in my case I've set up Indigo to execute triggers that directly set the variables when it detects an IRLinc code received. Would you post your handler script with a brief explanation?

Posted on
Mon Apr 11, 2011 10:10 pm
Mark offline
User avatar
Posts: 99
Joined: Apr 21, 2005
Location: California

Re: iRed2 users, UNITE!

I stripped my attachment script of most of my code to simplify it for you (it was hundreds of lines long), and then added a few helpful comments. It was designed to handle two IRLincs, so watch for that. But I'll warn you, it was never intended to be shared with others, so it doesn't have a lot of the niceties of Matt's attachments, like creating necessary variables automatically for you, etc., or a decent set of "how to" comments. But everything is there, code-wise, for you to create some useful IR functionality. My unedited version controls lights, fires Actions, sets up my AV system, starts music playing from a choice of playlists, controls my furnace, controls my aquarium pumps and lights, brings up Mail on my TV screen, logs into Netflix, and on and on. Kinda cool all from just one universal remote!

You may need to muttle through it a bit, and you'll need to have an understanding of how to program an IRLinc and corresponding universal remote, etc., which it sounds like you already do.

Oh, and the code is setup to ignore long remote button presses, because I didn't want that. It just responds to quick button presses. But you could adjust that in the script if you need to.

And credit goes to "unknown" because I'm sure I lifted some of this from somewhere/someone else. I just don't remember from whom or where or which parts. Sorry 'bout that... but hey, share and share alike, right?

Have fun,
Mark

Oops, after all my "showin' off"... I don't know how to post an attachment!! :o
Can't seem to get the system to accept a script file or a ZIP. You can PM me with your Email and I'll shoot it over to you, or you can help me figure out how to post it...

Posted on
Tue Apr 12, 2011 12:25 am
dstrickler offline
User avatar
Posts: 275
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRed2 users, UNITE!

If you want an attachment that does Get/Set commands on variables, drop this into your attachments directory and reload your attachments. If you go to Set a variable in AppleScript with it, and the variable doesn't exist, it will create it for you. Note there are a few "log" lines as comments. I leave these in for debugging if I need them later on. Remove if you want.

Code: Select all
--
-- DStrickler April 10, 2011
-- An attachment script to ease working with Indigo variables
--
using terms from application "IndigoServer"
   on SetVariable(indigo_var_name, indigo_var_value)
      # log "Was passed " & indigo_var_name & " and " & indigo_var_value
      if not (variable indigo_var_name exists) then
         log "Creating previously undefined variable " & indigo_var_name
         make new variable with properties {name:indigo_var_name, value:indigo_var_value}
      end if
      set value of variable indigo_var_name to indigo_var_value
   end SetVariable
   
   on GetVariable(indigo_var_name)
      if not (variable indigo_var_name exists) then
         log "ERROR: GetVariable(" & indigo_var_name & ") - variable does not exist"
      else
         set indigo_var_name to value of variable indigo_var_name
      end if
      return indigo_var_name
   end GetVariable
end using terms from

Dave

Posted on
Tue Apr 12, 2011 12:28 am
dstrickler offline
User avatar
Posts: 275
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRed2 users, UNITE!

Mark wrote:
Oops, after all my "showin' off"... I don't know how to post an attachment!! :o
Can't seem to get the system to accept a script file or a ZIP. You can PM me with your Email and I'll shoot it over to you, or you can help me figure out how to post it...


I'm not sure how to do that either. Seems to be a restriction in the Forum software. I've sent you my email via PM.

I have a lot of small scripts for making life in Indigo AppleScript easier, and would be happy to share them with everyone, but I'm not sure where to put them. They are all small enough to post embedded in an email.

Dave

Posted on
Tue Apr 12, 2011 1:02 am
Mark offline
User avatar
Posts: 99
Joined: Apr 21, 2005
Location: California

Re: iRed2 users, UNITE!

We're gettin' off topic here a bit, but I couldn't resist...

One AppleScript coding trick I started using a while back as my collection began to grow:

I now preface all AppleScript handler names with the first three letters of the attachment in which they reside. That way, as my number of attachments grow, I can always tell where to look for a handler when I'm viewing its call from a script embedded in an Indigo Action or Trigger.

For example, when I'm troubleshooting my "Music To TV" Action Group which contains the AppleScript attachment call aud_theaterControl("tv_cable_B, amp_tv_B"), I know it's in the attachment named "audio attachement.scpt"!

Neat-o.

Posted on
Tue Apr 12, 2011 1:15 am
dstrickler offline
User avatar
Posts: 275
Joined: Oct 08, 2010
Location: Boston, MA

Re: iRed2 users, UNITE!

[quote="Mark"]]
I now preface all AppleScript handler names with the first three letters of the attachment in which they reside. /quote]

Clever, but as the count of my attachments begins to grow, I was thinking of consolidating them into a single file. Is there any downside to that? As it's not a compiled language there might be...

Dave

Posted on
Tue Apr 12, 2011 1:16 am
tinbert offline
Posts: 18
Joined: Mar 11, 2006
Location: Falkensee, Germany

Re: iRed2 users, UNITE!

Some hints on learning/triggering codes:

The only real strange IR codes that I know of are those of Bang & Olufon (B&O). They use non-standard frequencies, both in IR (455 KHz vs. ~38 KHz) but also in the means of used IR wavelength. For all other brands, the standard IRTrans will work.

To improve learning, I'll suggest you to opt for an external universal reveiver. This will learn code and frequency. There is one caveat: the universal learning receiver can not be used to trigger iRed, because its reception range is only about 3 ft. Therefore I said "external receiver", so you can use the built-in receiver for triggering. This works for distances up to 20 ft. approx.

For more IRTrans related questions you should visit the forum at IRTrans, and of course info@irtrans.com is also nearby ;-)

Cheers, Robert

tin:b Software - maker of iRed*

Posted on
Tue Apr 12, 2011 1:59 am
Mark offline
User avatar
Posts: 99
Joined: Apr 21, 2005
Location: California

Re: iRed2 users, UNITE!

dstrickler wrote:

Clever, but as the count of my attachments begins to grow, I was thinking of consolidating them into a single file. Is there any downside to that? As it's not a compiled language there might be...


Even after separating my handlers into several attachments, some of them are still so long that finding a single handler is a pain. So much so it necessitated building a table of contents! Literally. I have a list of handler names, including "on", like: "on <handler name>" at the beginning of the code, so that I can select both words at the top of the window and then jump right down to the actual handler by using the Find function (by including "on" in the selection, the FInd will ignore all the other calls to that handler within the script). I have hundreds of handlers, I wouldn't want to have them all in one attachment.

They're separated by "genre:" audio, computer, general, iRLinc, thermostat, etc.

Overhead-wise, I wouldn't know the impact...
Last edited by Mark on Tue Apr 12, 2011 10:16 am, edited 1 time in total.

Posted on
Tue Apr 12, 2011 4:08 am
bschollnick2 offline
Posts: 1233
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: iRed2 users, UNITE!

dstrickler wrote:
Mark wrote:
Oops, after all my "showin' off"... I don't know how to post an attachment!! :o
Can't seem to get the system to accept a script file or a ZIP. You can PM me with your Email and I'll shoot it over to you, or you can help me figure out how to post it...


I'm not sure how to do that either. Seems to be a restriction in the Forum software. I've sent you my email via PM.

I have a lot of small scripts for making life in Indigo AppleScript easier, and would be happy to share them with everyone, but I'm not sure where to put them. They are all small enough to post embedded in an email.


If you would like, I can host the content on my website..... I have, obviously, other Indigo content there, and I am always looking for ways to help the Indigo community...

- Ben

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Posted on
Tue Apr 12, 2011 8:38 am
jay (support) offline
Site Admin
User avatar
Posts: 8618
Joined: Mar 19, 2008
Location: Austin, Texas

Re: iRed2 users, UNITE!

Hey guys, we created the User Contribution Library just for this purpose - zip up your scripts and submit them there for all to find!

If there's a category missing just ask and I'll add it.

If it's small enough, just put it directly into a post in the User Contributions forum in between [code] tags - it provides a nice "Select All" link that will make it easy to copy/paste.

Also, if it's a really small snippit, maybe it should go onto the AppleScript Snippit wiki page - just follow the directions on that page to get it added.

Jay (Indigo Support)
Twitter | Facebook

Posted on
Sat Apr 16, 2011 6:05 pm
hamw offline
Posts: 891
Joined: Mar 31, 2008

Re:

ricks wrote:
And, of course, if you want Indigo to respond to an IR event just put that AS code into your iRed2 Action, e.g.:

Code: Select all
tell application "IndigoServer"
toggle "family room torch"
end tell


However, I also needed a way to update variables within Indigo based on presses of the remote. I did this with the following script:
Code: Select all
using terms from application "IndigoServer"
   on UpdateVariable(varName, VarValue)
      tell application "IndigoServer"
         if (exists variable varName) then
            set (value of variable varName) to VarValue
            log "iRed2 changed variable " & varName & " to " & VarValue
         else
            log "Error - iRed2 is telling Indigo to change a non-existant variable: " & varName
         end if
      end tell
   end UpdateVariable
end using terms from


An then in the iRed2 Action, I have the following applescript:
Code: Select all
--Load script that actually interfaces with Indigo
tell application "System Events"
   set p to file "Macintosh HD:Library:Application Support:Perceptive Automation:Indigo 4:Scripts:iRed2Indigo.scpt"
end tell
set x to load script p

x's UpdateVariable("HET_DVR_ON", "false")


The first part of the script essentially points to the UpdateVariable script and the last line tells tells the Indigo variable (first parameter) to become the second parameter.



I am thinking of migrating from the IRLinc to IRed/IRTrans for receiving codes. I did a search for the "iRed2Indigo" script and did not find it -- or is the middle script above the handler script? Also, in the last script's line:

x's UpdateVariable("HET_DVR_ON", "false"

I haven't seen "x's" used in a script. Is that just clarification or part of the script? Why is the third script necessary if the handler is loaded as an attachment?

If someone could post a screen shot or two of where to put the AppleScript in the IRed trigger/action pages, that would be great.

Who is online

Users browsing this forum: No registered users and 0 guests