Author |
|
Tomcat7194 Newbie
Joined: November 05 2006
Online Status: Offline Posts: 24
|
Posted: February 01 2007 at 22:06 | IP Logged
|
|
|
Hey everyone. I'm trying to run a pretty simple bit of code, and for some reason it's not cooperating. Basically, I want a macro that checks the global variable HEATON, and if it equals 1, changes it to zero, runs and x10 command, and does a tts.
Here is the code:
Formula | Immediate| if({HEATON}=1, ph_x10btn ("3", 3, 0 ) + ph_tts("Furnace is on") + ph_setglobal_s("HEATON","0"), 0)
When I run it with HEATON set to 1, it does not chance HEATON to zero, and it doesn't do the other functions. Any idea what I'm doing wrong here?
Thanks!
Tom
|
Back to Top |
|
|
Viper Groupie
Joined: January 14 2007 Location: United States
Online Status: Offline Posts: 88
|
Posted: February 01 2007 at 22:26 | IP Logged
|
|
|
Use:
Goto Label | if ({HEATON}=1, "HEATON", "HEATOFF")
Label | HEATON
Set Global | "HEATON" | 0
Formula | Post | ph_x10btn("3",3,0)
Formula | Post | ph_tts("Furnace is on")
Label | HEATOFF
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 07 2007 at 21:58 | IP Logged
|
|
|
Tom,
I pasted your formula in the Multi-Editor and it worked just fine (once I created a global variable called HEATON and changed the "3" in ph_x10btn to match an X10 device in my setup) so Im not sure what the problem would be. All of the functions you're calling return integers so that is not a problem with adding them together. Have you any additional info to add?
You could also use Vipers suggestion. It should work as well.
Dave.
|
Back to Top |
|
|
|
|