Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Stuck using trigger Boolean field Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 09:28 | IP Logged Quote judetf

I have a normal SwitchLinc that controls a bedroom light. I would like to create a situation where, if the light is on and you press the 'off' button the light turns off normally, but that if the light is already off and you press off, it fires a trigger (to turn the light on to a specific low-level).

But I can't seem to setup the Boolean field to prevent the trigger from firing if the light is already on (meaning that when I press the SwitchLinc to turn the light off it turns off but then the trigger fires and turns the light back on), and am getting results that confuse me.

After failing to make it work with LOCAL9 and LOCAL10 variables, I decided to go for something more simple and set the Boolean to be: ph_getinsteonlevel("LIGHT") = 0

Right now the light is on, and if I evaluate that Boolean field it evaluates to 'false'

But when I press the SwitchLinc to turn the light off, the trigger fires! And I don't get it, and would appreciate someone pointing out what I am doing stupidly.

I know there is probably a better way to compose the Boolean field, and I'm all for it, but I'd also like to understand why the trigger fires when, if I evaluate the Boolean before pressing the button that actually calls the trigger, it evaluates to false.

Thanks,
jtf
Back to Top View judetf's Profile Search for other posts by judetf
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: January 09 2010 at 09:38 | IP Logged Quote BeachBum

Is this what you are trying?

if (ph_getinsteonlevel("LIGHT") = 0, 0,1)


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 09:43 | IP Logged Quote judetf

That's not the actual code I'm using - What I posted above is the code I'm trying.

But that probably explains it: do I need the Boolean field to return a 1 or a 0 rather than a true/false? I guess that would explain my problem, and I'll give that a try. Thanks.

Although if the light is off I want to evaluate to 1, so I'm switching what you wrote to
if (ph_getinsteonlevel("LIGHT") = 0, 1,0)

Thanks!
jtf
Back to Top View judetf's Profile Search for other posts by judetf
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: January 09 2010 at 09:59 | IP Logged Quote BeachBum

I really didn’t understand which way your trying to go but the end result is 1 if to trigger otherwise do nothing is 0.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 09 2010 at 12:10 | IP Logged Quote TonyNo

What type of trigger are you using?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 15:24 | IP Logged Quote judetf

Still not working correctly.

It's a 'device change' trigger set to fire when the light is turned off, but the action is a raw formula to turn the light back on.

So the trick I'm trying to accomplish is to only have the trigger fire if the light is already off when the switchlinc 'off' button is pressed.

If the light is on, then the trigger shouldn't fire, so that the light turns off normally. If the light is already off, then I want the trigger to fire and have it turn the light on to a specific level via. That part works just fine. The problem is that the trigger is firing _every_ time I press the 'off' button, rather than only when the light is already off. Again, it's almost as if the Boolean field is being ignored.
Back to Top View judetf's Profile Search for other posts by judetf
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 15:35 | IP Logged Quote judetf

Okay, maybe the logs explain things, as the trigger seems to be firing twice in response to two different things (even though I'm only pressing the button once).

Immediately after the press, I see this:
Insteon DM Controller PLM transmission of Address:[0D.1F.62] Flags:[15] Cmd1:[19] Cmd2:[0]. Decode: Direct. ID: LIGHT, Off

Then the trigger fires

Then a split-second later, I see:
Incoming Insteon received on Insteon DM controller PLM. From Address:[0D.1F.62] To Address:[0F.D5.22] Flags:[35] Cmd1:[19] Cmd2:[0]. Decode: Direct ACK. From: LIGHT To: PLM, Off

Then the trigger fires again, followed by a an Insteon Out that turns the light back on.

So it must be that second string that I pasted which is causing the trigger to fire a second time and the Boolean value to be true (since the light is now off).

So can someone help me understand what that second string above means, and how I can prevent it from happening?
Back to Top View judetf's Profile Search for other posts by judetf
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: January 09 2010 at 15:36 | IP Logged Quote BeachBum

1st you might try changing it to RT if (ph_getinsteonlevelRT("LIGHT") = 0, 1,0) but that response will be slow. Secondly Dave did not recommend running Insteon commands from the Boolean field in a trigger. It might be the level is not updated from a remote device until after the trigger has been received. If Lee is not raking leaves today maybe he’ll chime in.

EDIT: "Ships passing in the night" You might be able to block it with “trigdisable”. Search and you will find Dave’s comments on this.

Edited by BeachBum - January 09 2010 at 15:41


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 16:18 | IP Logged Quote judetf

My first efforts were to use LOCAL9 and LOCAL10, but that didn't seem to work, either.

As I understand it, LOCAL9 contains the value that the light was already at and LOCAL10 contains the new value that is being passed.

Given what I'm trying to accomplish, I only want the trigger to fire if both are 0.

Hmm, now that I think about it, I think I screwed that up when I was testing with LOCAL variables earlier. Let me try again with this as my Boolean [LOCAL9] = 0 and [LOCAL10] = 0

That might be it...
Back to Top View judetf's Profile Search for other posts by judetf
 
judetf
Senior Member
Senior Member


Joined: January 23 2008
Online Status: Offline
Posts: 234
Posted: January 09 2010 at 21:05 | IP Logged Quote judetf

That was it. This was all a false alarm, because I couldn't think through my variables correctly.

Boolean = [LOCAL9] = 0 and [LOCAL10] = 0

That did the trick. Now the trigger action only happens if the light was already off when I press the off button.

Sweet, and sorry for the confusion.
jtf
Back to Top View judetf's Profile Search for other posts by judetf
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum