Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Trigger running twice Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 17 2020 at 12:53 | IP Logged Quote kkomara

Dave,
I am having an issue where a TRIGGER is being fired twice.
I had issues attaching the screen prints to this post - so I sent you an email with the screen prints of the setup.
Thanks,
Kevin K.

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 20 2020 at 18:44 | IP Logged Quote dhoward

Kevin,

Got your email with the screenshots. A trigger firing multiple times is a common pervasive problem with Insteon with several different
ways to resolve depending upon your ultimate goal.

That happens is that when you manually control an Insteon device (such as a KeyPadLinc button), the Insteon device first sends 1 or
more group broadcast commands. Usually Insteon devices plugged into the mains power will send a single group broadcast with battery
powered devices sending 3 or more group broadcast commands. Now due to how all Insteon devices (not battery powered) repeat Insteon
commands (the mesh networking), it's possible to receive the group broadcast command multiple times even if it was sent a single time.

Following the group broadcast command(s), the device will typically send a group cleanup command to each device that is a responder to
the group command. This is interrupted if another Insteon device sends a command. Lastly, if it's a newer device, it will send a
success/fail broadcast command that sums up the number of group cleanup commands were or were not sent. I can see this in your log
screenshot you sent.

PowerHome has separate triggers for firing on the Group Broadcast and Group cleanup commands. The problem with Insteon, is that group
broadcast commands are not sent to individual devices and are just broadcast with no acknowledgement. It is received or not, the
sending device does not know. That is why it is sometimes sent more than once. A group cleanup command is a direct command to a single
device and has an acknowledgement. The sending device "knows" if the command was received or not. The problem is that group cleanups
arent always sent.

One way to combat multiple trigger fires is to use an "Insteon Device Chg" trigger rather than an "Insteon Group In" trigger. This
trigger will fire on *ANY* Insteon command that would result in possibly updating the status of an Insteon device. Insteon direct
commands, Group Broadcast, Group Cleanup, etc. By placing the following formula in the "Boolean" column:

ph_getvar_n(2,9) <> ph_getvar_n(2,10)

will cause this trigger to fire ONLY if the status changes. If you have a KPL device and you create an "Insteon Device Chg" trigger on
one of the buttons, assuming the button is currently off, when you press that button, it will send a group broadcast "On" command
followed by possibly a group cleanup "On" command and possibly a Group Success/Fail commmand. The PLM when it hears the incoming group
broadcast "On" command will check the trigger and compare the [TEMP9] variable to the [TEMP10] variable and if they are different, the
trigger will fire (TEMP9 and TEMP10 are the current status value and new status value for the device). If the device is currently Off
(as it should be since the button was off) then the current and new values will be different. If a group cleanup or another group
broadcast command come in, the trigger will again be checked but in this case the current and new values will be the same so the
trigger will not fire.

Another way to prevent multiple is to temporarily disable the trigger when an incoming command is received. This would typically be
done using your Insteon Group In trigger. When an initial Insteon Group In is received, in the Boolean field, you would want to
disable the trigger, start a timer, and then re-enable the trigger.

You can find more info on this as well as the previous method at this forum post: http://www.power-home.com/forum/forum_posts.asp?
TID=2132

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 20 2020 at 21:58 | IP Logged Quote kkomara

