Posts: 659
Threads: 82
Joined: Nov 2007
How did people setup Insteon lights so they can be controlled by a remote? Did you just take any remote codes, that you will NOT be using, and program an Insteon light to a button press on the remote in the USBUIRT Receiver tab?
I have a USB-UIRT and want to control the lights from a key press. But how do I do the On/Off and Dim/Bright? Figured for ON/OFF I can just have a IF/Else so if light is already on, above 50% then turn off else turn on. Therefore a single keypress will do the On/Off for one light.
Posts: 40,483
Threads: 491
Joined: Aug 2002
If you have two way access, you can always provide buttons for up/down by 10% or something, so that a few presses can get them to where they want pretty quickly for anything other than full on or off.
Dean Roddey
Explorans limites defectum
Posts: 659
Threads: 82
Joined: Nov 2007
So you are saying then that I need 4 buttons for each light? 1 for Bright 10%, 1 for Dim 10%, 1 for On and 1 for Off?
Posts: 40,483
Threads: 491
Joined: Aug 2002
Oh, no. I was saying that, if you have two way access, you can have a button that increases it by 10% and another that decreases it by 10 percent. Just read the current value, subtract 10. If it's below 0, put it back to zero. For increment, read the value, add 10. If it's over 100, put it back to 100. Then write the new value back.
Dean Roddey
Explorans limites defectum
Posts: 659
Threads: 82
Joined: Nov 2007
So I Read the value and store in a variable and then Write the value +10? So for the value in the write I tried "GVar:Test+10" but it does not work. How do I add 10%?
Posts: 1,763
Threads: 76
Joined: Jun 2007
You would use the Add method of the variable so in the action it would look something like the code below for the increment.
Code:
LocalVars::SetVariable(LVar:Temp, $(Moniker.FldName))
LocalVars::Add(LVar:Temp, 10)
If System::GrThan(%(LVar:Temp), 100)
LocalVars::SetVariable(LVar:Temp, 100)
End
Devices::FieldWrite(Moniker.FldName %(LVar:Temp))
Posts: 659
Threads: 82
Joined: Nov 2007
This is what I did so it is like X10 where you select the unit and then Dim, Bright, On or Off.
In the Receiver New mode I create a mapped action for each Insteon device, ex here FRCOMPUTER:
Devices::FieldWrite
P1=Variables.Insteon-Unit
P2=Insteon.FRCOMPUTER
Then I created another mapped action for the On, Off, Dim & Bright. This one is for Dim:
Devices::FieldRead
P1=$(Variables.Insteon-Unit)
P2=LVar

im
LocalVars::Subtract
P1=LVar

im
P2=10
System::LsThan
P1=%(LVar

im)
P2=0
LocalVars::SetVariable
P1=LVar

im
P2=0
End
Devices::FieldWrite
P1=$(Variables.Insteon-Unit)
P2=%(LVar

im)
Now when I want to change the lights I press a button on the remote for the Insteon device and then say Dim and that light will Dim.
Posts: 659
Threads: 82
Joined: Nov 2007
Lost this setup when my HD crashed and just added it back now. But it is not working. Have beta ver 26 and I believe it is not working at the write command to the light
Devices::FieldWrite
P1=$(Variables.Insteon-Unit)
P2=0
If I put Insteon.FRCOMPUTER in P1 then it works. If I look at Variables.Insteon-Unit the value there is Insteon.FRCOMPUTER. So why is it not working?
Posts: 40,483
Threads: 491
Joined: Aug 2002
$ is for field tokens, not for variables. Use %(Variables.Insteon-Unit)
Dean Roddey
Explorans limites defectum
Posts: 1,763
Threads: 76
Joined: Jun 2007
It looks like the Insteon-Unit is a field in the Variables driver that contains the string value for a particular field for his Insteon driver. If the driver or field wasn't valid he should have gotten a token expansion error when using the $.
Are you getting any type of error when using this action? If not it would suggest it is completing ok. Is the value of Insteon.FRCOMPUTER something other than 0 when you try and write a 0 to it? Try and set up a dummy field in your variables driver like TestValue and then set the Variables.Insteon-Unit to Variables.TestValue and see if the action correctly updates this TestValue field in your Variables driver. If so then you are pretty sure the action is sending what it is supposed to.
It's the early bird that catches the worm, but it's the second mouse that gets the cheese...