Author |
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: March 06 2009 at 08:10 | IP Logged
|
|
|
Hi Gang,
I have had Powerhome for a few years now, although I confess I've only used it at a very high level. Here are situations I'm trying to program around:
1) THE SIMPLE CASE: My wife enjoys our gas fireplace; however, a little too much. She has a habit of turning the thing on in the evening, falling asleep on the couch, and the thing runs nearly all night....I'm sure you can see the problem with this.
2) THE BUMP CASE: We have Insteon motion sensors setup so that when you're walking around at night, one of the main lights comes on to help you around (it's technically for Grandma when she visits). It comes on, and stays on for 5 minutes and shuts back off.
THE PROBLEMS:
1) For case 1, I have a Keypadlinc attached to an old X-10 contact closure relay...I have ordered an Insteon contact closure which should arrive any day now. I assume I need to simply capture the button click event (how do you do that from a Keypadlinc?), and set a timer in Powerhome (something like 30 minutes) and then run an event to shut it off (again, how do I tell the Keypadlinc to click that button?).
2) For case 2 this is a little more tricky. What I want to do is when the motion sensor is triggered, I want to basically set a global timer to 5 minutes (or bump one that is already counting down back up to 5 minutes - the theory being if someone is walking around, the light stays on until there is no activity for 5 minutes). I am assuming that I also need to check the light and/or existing timer execution somehow, and *somewhere* in all of this turn the thing on and off. Sheesh.
Anyway, anyone who's played with this kind of thing and has some advice - I would *love* to hear some ideas.
Also, is there a general "Programmer's Reference" for Powerhome 2 anywhere I could go through? Might make some of these simple questions go away. :)
Thanks.
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 06 2009 at 08:55 | IP Logged
|
|
|
Case 1: I am assuming you have the KPL setup for a X10 address when a button is pressed to activate the X10 relay. When you press a button on the KPL it will send a Group Broadcast to the PLC/PLM that you have previously linked as a Responder. You would then fire a trigger with Group in and the button you pressed in the Trigger ID Number. This can call your macro to send back a X10 command to the Relay later.
Case 2: There is a lot of discussion in the forum on this subject. To summarize I would set jumper 4 on the Motion Sensor to on. That means only ONs will be sent. Dave recently developed a TRIGDISABLE macro that does a good job of filtering out the amount of ON commands seen from motion. Once you fire the trigger I would then enable the trigger later to check if there was still motion and modify the trigger ( ph_modifytimedevent) you built on the initial firing.
Lee G. has done a lot of work in this area and maybe he can give you more details.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
nadler Super User
Joined: February 25 2006 Location: United States
Online Status: Offline Posts: 354
|
Posted: March 06 2009 at 09:39 | IP Logged
|
|
|
I have a different solution to number 2. Not better,
just different.
I wouldn't change the motion sensor's jumper. The
motion sensor sends an off after motion ceases for 1
minute. I would link the motion sensor to the plm/plc
(not the light) and set up an on and an off trigger for
the motion sensor. The on trigger would turn on the
light. The off trigger would be a raw formula that
would turn off the light after 4 minutes or perhaps
create a one shot timed event that would turn off the
light in 4 minutes. I won't bother with the TRIGDISABLE
macro in the boolean field, at least initially for
testing purposes. It won't hurt anything by leaving it
out while you test.
With Pete's solution the motion sensor could be linked
directly to the light and it would turn on immediately.
With the solution I suggest there would be a slight
delay in turning on the light because the on command
goes through PH first(very slight).
Just an alternative to illustrate the many ways PH can
be used to do the same thing.
Noel
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: March 06 2009 at 10:35 | IP Logged
|
|
|
For a KeypadLinc to generate an Insteon message (Group message) when a button is pressed, the button must be linked as a “controller” to some “responder”. For this case link KPL button 3 (whatever button number you want to use) as a controller with the PLC/PLM as the responder. The controller group number is the button number. With this link in place PowerHome will see the button press Group message which can be used to fire a Trigger. From that point there are many options. I suggest the Trigger invoke a Macro. A Macro is an easy option for the beginner. The Macro issues a command to turn On your IOLinc (assumption about what you will use as the Insteon device to control the gas logs), then Wait for the time interval you want, then issue a command to turn Off the IOLinc which turns off the gas logs. The last command the Macro issues turns off the KeypadLinc button 3 LED.
For the KeypadLinc button Off command to work you need a link that is opposite to the one established to cause the KeypadLinc button to send a Group message. This link must have the PLC/PLM as the controller using a Group number that is not already in use by the PLC/PLM (such as 8), with the KeypadLinc button 3 as the responder. In addition to creating this link use the PLC/PLM Links tab to define an “ID” that is used in the command that turns Off the KeypadLinc button. The Group number in the PLC/PLM Link definition must be the Group number used in the link just defined.
There are fancier ways to handle the time delay in turning things off. A Timed Event can be created rather than coding a Wait in the Macro, putting the two Off commands in the Timed Event. I would use the Macro approach described above. Each action is a separate line in the Macro allowing each to be defined and tested individually. When that is working, then try expanding your programming skills by using a Timed Event.
There are recent posts discussing the Motion Sensor action you want to create. Taking care of multiple inbound Group messages when the Motion Sensor detects motion, handling a time interval such that the Off command(s) are issued only after the last motion detected. Pete posted his implementation of this. As with most things program related in PowerHome, there are multiple ways of doing the same thing.
Unfortunately there is no comprehensive Programming Reference for PowerHome.
I see that another suggestion was offered for the Motion Sensor. As you can see there are always several ways in PowerHome to accomplish the same thing. Pick the way you are most comfortable with or want to learn something about.
__________________ Lee G
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: March 07 2009 at 07:17 | IP Logged
|
|
|
Wow, you folks are great! Thanks so much for the quick replies and all of the options. I will work on these when I get a few minutes this weekend and let you know the results.
Warm Regards,
Spencer
|
Back to Top |
|
|
syonker Senior Member
Joined: March 06 2009 Location: United States
Online Status: Offline Posts: 212
|
Posted: March 09 2009 at 07:38 | IP Logged
|
|
|
Hi Gang,
Firt off, again I want to thank everyone for all their help and patience!
For the "BUMP" case, I decided to use the "off" command from the sensor as nadler suggested. It took me a little while to get the sensor working properly (I didn't have the jumpers set properly, then it was sending weird data - I finally determined it had a low battery, changed it, and it worked fine). One weird thing though, my formula for keeping it from turning on during daylight hours isn't working. I must have something very obvious wrong....here's the formula I'm using to keep the thing from turning on during daylight hours (Line 40 is just a short WAIT on the last line of the macro):
JUMP if( hour( now()) >= (hour([DUSK])) or hour( now()) <= (hour([DAWN])), 1, 40)
As for the first case (fireplace), I took out the X-10 control altogether when my new Insteon control arrived, but frankly haven't been able to finish that piece. Where the X-10 low-voltage controller has a relay that makes simple contacts, this control has a TON of terminals...Does anyone know which ones would represent a "contact closure"...?
Thanks,
Spencer
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: March 09 2009 at 08:47 | IP Logged
|
|
|
Maybe this will get you pointed in the right direction:
if ( hour( now()) >= hour(relativetime(00:00:00,[DUSK])) or hour( now()) <= hour(relativetime(00:00:00,[DAWN])), 1, 40)
Do you have a model number of the relay? I have some old ones but don’t know if they are what you are talking about.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 09 2009 at 10:22 | IP Logged
|
|
|
This should work for you as well:
Code:
if(now() >= ph_getsuntime(today(),4) or now() <= ph_getsuntime(today(),3),1,40)
|
|
|
Concerning the extending of time for the light to go off, what I typically do is use a macro as the action to my "On" trigger. The first line of the macro checks to see if the macro is already waiting. If it is, then control is transferred to a label with a ph_extendmacrowait function (3rd parameter is 0) and then exits. If the macro is not already waiting, then control is transferred to a label where the macro starts its wait time. The statement after the wait is the off command and then the macro exits. As long as there is motion (within the wait time), the macro wait is just extended.
Another way to skin the cat :)
Dave.
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: March 09 2009 at 12:10 | IP Logged
|
|
|
syonker, when building formulas in macros, double click on the Send Keys field. This takes you to the Formula Builder which is a very handy tool for building/checking formulas. If you enter your original formula and click on Verify, you will get “The formula evaluates to: !” message which indicates the formula is invalid. By doing a Verify on each segment of the formula individually you will find that hour([DUSK]) does not work. Breaking that down further, entering [DUSK] and clicking on Verify shows a number like 25649 which is the number of seconds to DUSK, not a “time” value needed by the “hour” function. Pete added the relativetime function which is expecting the number of seconds from a relative time of 00:00:00 which returns a “time” value for DUSK which then works with the “hour” function. Give the Formula Builder a try the next time you have a formula that does not work or are trying to build one from scratch. I think you will find it a very helpful tool.
__________________ Lee G
|
Back to Top |
|
|
edtude Groupie
Joined: July 26 2006 Location: United States
Online Status: Offline Posts: 64
|
Posted: March 10 2009 at 11:31 | IP Logged
|
|
|
I have yet another method to extend the time. In my Macro's I use the "Wait" function to set the time for shutting off the lights. Each time the Motion Sensor sets the trigger off for the Macro the line immediatley before the "wait" function I use the "ph_killmacrowait" function which deletes the waiting Macro and then the shut off time is always 5 minutes after the last motion is detected.
|
Back to Top |
|
|