Dave,
Well I researched the form for 2132. I liked the idea of the trigger disable/wait/enable. So I created the MACRO TRIGDISABLE. I switched my trigger from group to Insteon Device Chg ANY ANY. I put ph_macroparm("TRIGDISABLE",5,0,0,0,0) + 1 in the Boolean. Then I pushed the button on my 6 button controller - and it worked perfectly... - trigger only ran 1 time - except I had a typo in the 3 line in my MACRO - so the trigger never got re-enabled. I could see the error in the log. So I fixed the typo - and restarted PH - and cleared the log. But the trigger is not firing anymore :-(
How do I get the trigger to be re-enabled ??

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 20 2020 at 22:23 | IP Logged Quote kkomara

Dave,
Never mind. I figured out what the "Trigger ID" was and ran the ph_enabletrigger manually with the Trigger ID as string and now the events for that device are firing again. This also fixed the issue I was having with multiple triggers firing too !!! Really cleans things up !!
Thanks man !!
Kevin K.

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 20 2020 at 22:39 | IP Logged Quote kkomara

Dave,
BTW - I did try this:
ph_getvar_n(2,9) <> ph_getvar_n(2,10)

with the trigger set to "Insteon Device Chg", Any, Any
But the trigger still ran 3 times.
I guess I would like to get this to work too - what am I doing wrong ?
Thanks,
Kev

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 21 2020 at 06:36 | IP Logged Quote kkomara

Dave,
Well I researched the form for 2132. I liked the idea of the trigger disable/wait/enable. So I created the MACRO TRIGDISABLE. I switched my trigger from group to Insteon Device Chg ANY ANY. I put ph_macroparm("TRIGDISABLE",5,0,0,0,0) + 1 in the Boolean. Then I pushed the button on my 6 button controller - and it worked perfectly... - trigger only ran 1 time - except I had a typo in the 3 line in my MACRO - so the trigger never got re-enabled. I could see the error in the log. So I fixed the typo - and restarted PH - and cleared the log. But the trigger is not firing anymore :-(
How do I get the trigger to be re-enabled ??

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 21 2020 at 11:08 | IP Logged Quote kkomara

Sorry for the double post...

I would like to get this working:

ph_getvar_n(2,9) <> ph_getvar_n(2,10)

Would be even cleaner than the disable/enable events.
thanks,
Kevin


__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 25 2020 at 19:44 | IP Logged Quote dhoward

Kevin,

The trigger disable macro would typically be used with Insteon Group In instead of Insteon Device Chg.

To use the ph_getvar_n(2,9) <> ph_getvar_n(2,10), this is intended for only the Insteon Device Chg trigger. Before we go into how to get it fixed,
keep in mind that this is designed to capture when the Insteon Device status actually changes. If you're planning on running triggers where you might
press the "On" key and want to trigger on that result and then later on, press the "On" key again (without having sent an "Off" command) and have the
trigger fire again, this method will not work. If you always intend to follow an On with an Off or vice versa before sending another On or Off, then
we can proceed.

To briefly explain why it won't work above, when you press the first "On", the boolean field compares the current value with the new incoming value.
If they're different, then the trigger will fire. If they're the same, then the Boolean keeps the trigger from firing because the current value and
new incoming value are not different.

With that out of the way, the reason why it's executing multiple times is a typo on my part. ph_getvar_n(2,9) gets the [TEMP9] variable as a number.
Similarly, ph_getvar_n(2,10) gets the [TEMP10] variable as a number. The actual current and incoming values are in the [LOCAL9] and [LOCAL10]
variables. Try changing your boolean formula to:

ph_getvar_n(1,9) <> ph_getvar_n(1,10)

or you could also use:

[LOCAL9] <> [LOCAL10]

I usually recommend the former because you can get an error if the LOCAL9 or LOCAL10 doesnt actually contain a number value (plus it's just barely
faster).

Let me know if it fixes it for you.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
kkomara
Newbie
Newbie
Avatar

Joined: June 02 2017
Location: United States
Online Status: Offline
Posts: 31
Posted: December 26 2020 at 09:12 | IP Logged Quote kkomara

Thanks Dave !!! Everything is working now - but still pretty messy. The root reason for all of this is I am trying to keep my PH Device Status in sync with my 6/8 button 2334-232 controller's button lights. Real pain in the butt !!! I must be missing something stupid...
I will start a new thread on this effort.

__________________
Kevin Komara
Back to Top View kkomara's Profile Search for other posts by kkomara
 

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