Author |
|
frodier Newbie
Joined: December 20 2007 Location: Canada
Online Status: Offline Posts: 16
|
Posted: December 20 2007 at 16:08 | IP Logged
|
|
|
As an avid user of powerhome and eHome I am stuck on trying to do something which is probably very simple but somehow I can't seem to find the information anywhere.
Basically I am using the HA designer in eHome to drop some graphic buttons on the screen and then link the button to an Insteon ID. The way it works in eHome, one button toggles the light and it also changes state on the screen to a different color when the light turns on. In this way it simulates a pushbutton.
I am trying to do the same thing directly in the CC design view in powerhome and this is where I am stuck. I am only able to assign an "ON' or "OFF" command to the graphic button, but can't find how to make the same button toggle on/off and change graphic state. This forces me to create 2 buttons, an "off" and an "on" one and then don't know what the current state of the light is.
I know I must be missing something very simple here and would appreciate any clue on how to do this in the powerhome CC / design view.
Frank
|
Back to Top |
|
|
nadler Super User
Joined: February 25 2006 Location: United States
Online Status: Offline Posts: 354
|
Posted: December 20 2007 at 17:19 | IP Logged
|
|
|
You can't do that directly in the CC in PH. Instead you create a button which when pressed starts a macro. The macro checks the status of a global variable. Depending on the state of the global variable ("on" or "off" or "0" or "1" in my example below), the macro turns the insteon device either on or off and then changes the color of the button in the CC as well as resets the global variable to the present state of the insteon device. Here is a macro I use:
insert into macroheader values ('COMPUTER LIGHT TOGGLE','ONE BUTTON IN CC',0,0,1);
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',1,16,'',NULL,'if (ph_getglobal_n("COMPUTER LIGHT TOGGLE")=0,1,6)',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',2,32,'COMPUTER LIGHT1',17,'126',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',3,10,'COMPUTER LIGHT TOGGLE',NULL,'1',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',4,38,'',NULL,'ph_setccobjbcolor("MY HOUSE","L1COMPUTERLIGHT",rgb(0,255, 0 ))',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',5,38,'',NULL,'ph_setccobjbcolor("MY HOUSE","TB106",rgb(0,255, 0 ))',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',6,16,'',NULL,'if (ph_getglobal_n("COMPUTER LIGHT TOGGLE")=0,999,999)',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',7,32,'COMPUTER LIGHT1',19,'',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',8,10,'COMPUTER LIGHT TOGGLE',NULL,'0',0,'');
insert into macrodetail values ('COMPUTER LIGHT TOGGLE',9,38,'',NULL,'ph_setccobjbcolor("MY HOUSE","L1COMPUTERLIGHT",rgb(255, 255, 0 ))',0,'');
The macro checks a global variable called "COMPUTER LIGHT TOGGLE". If it is set to "0" the macro goes to the next line and turns the insteon device "COMPUTER LIGHT1" to ON (at a dimmed level of 126). It also resets the "COMPUTER LIGHT TOGGLE" global variable to 1 indicating the insteon device is now ON. It then sets the color of the button pressed in the CC to green (in my example it actually sets the color of 2 different buttons to green).
If the global variable is not "0" then the macro jumps to line 6 when it sets the insteon device "COMPUTER LIGHT1" to off, changes the global variable to "0" and sets the color of the buttons to yellow.
Once you've setup your first macro to do this, you just copy it and change the device names, button names and global variable names for each device. It doesn't take that long to setup. Dave has indicated that in a future version of PH there will be a true toggle button in the CC.
HTH,
Noel
|
Back to Top |
|
|
frodier Newbie
Joined: December 20 2007 Location: Canada
Online Status: Offline Posts: 16
|
Posted: December 20 2007 at 18:58 | IP Logged
|
|
|
Many thanks Noel for clearing this issue up for me. Implementing toggle buttons on the CC interface had me going in circles and now with your explanation I can move forward...
I will try it tonight on my setup...
Regards
Frank
|
Back to Top |
|
|
tbeckman Senior Member
Joined: December 30 2007 Location: United States
Online Status: Offline Posts: 149
|
Posted: October 06 2008 at 01:17 | IP Logged
|
|
|
OK... I am stumped... I tried to create a macro as outlined above but when I try to cut and paste your code above into a formula box it says it will only allow so many characters and this code exceeds it... I am I not suppose to use a formula box... is there another way? Thank you.
|
Back to Top |
|
|
tbeckman Senior Member
Joined: December 30 2007 Location: United States
Online Status: Offline Posts: 149
|
Posted: October 06 2008 at 15:50 | IP Logged
|
|
|
OK... to follow up... I thought I was getting smarter about this and within the macro I created each INSERT statement within a DIRECT SQL line... it didn't work for me either and returned errors when i pushed the button... but am I on the right track of using DIRECT SQL within the MACRO to run each INSERT? Thanks.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: October 06 2008 at 19:44 | IP Logged
|
|
|
The code above needs to be pasted into the SQL Multi-Editor. Before that, make sure that you don't have a macro called "COMPUTER LIGHT TOGGLE", as this code will create it.
To get to the SQL Multi-Editor, click on Maintenance, PowerHome Multi-Editor. Then select Edit, Language, SQL, or just hit Shift-F5.
Paste in the code above, and click on Run (far right of toolbar).
|
Back to Top |
|
|
tbeckman Senior Member
Joined: December 30 2007 Location: United States
Online Status: Offline Posts: 149
|
Posted: October 07 2008 at 01:55 | IP Logged
|
|
|
Thank you for your help... I did get this to work with one light (now I am going to be busy doing this for all lights for a while)... now that I understand a little more, I was curious... why do we have to use a global variable to know where the light has been turned off or on. What doesn't the if statement just check the light itself? (is that possible?). Thank you.
|
Back to Top |
|
|
|
|