Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: stacking commands in a formula Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
k2zs
Senior Member
Senior Member
Avatar

Joined: October 22 2009
Location: United States
Online Status: Offline
Posts: 113
Posted: December 09 2009 at 07:15 | IP Logged Quote k2zs

Good morning all...

In my quest to waste time and learn, I have a question about formulas. Is it possible to stack commands (ph_ commands) from within a formulas, macro, trigger, and so on. I have buttons in my CC that reflect the status of a device. To do this I had to write 2 triggers based on the same action. One changes the button image and the other changes the button text. The triggers are based on the same condidtion so why couldn't I have one trigger that says:
[IF CONDITION]([STATUS OF DEVICE],[PH_STATEMENT 1 TRUE]&[PH_STATEMENT2 TRUE],[PH_STATEMENT 1 FALSE]&[PH_STATEMENT2 FALSE])

(I hope that makes sense to someone)

I know in other languages you can do something like that but can you in PH2?

__________________
Scott, K2ZS
Home Automation Ideas
Back to Top View k2zs's Profile Search for other posts by k2zs Visit k2zs's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 09 2009 at 07:32 | IP Logged Quote TonyNo

Sure!

if( boolean, truevalue, falsevalue )

Check the Help for more on if().
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
k2zs
Senior Member
Senior Member
Avatar

Joined: October 22 2009
Location: United States
Online Status: Offline
Posts: 113
Posted: December 09 2009 at 07:47 | IP Logged Quote k2zs

Thanks Tony but that part I knew... I want to know how to call multiple ph_commands from within the truevalue and falsevalue portions of the statement...

if( boolean, ph_command_1 ph_command_2 ph_command_3 , ph_command_1 ph_command_2 ph_command_3 )

__________________
Scott, K2ZS
Home Automation Ideas
Back to Top View k2zs's Profile Search for other posts by k2zs Visit k2zs's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: December 09 2009 at 08:18 | IP Logged Quote grif091

You can issued multiple commands. ph_xxx + ph_xxx + ph_yyy.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
k2zs
Senior Member
Senior Member
Avatar

Joined: October 22 2009
Location: United States
Online Status: Offline
Posts: 113
Posted: December 09 2009 at 08:23 | IP Logged Quote k2zs

grif091 wrote:
You can issued multiple commands. ph_xxx + ph_xxx + ph_yyy.


ah ok... I tried , ; & but dummy me never tried +. Thanks, I'll try it when I get home... Thanks

__________________
Scott, K2ZS
Home Automation Ideas
Back to Top View k2zs's Profile Search for other posts by k2zs Visit k2zs's Homepage
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: December 09 2009 at 08:35 | IP Logged Quote grif091

Sometimes, particularly when stacking commands imbedded in other commands, I have found it necessary to bracket the stack with () (ph_xxx + ph_yyy) as some combinations seem to give the parser more problems than others. No hard and fast rule that I know of. Just a technique I found necessary at times when an otherwise valid looking sequence keeps coming up with a "!" result.     

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
k2zs
Senior Member
Senior Member
Avatar

Joined: October 22 2009
Location: United States
Online Status: Offline
Posts: 113
Posted: December 09 2009 at 16:38 | IP Logged Quote k2zs

Thanks Lee

__________________
Scott, K2ZS
Home Automation Ideas
Back to Top View k2zs's Profile Search for other posts by k2zs Visit k2zs's Homepage
 
k2zs
Senior Member
Senior Member
Avatar

Joined: October 22 2009
Location: United States
Online Status: Offline
Posts: 113
Posted: December 11 2009 at 20:59 | IP Logged Quote k2zs

Wow, Thanks Lee... now I got it. One trigger for each button; no hands... lol

case(ph_getinsteonstat ("DINING_RM_TABLE") when 2 then (ph_setccobjtext("HOME","ST1N_1","On") + ph_setccobjgraphic("HOME","GB1N_1","C:\Program Files\powerhome\web\graphics\buttons\b10green_50.gif","C:\Pr ogram Files\powerhome\web\graphics\buttons\b10gray_50.gif")) else (ph_setccobjtext("HOME","ST1N_1","Off") + ph_setccobjgraphic("HOME","GB1N_1","C:\Program Files\powerhome\web\graphics\buttons\b10gray_50.gif","C:\Pro gram Files\powerhome\web\graphics\buttons\b10gray_50.gif")))

Edited by k2zs - December 11 2009 at 21:00


__________________
Scott, K2ZS
Home Automation Ideas
Back to Top View k2zs's Profile Search for other posts by k2zs Visit k2zs's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum