Author |
|
npavkov Groupie
Joined: February 29 2004 Location: United States
Online Status: Offline Posts: 91
|
Posted: April 19 2005 at 20:05 | IP Logged
|
|
|
Dave.... Since upgrading to 1.03.4.4 , I have been perplexed about a problem. I am trying to update a global variable called "A11DIMLEVEL" with the formula of 'ph_setglobal_s("A11DIMLEVEL" ,"0")' but it will not update the global variable at all, NOR can I use the 'set global' function directly within a macro.... Am I just going crazy???? I need to be able to dim a x10 light to a specified level, then set global var to that level, then when I turn the light 'fully on' I want to reset the light back to the saved level in the global variable. am I trying to do this the wrong way??? Help Dave!!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 19 2005 at 21:44 | IP Logged
|
|
|
Nick...you're going crazy . Seriously...I created a global and named it "A11DIMLEVEL" and ran the formula ph_setglobal_s("A11DIMLEVEL","0") and had no problems. I tried several different values both in the above formula and the macro "Set Global" command and it worked every time.
In your above message, you have the formula enclosed with single quotes. That was just for the sake of the message and not how you're actually trying to execute the formula is it?
Try running your formula in the "Formula Evaluator" (without the single quotes ) and see if that does not do the trick.
As far as doing it another way...I would probably scrap the global altogether and use the PowerHome stored level. How it works...when a light is dimmed, what PowerHome believes is the current level, is stored within the database. When that light is turned off, the status is changed to off, but the level that it was at remains. You can get this level with the following formula: ph_getx10level("A",11). Now...when the light is turned on, the stored level will be set to 100 (this is all assuming X10 devices that don't support "memory" or remember it's last "ON" level) and the status will be changed to on.
Now, how can we use this? Currently, you probably have a trigger for A11 dim and A11 bright to store the level in your global. Then you'll also have a trigger for A11 on to set the last dim state. Or you may be doing differently. In any event, to use the new way, you would need just two triggers. 1 for X-10 Out A Addressed. In the action formula, you would need to store the current level. I used the following formula: ph_setvar_a(3,1,ph_getx10level("A",11)). Yes, I cheated and used a system global variable. We should be safe doing this because in most instances, were going to immediately follow an address command with an "on" command. I next had a trigger for X-10 Out A 11 On. In the action formula, I had this formula: ph_x10btn("A",11,100,[GLOBAL1]). This turns around and immediately dims the light due it's previous level.
Let me know how it goes and we'll get it worked out.
Good luck,
Dave.
|
Back to Top |
|
|
npavkov Groupie
Joined: February 29 2004 Location: United States
Online Status: Offline Posts: 91
|
Posted: April 20 2005 at 08:54 | IP Logged
|
|
|
Man....Did I have a brain fart.... I forgot that the global variable display screen does not update unless you close and reopen it.....Sorry Dave!!!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: April 20 2005 at 10:31 | IP Logged
|
|
|
Dohhhh!!!!
Actually, you don't have to close and reopen it. You can press the F5 key or the Lightning bolt toolbar item and it will refresh.
Dave.
Edited by dhoward
|
Back to Top |
|
|
|
|