Author |
|
markm Newbie
Joined: February 15 2007
Online Status: Offline Posts: 8
|
Posted: April 08 2007 at 00:21 | IP Logged
|
|
|
I finally got dedicated server for the PH to live in. I started to play with macros and formulas and found a few things I would like to have ask about.
Here is a scenario I am trying to implement. Several lights in my living room go on with long ramp and at low levels before sunset. The level is to low to use the room so manual adjustment to the default levels is done with combination of SwichLincs. Some of the lights are used to light the entry hall when someone is at the door. I have RelayLinc by the exit door for that. The goal is for the entry door RelayLinc to brighten the lights when pressed on, and return lights to the level they were before after off is pressed or turning them off with double tap off.
Implementation:
Triggers for on, off and fast off:
type: raw formula: ph_macroparm("ULNRM",17,180,140,180,0), trigger type: InsteonDevice Change, trigger ID number 1, trigger value on.
type: raw formula: ph_macroparm("ULNRM",19,0,0,0,0), trigger type: InsteonDevice Change, trigger ID number 1, trigger value off.
type: raw formula: ph_macroparm("ULNRM",20,0,0,0,0), trigger type: InsteonDevice Change, trigger ID number 1, trigger value fast off.
Macro ULNRM:
Code:
case ( ph_getvar_n(1,1)
when 17 then
if ( {G_ULV_ON} = 0,(
ph_setglobal_a ("G_ULV_ON" , 1) +
ph_setglobal_a ("G_ULV_FP",ph_getinsteonlevel ("ULV-FP")) +
ph_setglobal_a ("G_ULV_MN",ph_getinsteonlevel ("ULV-MN")) +
ph_setglobal_a ("G_ULV_IL",ph_getinsteonlevel ("ULV-IL")) +
ph_insteongroup ("UPPR_LVNG_RM_BRIGHT",17,0)) ,
0 )
when 19 then
ph_setglobal_a ("G_ULV_ON",0) +
ph_insteon("ULV-FP",17,{G_ULV_FP}) +
ph_insteon("ULV-MN",17,{G_ULV_MN}) +
ph_insteon("ULV-IL",17,{G_ULV_IL})
when 20 then
ph_setglobal_a ("G_ULV_ON",0) +
ph_insteongroup ("UPPR_LVNG_RM_BRIGHT",19,0)
) |
|
|
This approach works, but there are some things I am not entirely happy with:
1. My triggers are checked twice for each change in Insteon device, and fire the macro twice too. Here is a log:
Quote:
4/7/2007 20:29:02.5 8 & nbsp; Macro ULNRM executed. &nb sp; 137
4/7/2007 20:29:02.453 31 &nbs p; Insteon DM Controller INSTEON transmission of Address:[07.89.CE] Flags:[69] Cmd1:[17] Cmd2:[12]. Decode: Group Cleanup. ID: ULV-IL Group: 12, On &nbs p;136
4/7/2007 20:28:57.156 31 &nbs p; Insteon DM Controller INSTEON transmission of Address:[06.C9.1E] Flags:[69] Cmd1:[17] Cmd2:[12]. Decode: Group Cleanup. ID: ULV-MN Group: 12, On &nbs p;135
4/7/2007 20:28:41.468 11 &nbs p; Trigger check of FDR-ON performed. &n bsp; 134
4/7/2007 20:28:41.031 31 &nbs p; Insteon DM Controller INSTEON transmission of Address:[06.C6.CC] Flags:[69] Cmd1:[17] Cmd2:[12]. Decode: Group Cleanup. ID: ULV-FP Group: 12, On &nbs p;133
4/7/2007 20:28:40.718 31 &nbs p; Insteon DM Controller INSTEON transmission of Address:[00.00.0C] Flags:[207] Cmd1:[17] Cmd2:[0]. Decode: Group Broadcast. Group: 12, On &nbs p;132
4/7/2007 20:28:40.64 16   ; Global variable G_ULV_IL changed from 80 to 80 &nbs p;131
4/7/2007 20:28:40.593 16 &nbs p; Global variable G_ULV_MN changed from 80 to 80 &nbs p;130
4/7/2007 20:28:40.421 16 &nbs p; Global variable G_ULV_FP changed from 60 to 60 &nbs p;129
4/7/2007 20:28:40.265 16 &nbs p; Global variable G_ULV_ON changed from 0 to 1   ;128
4/7/2007 20:28:40.125 8   ; Macro ULNRM executed. &nb sp; 127
4/7/2007 20:28:39.968 11 &nbs p; Trigger check of FDR-ON performed. &n bsp; 126
|
|
|
The RelayLinc was pressed once, but as you see above in lines 126 and 134, it resulted in double execution of the macro ULNRM. This forces me to use {G_ULV_ON} to determine if this is first or second time the trigger was fired. Is this a bug or a feature?
2. Macro delay is significant and ranges from one to three seconds. Is this normal? If it is normal, that severely limits usability of my approach to scene controls. Is there a better way to do what I intend with faster response times?
3. You can’t have it all, I guess. By turning the devices on via PLC group (case 17) I can control ramp and level. But this is one way street. I cannot use PLC group for off (case 19), because the levels of the devices might vary. I guess I could setup groups to cover rough approximation of the light state (they can be dim, bright or off), but with that approach I am afraid I would run out of the PLC groups rather fast. However, I would have good control of the ramp in a process. The approach I chosen allows me to control levels, but not ramps. Is there a better way to do it? Could I somehow have control of both? Is there some function I haven't found like ph_insteongroupcu but with cmd1 and cmd2 perhaps?
4. Minor interface things I noticed. No two instances of PH can be launched. Would it be possible to have Adobe solution to this problem, where clicking an icon restores minimized InDesign or Photoshop rather than popping the warning? And, is there a way to disable the resizing of the main explorer window by right clicking on the left panel? I know eventually I am going to learn not to right click on selections there, but I am not there yet.
Thank you for your patience with this long post.
__________________ Mark
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 11 2007 at 20:34 | IP Logged
|
|
|
Mark,
I can definately help you on the trigger firing twice (and consequently the macro). Add [LOCAL9] <> [LOCAL10] in place of the 1 in the "Boolean" field of the trigger.
The [LOCAL9] and [LOCAL10] variables contain the previous and current status of the Insteon device. Adding this formula will cause the trigger to only fire when the previous status value is different from the current status value. The most likely reason your trigger is firing twice is once for the group broadcast command and once for the group cleanup command. With the above formula in the boolean field, the status will change with the group broadcast but will be the same with the group cleanup. If the group broadcast is missed for some reason, then the status will change with the group cleanup and the trigger will fire a single time as well.
Unfortunately, the only way to vary the ramprate is with a group command. The level can be directly controlled using a ph_insteon command, but not the ramp. The device will use whatever is the last used ramprate. You could extend your groups some by creating base groups containing multiple devices with various levels and ramprates and then using the ph_insteongroupcu function to individually control the devices. It's a hack as it's not the intended use of Insteon and the Group Cleanup command but it helps. The only problem is that the lights won't control together and will have to be controlled sequentially.
HTH,
Dave.
|
Back to Top |
|
|
markm Newbie
Joined: February 15 2007
Online Status: Offline Posts: 8
|
Posted: April 13 2007 at 00:37 | IP Logged
|
|
|
Dave,
The [LOCAL9]<>[LOCAL10] helped with the ON trigger, but the OFF trigger still fires twice. Anyway, with my global variable hack I can live with that.
dhoward wrote:
The device will use whatever is the last used ramprate.
|
|
|
This was my problem. I have a group on a timer with the ramp of 1 for gentle on in the evening and off at night. I come up with another hack to reset the ramp. I created PLC group with all devices I want the ramp to be reset to 25 (my favorite). Then I added ph_createtimedevent(2,"RMP_25",ph_relativedatetime(today(),1 0)) as last line in the macro triggered by timed event. The RMP_25 is ph_insteongroup("RMP_25",22,0). The default dimming (I guess it is 2.5%) is not noticeable if the lights are on, and it seems to reset the ramp even when the lights are off. Way cool
Now I have another question. Is it possible to insert RawFormula into the ph_createtimedevent function? When I tried to write one, I couldn't validate the formula.
__________________ Mark
|
Back to Top |
|
|
|
|