Author |
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 26 2007 at 20:25 | IP Logged
|
|
|
Hi - I could swear this was answered before but I can't find the post.
I would like to create a trigger that senses and responses to a double-press (say, within 2 seconds) on a ControlLinc. That way, a double-press (or even, a triple-press) can do a different function than a single press. I believe there is a way to do this but I haven't found it yet.
Thanks!
/j
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 26 2007 at 20:32 | IP Logged
|
|
|
No ControlLinc here, but you may be talking about an On/Off and a Fast On/Off (double tap). They have separate triggers.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 26 2007 at 20:46 | IP Logged
|
|
|
Hi Tony - Controlinc doesn't respond to double-tap.
Actually, I think it's coming back to me, so i'll post for others. I think you could use a global variable and a couple of macros.
The button press would always trigger one macro, but that macro would trigger two others simultaneously, based on global variable FOO
MACRO A)
if FOO = 0, set FOO = 1.
else { set FOO = 0
call double-press macro
}
MACRO B)
wait 2 sec
if FOO = 1, {
set FOO = 0
call single-press macro.
}
Though i can't help but wonder if there's a more elegant way....
/j
Edited by jeffw_00 - November 26 2007 at 20:47
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: November 26 2007 at 20:58 | IP Logged
|
|
|
That's pretty elegant.
PH's Multi-X is the X-10 version of this. Very handy, but no Insteon equivalent as of yet.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 02 2007 at 11:30 | IP Logged
|
|
|
Hi - here's the code to do double press. The top-level macro is "DOUBLEPRESS". It takes 5 arguments
1) the name of the macro to execute for single-press (ONEPRESS in this example)
2) a value that can be passed to the single-press macro
3) the name of the macro to execute for double-press (TWOPRESS in this example)
4) a value that can be passed to the double-press macro5) the name of a GLOBAL VARIABLE, unique to the button being press, used as a 'state' variable for determining whether it's a single or double press. (BTNPRESS in this example)
an example of a macro that would call DOUBLEPRESS is called BUTTONPRESS (shown at the bottom), although, you are more likely to put the call into a formula in a trigger.
You can import these formulas by pasting them into the Multi-Editor (or paste them into a file and Open it from the Multi-Editor)
If you're going to play with this, you need to create macros ONEPRESS and TWOPRESS, but they can be empty. I assigned a CCPanel button to BUTTONPRESS and watched the progress in PHStat.
Thanks guys, for teaching me how to do this.
enjoy
/j
INSERT INTO macrodetail VALUES (
'DOUBLEPRESS',
1,
38,
'',
0,
'ph_macroparm("DBLPRESS1","[LOCAL1]","[LOCAL2]","[LOCAL3]","[LOCAL4]","[LOCAL5]")',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS1',
1,
16,
'',
NULL,
'if(ph_getglobal_n("[LOCAL5]") = 0, 1, 3) ',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS1',
3,
16,
'',
NULL,
'999',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS1',
5,
38,
'',
0,
'ph_macroparm("[LOCAL3]","[LOCAL4]",0,0,0,0)',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS1',
2,
38,
'',
0,
'ph_setglobal_a("[LOCAL5]",1)',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS1',
4,
38,
'',
0,
'ph_setglobal_a("[LOCAL5]",0)',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS2',
2,
16,
'',
NULL,
'if(ph_getglobal_n("[LOCAL5]") = 1, 1, 999) ',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS2',
4,
38,
'',
0,
'ph_macroparm("[LOCAL1]","[LOCAL2]",0,0,0,0)',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS2',
1,
31,
'',
NULL,
'3',
0,
'');
INSERT INTO macrodetail VALUES (
'DBLPRESS2',
3,
38,
'',
0,
'ph_setglobal_a("[LOCAL5]",0)',
0,
'');
INSERT INTO macrodetail VALUES (
'BUTTONPRESS',
1,
38,
'',
0,
'ph_macroparm("DOU BLEPRESS","ONEPRESS",1,"TWOPRESS",1,"BTNPRESS")',
0,
'');
Edited by jeffw_00 - December 02 2007 at 11:32
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 02 2007 at 12:46 | IP Logged
|
|
|
Thanks for posting. No use for it now, but maybe someday!
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 02 2007 at 13:11 | IP Logged
|
|
|
As an alternative approach, what I wanted was a way that if I hit all off on a ControLinc twice, I wanted to turn on a certain PLC group and fire a "goodnight" macro, which turns off the group 10 minutes later. It's a bit simpler than the above, however less flexible. Basically on the first press, the macro enters a wait for 4 seconds waiting for the second press. On the second press, it executes the code.
insert into macroheader values ('GOODNIGHT - MEDIA','Goodnight from Media Room',0,0,1);
insert into macrodetail values ('GOODNIGHT - MEDIA',1,16,'',NULL,'if ( ph_ismacrowaiting("GOODNIGHT - MEDIA") > 0, 1, 5)',0,'');
insert into macrodetail values ('GOODNIGHT - MEDIA',2,7,'',NULL,'2000',0,'');
insert into macrodetail values ('GOODNIGHT - MEDIA',3,33,'7',17,'',0,'PLCDM');
insert into macrodetail values ('GOODNIGHT - MEDIA',4,1,'GOODNIGHT',1,'',0,'');
insert into macrodetail values ('GOODNIGHT - MEDIA',5,39,'',NULL,'',0,'');
insert into macrodetail values ('GOODNIGHT - MEDIA',6,31,'',NULL,'4',0,'');
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 02 2007 at 13:28 | IP Logged
|
|
|
what happens if the 2nd press never comes?
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 02 2007 at 13:46 | IP Logged
|
|
|
The macro exits after 4 seconds ... (obviously you can configure the delay, or take other action if you want to)
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 02 2007 at 15:36 | IP Logged
|
|
|
Two! Two multi-press macros! Ah, ah, ah!
|
Back to Top |
|
|
|
|