Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Macro Locking Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: January 21 2010 at 21:09 | IP Logged Quote MrGibbage

I have a macro that responds to infrared commands. I have found that PH is too responsive
sometimes. I say that like it's a bad thing.... and it kinda is. Sometimes a macro will get
executed several times in rapid fire succession if someone is a little "thumb heavy". So I
decided to put a little delay and lock in there so the macro would only run once every 1/2
second. I did this with the following commands

10, GOTO LABEL, if ({IR_LIGHTING_LOCK}=1,"END","CONTINUE")
20, LABEL, CONTINUE
30, SET GLOBAL, IR_LIGHTING_LOCK, 1
40 - 200 my lighting commands
210, FORMULA, ph_delay(500)
220, SET GLOBAL, IR_LIGHTING_LOCK, 0

If step 10, 20 & 30 execute fast enough, they should stop another macro from running at the
same time. Well, it's not quite fast enough (or my coding is at fault). I still get
multiple macro executions. Is there a better way to do this? ph_ismacrowaiting won't work
because sometimes the macro is executing, but not waiting, so that function won't catch it.
Anyone else find a clever way to prevent this anomaly?
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: January 21 2010 at 21:56 | IP Logged Quote grif091

There is a PH post somewhere that describes the technique of disabling the trigger that fires the macro rather than have the macro deal with it.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: January 21 2010 at 22:05 | IP Logged Quote MrGibbage

Great idea. The formula is ph_disabletrigger(s). I'll
give that a shot.
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
BeachBum
Super User
Super User
Avatar

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

Trust me it works….

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: January 22 2010 at 06:38 | IP Logged Quote MrGibbage

Well, it works, but now I have revealed another problem.

I put a 15 second delay at the end of the macro, but before the ph_enabletrigger statement. One would think this would
definitely stop any double events. So, I press the lights off button. Great, the lights turn off. But then like 20
seconds later, after my wife turned the lights back on (I shouldn't test my lighting macros in the bathroom where she is
getting dressed), the lights turned back off again. Without me pressing any buttons. So, I check the logs, and sure
enough, the trigger was fired twice, about 20 seconds apart. So, I yell "Sorry" to my wife, and the lights turn off
again, this time about 30 seconds later. And again, and again.

So tonight when I get home, I will have some troubleshooting to do. There are so many moving parts in this, that it will
take a real detective to figure out if it is the USB-UIRT, the Harmony remote, the IR repeater that I use, PowerHome, or
something else. But something is causing the trigger to continue to repeatedly fire minutes after pressing the button on
the remote.
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
BeachBum
Super User
Super User
Avatar

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

This is the delay I use without any added Waits or Delays.
ph_macroparm("trigdisable",5,0,0,0,0) + 1
Also Jumper 4 is in On-Only-Mode.


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: January 22 2010 at 09:35 | IP Logged Quote MrGibbage

Wow, I thought I was pretty good at this... until I read your post. I can't decipher even a single
sentence of what you wrote. Yikes! I know that ph_marcoparm(s,a,a,a,a,a) is used to play a PH
macro and pass 5 optional parameters in the LOCALX variables. So, my guess is, your trigdisable
macro disables a certain trigger (how does it know which one) for ?5? seconds? What is the +1 on
the end of the formula for? And what did you mean by "Jumper 4 is in On-Only-Mode". Sorry, that
one went right over my head.

I'm so not worthy :)

Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
BeachBum
Super User
Super User
Avatar

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

Sorry about the confusion. You place this in the Boolean field of the specific trigger you are using. You are correct in that this will pass variables to the macro this calls. The 5 is the number of seconds I’m passing to the macro “trigdisable”. The +1 is so the trigger is fired. If you look at all your triggers they have 1 in the Boolean field. The trigger will call the “trigdisable” to not allow this trigger to fire again for 5 seconds at the same time calling your macro that you specified to run. The jumper is inside the Insteon 2420M motion Sensor assuming that is what you are using. If not there might be an option in another brand that does not do a OFF after the internal time out.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: January 22 2010 at 10:38 | IP Logged Quote grif091

Pete,   and I thought I was getting old and absent minded. MrGibbage is using a Harmony IR remote through a USB-UIRT that is causing the extra triggers. No motion sensor involved. Maybe one of those palm fronds hit you in the head    

MrGibbage, Pete was using his motion sensor trigger disable to eliminate multiple triggers from a motion sensor. Those devices issue multiple Group Broadcast messages which results in PH driving the Trigger for each Group Broadcast. I've not heard of anything in PH generating false trigger events. I suspect that if a trigger is firing it is the result of the trigger condition occurring.


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

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

You may be getting old but as I remember I’m older so I forgot.     But anyways “trigdisable” should still apply if he is getting multiple receives. I also found I had to position my USB-UIRT to the right distance to eliminate false signals. I hear another palm frond about to fall.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: January 22 2010 at 12:37 | IP Logged Quote MrGibbage

Whoo.... I was really starting to wonder. Jumpers???? Now it all makes sense. Wow, I was really
starting to feel quite humbled.

Thanks for providing another way to do this. Right now I just use ph_disabletrigger("mytrig") as
the first line of the macro, and then I put ph_enabletrigger("mytrig") as the last line. And I put
a WAIT 15 as the second to last statement. Once I figure out what is causing the extra triggers, I
want to move that WAIT down to 1 second, or even 0.5 seconds.

And yes, this has nothing to do with motion sensors.
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
BeachBum
Super User
Super User
Avatar

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

Unless you move it to the Boolean it most likely will not disable the trigger in time to stop multiple triggers from stacking up..

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: January 23 2010 at 16:29 | IP Logged Quote Viper

When I have a device that causes a double trigger, I use this in the Boolean field "ph_disabletrigger("[TEMP1]") + 1". Saves me having to code something different for each trigger.

Tom
Back to Top View Viper's Profile Search for other posts by Viper
 

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