Author |
|
Mitch Groupie
Joined: September 26 2010
Online Status: Offline Posts: 43
|
Posted: October 13 2010 at 12:17 | IP Logged
|
|
|
My first attempt to write a PH formula:
if(ph_getx10stat(TESTX10) = 2,ph_insteon(RESET SYSTEM,19,0),ph_insteon(RESET SYSTEM,17,255))
I've tried changing a few things and keep getting a syntax error message. The goal is this:
If testx10 is on, then set reset system off, else set reset system on.
I'm sure it's something very simple/stupid that I am doing wrong.
Thanks for your help.
Mitch
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 13 2010 at 12:35 | IP Logged
|
|
|
This should work.
If (ph_getx10stat(“TESTX10”) = 2,ph_insteon("RESET SYSTEM”,19,0) , ph_insteon(“RESET SYSTEM”,17,255)
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
Mitch Groupie
Joined: September 26 2010
Online Status: Offline Posts: 43
|
Posted: October 13 2010 at 17:55 | IP Logged
|
|
|
Ok - double quotes on the IDs - Thanks!
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 13 2010 at 18:10 | IP Logged
|
|
|
Typically strings have quotes around them. If I told you that it would have been too easy. Also remember you can’t use quotes within quotes. You would then use apostrophes.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
Mitch Groupie
Joined: September 26 2010
Online Status: Offline Posts: 43
|
Posted: October 14 2010 at 01:00 | IP Logged
|
|
|
Ok, so it works, but it still gives me a 'formula error' in the event status bar. I can see the right things happening in the event log (no report of error), but the flash or red ERROR bugs me - what' up with that?
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 14 2010 at 08:15 | IP Logged
|
|
|
Generally where the formula has been entered you can double click to the Formula Builder. Each individual command in a complex statement can be executed to determine where the error is coming from. The posted example is missing a final trailing ) but that could just be a problem with the post and not the statement itself.
__________________ Lee G
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 14 2010 at 08:42 | IP Logged
|
|
|
Good catch Lee. When I tested it was right but when I posted I used Mitch’s post and modified it and didn’t correct the IF trailing paren.
Mitch, there is also a known glitch in this release that will cause an execution formula error when issuing some Insteon commands where in actuality there is no error.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
Mitch Groupie
Joined: September 26 2010
Online Status: Offline Posts: 43
|
Posted: October 14 2010 at 23:07 | IP Logged
|
|
|
Yes, I caught the missing paren. I think it may be a glitch in PH - when I do verify in formula builder I get this:
Execution time: 0.000 seconds.
The formula evaluates to: 0
I think that means no errors?
Thanks!
Mitch
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: October 15 2010 at 08:14 | IP Logged
|
|
|
You’ve got it…
__________________ Pete - X10 Oldie
|
Back to Top |
|
|