Author |
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 15 2006 at 13:33 | IP Logged
|
|
|
Hey Guys,
I've got this wierd Idea in my head: I want to gradually dim a lightbulb in 30 minutes in one macro and I don't know where to start... Any IDeas?
Peter
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: September 15 2006 at 15:23 | IP Logged
|
|
|
Peter,
I'm very new at this, and hopefully I'll end up learning something from this thread, but it seems that this would work if the light was at full brightness:
Send an insteon 'ON' command with 'ph_getinsteonlevel("YOUR LIGHT")-8.5' in the Send Keys column. Then you would have to run it once a minute for 30 minutes (either with 29 wait commands or a timed event).
If you wanted to check the level of the light first, you could use ph_getinsteonlevel("YOUR LIGHT")/30 to find the amount to decrease the level by each minute. I think you'd have to store the result in a Global Variable, then use 'ph_getinsteonlevel("YOUR LIGHT")-"{YOURGV}"'.
I can't see a way around using many wait commands or a timed event - hopefully someone will come up with something cleaner.
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: September 15 2006 at 17:06 | IP Logged
|
|
|
Cleaned up and tested, but still wondering if there is a better way? I used a global variable named "HOWQUICKLY". This changes the light level a little bit every 15 seconds. How much depends on the level of the light at the start of the macro.
Code:
insert into macroheader values ('TESTMAC3','TEST MACRO 3',0,0,1);
insert into macrodetail values ('TESTMAC3',2,10,'HOWQUICKLY',NULL,'ph_getinsteonlevel("OFFI CE LIGHTS WEST")/120',0,'');
insert into macrodetail values ('TESTMAC3',4,31,'',NULL,'15',0,'');
insert into macrodetail values ('TESTMAC3',6,26,'',NULL,'Done',0,'');
insert into macrodetail values ('TESTMAC3',1,26,'',NULL,'Start',0,'');
insert into macrodetail values ('TESTMAC3',3,32,'OFFICE LIGHTS WEST',17,'ph_getinsteonlevel("OFFICE LIGHTS WEST")-{HOWQUICKLY}',0,'');
insert into macrodetail values ('TESTMAC3',5,27,'',NULL,'if(ph_getinsteonlevel("OFFICE
LIGHTS WEST")>5,"Start","Done")',0,'');
insert into macrodetail values ('TESTMAC3',7,32,'OFFICE LIGHTS WEST',19,'',0,'');
|
|
|
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: September 16 2006 at 01:06 | IP Logged
|
|
|
Cris,
Way to go. Looks good. Excellent work for someone new to PowerHome. I know that Peter doesnt have Insteon and instead uses X10 so Ive posted a slightly different method below:
Code:
10 X-10 B2 On
20 Wait 60
30 Formula Immediate ph_devicebtn(x10,"B2",adim,string(ph_getx10level("B2") - 3.33))
40 Jump if(ph_getx10level("B2") = 0,999, - 2)
|
|
|
Since X10 devices don't really have any resolution greater than 32 step and you want to dim over 30 minutes, I went ahead and dim 3.33 percent once every minute. As long as your X10 dim percent matches your light, it should dim to 0 (or be very close). You may want to add another line that the Jump statement goes to just before exiting where you go ahead and just send an OFF command.
Of course if you had Insteon or two-way X10 switches, you could change the macro slightly to allow for actual level feedback. If your switches support preset dim commands (32 individual levels), you could make use of this as well.
Cris, keep up the good work!
Dave.
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 16 2006 at 01:11 | IP Logged
|
|
|
crisx wrote:
Cleaned up and tested, but still wondering if there is a better way? I used a global variable named "HOWQUICKLY". This changes the light level a little bit every 15 seconds. How much depends on the level of the light at the start of the macro. |
|
|
my first idea was to put in a wait in the macro, but wasn't sure if there would be a better way.... since i am without insteon, i have to do it with X10...
Peter
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 16 2006 at 01:25 | IP Logged
|
|
|
dhoward wrote:
Since X10 devices don't really have any resolution greater than 32 step and you want to dim over 30 minutes, I went ahead and dim 3.33 percent once every minute. As long as your X10 dim percent matches your light, it should dim to 0 (or be very close). You may want to add another line that the Jump statement goes to just before exiting where you go ahead and just send an OFF command. |
|
|
Well, the light always starts at 100% so that wouldn't be a problem.... I wanted to make an array and then dim the light with the arrayvalues but that proved to be too much for PH, other macros stopped working.... that is why I came with the question.. another Idea was to take a GV and start with 0 and add 1 every minute and then dim the light with the GV-Value... (that is taking the long way home isn't it)
dhoward wrote:
Of course if you had Insteon or two-way X10 switches, you could change the macro slightly to allow for actual level feedback. If your switches support preset dim commands (32 individual levels), you could make use of this as well. |
|
|
I am hoping that implemtation of ZWAVE will come soon, so I can go ahead with ZWAVE since Insteon isn't sold widely here... A10 and X10 and ZWAVE are widely sold here or do you all know of any european company that sells Insteon?
Peter
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 19 2006 at 06:45 | IP Logged
|
|
|
Dave!!
help me out here please, I entered the macro like you posted, the macro waits, sends the second dim-command and then exits... I have put in a loop and the macro still exits...
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: September 19 2006 at 11:18 | IP Logged
|
|
|
Peter,
I couldn't get the Jump -2 command to work when I was playing around with this. As a temporary fix you might try using a goto label command instead of the jump command:
gotolabel if(ph_getx10level("B2") = 0,"Start","Finish")
Then put a label "Start" before the wait command and a label "Finish" after the goto label command.
This might work for you until we hear from Dave
|
Back to Top |
|
|
cmhardwick Senior Member
Joined: July 08 2006 Location: United States
Online Status: Offline Posts: 290
|
Posted: September 19 2006 at 13:35 | IP Logged
|
|
|
I believe the arguments are backwards there. The first label is if the logical test evaluates true, the second if false.
__________________ Cicero, Enjoying automation!
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 20 2006 at 04:59 | IP Logged
|
|
|
Crisx:
Done that already, thanx... But the strange thing is that after the first DIM command the bulb is Dimmed to 0%
cmhardwick
you might be on to something... will try your idea
Peter
Edited by krommetje - September 20 2006 at 05:42
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: September 20 2006 at 22:32 | IP Logged
|
|
|
Peter,
I checked the macro again and it should work (it may not though since I havent been able to actually test ).
The thing to do would be to open the PowerHome Multi-Editor, go to PowerHome formula mode (shift-F6) and enter the formulas in 1 at a time and check what the device status screen says.
I would first do a ph_devicebtn(x10,"B2",on,0) and then check the status in the Device status screen. Keep in mind that the "B2" in the formula above is an X10 Device ID and not an X10 house/unit code (I just made my X10 Device ID match the actual house/unit since it's what I was already familiar with. Your device ID's may be different). After the formula above, the DS screen should show the X10 device at 100% and ON.
Next do a ph_getx10level("B2") and make sure it returns 100.
Then try a ph_devicebtn(x10,"B2",adim,"96"). Check the actual status of the light (it should be slightly dimmed...possibly not even noticeable). Check the status screen. It should be showing close to 96%.
Let me know the outcome of the above tests.
Cris,
If the jump minus 2 isnt working it may be because of the lack of spaces around the "-" (minus) sign. PowerHome (actually the language PowerHome is written in) requires that a space exist before and after the minus sign when working with negative numbers. A real PITA but you get used to it after awhile. This may be your problem.
Cicero,
You are correct. The first argument is for true and the second is for false.
Dave.
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: September 23 2006 at 03:49 | IP Logged
|
|
|
Hi,
after playing around with all code I came up with this macro:
insert into macroheader values ('MAIKEDIM','MAIKEDIM',0,0,1);
insert into macrodetail values ('MAIKEDIM',1,38,'',0,'ph_devicebtn(x10,"M2",adim ,"100")',0,'');
insert into macrodetail values ('MAIKEDIM',2,26,'',NULL,'Start',0,'');
insert into macrodetail values ('MAIKEDIM',3,31,'',NULL,'60',0,'');
insert into macrodetail values ('MAIKEDIM',4,38,'',0,'ph_devicebtn(x10,"M2",adim,string(ph_ getx10level("M2") - 10))',0,'');
insert into macrodetail values ('MAIKEDIM',5,27,'',NULL,'if(ph_getx10level("M2") = 0,"Finish","Start") ',0,'');
insert into macrodetail values ('MAIKEDIM',6,38,'',0,'ph_usermessage(ph_getx10level ("M2"))',1,'');
insert into macrodetail values ('MAIKEDIM',7,39,'',NULL,'',0,'');
insert into macrodetail values ('MAIKEDIM',8,26,'',NULL,'Finish',0,'');
insert into macrodetail values ('MAIKEDIM',9,1,'MAIKELAMP UIT',0,'',0,'');
insert into macrodetail values ('MAIKEDIM',10,39,'',NULL,'',0,'');
it works just not in 30 minutes but timne wasn't an isue.. I wanted to make this macro for my oldest daughter. She got a bedside lamp to be able to read... but since she has to sleep to....
there is one entry in the macro which has no use, I forgot to take it out, perhaps I'll make a usermsg out of it....
Peter
Edited by krommetje - September 23 2006 at 03:55
|
Back to Top |
|
|
|
|