Author |
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: February 03 2009 at 01:19 | IP Logged
|
|
|
I have been using PowerHome for two years, but mainly to set up links with Insteon and my Elk M1-G. I have tried for two+ years to use the Elk Rules to turn off lights, but it is far too erratic (though VERY easy to create). After reviewing countless forum posts, I have decided to use PH for one of its strengths: macros and triggers . . . but holy cow, this is way complicated for someone whose computer programming ended with BASIC in 1978. I am trying, but I need some help.
Here's what I want to do: I have Insteon switches and X-10 motion sensors (MS13s I think). PH is connected via an Insteon PLC. I want switches to turn off ten minutes after they are (manually/locally) turned on. If motion is sensed in the room I want a "timer" to restart for another ten minutes. I have created two triggers to activate a macro which turns off the light. The triggers are fired when the light is turned on locally or if motion is sensed. How do I deal with restarting the "timer" if the motion trigger fires again (or the switch ON paddle is pressed again?
Also, how do I add a variable to the trigger for time of day (DARK outside) or switch condition (ON/OFF) so I can make another trigger which considers if it is dark outside and if a light is off before it triggers to turn a light on?
I know this must seem so elementary to many of you but I just can't find this stuff in the PH documentation (which seems to be the Achilles heel of PH is there is one).
|
Back to Top |
|
|
jbbtex Senior Member
Joined: February 15 2007 Location: United States
Online Status: Offline Posts: 181
|
Posted: February 05 2009 at 00:07 | IP Logged
|
|
|
Searching the forum has almost always answered my questions. And if a search doesn't find an answer a post usually does.
If you want to have x10 motion sensors turn on/off insteon switches you could use triggers.
First set the delay between on/off on the MS13 to what you want using the buttons inside the battery cover.
Then create two triggers - one for on the other for off.
Here is an example for ON
ID: SWITCH ON
DESC: TURN ON SWITCH
ACTION TYPE: DEVICE CONTROL
ACTION: INSTEON+(YOUR DEVICE'S ID)+ON
TRIGGER TYPE: X10RF IN
TRIGGER ID: (HOUSE CODE OF YOUR MS13)
TRIGGER ID NUMBER: (UNIT CODE OF YOUR MS13)
TRIGGER VALUE: ON
BOOLEAN: 1
For Day/Night, I have two timed events. One sets a Global Variable I created called {NIGHT} to 0 at Sunrise and another sets it to 1 at Sunset.
In the trigger if you put {NIGHT} in the BOOLEAN field, the trigger will fire between Sunset and Sunrise, but not during the day.
This is just one way to do it.
__________________ Brady
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity." - Gen. George S. Patton
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: February 05 2009 at 16:30 | IP Logged
|
|
|
Thanks for your response Brady,
I have spent numerous hours on the forums and although there is often an answer, it is certainly not an efficient use of time. I suppose I will get better about using the search function.
I followed your suggestion and those of other posts and I have successfully been able to set up the x10 motion sensors to turn on/off insteon lights with the "ph_insteon" function. I am, however, stymied by a few of my results.
I added the following to the Boolean field for a trigger which I only want to happen between 11:30 pm and dusk:
If(HOUR(NOW())>= 23:30 OR NOW() < RELATIVETIME(00:00:00, [DUSK]), 1, 0)
I have also used If(TIME(NOW())>= 23:30 OR NOW() < RELATIVETIME(00:00:00, [DUSK]), 1, 0)
The result is the same: FORMULA ERROR
Feb 05 2009 &nb sp; 11:01:46 ;&n bsp; Formula Error ; Syntax Error in Formula: IF (HOUR(NOW()) >= 23:30 OR NOW() < RELATIVETIME(00:00:00, 65156),1, 0)
Dusk seems to get replaced with 65156, which, incidentally, is not the same as shows in the system 06:41:18 for my latitude, but maybe this is some relative number in seconds?? [for others reading this post, more can be found at http://www.power-home.com/forum/forum_posts.asp?TID=2027&PN= 1]. Suggestions?
Finally, is there anything wrong with this string in the "action" column of a trigger:
ph_insteongroup("196",ion,0)+wait (600)+ph_insteongroup("194",ioff,0)
The idea is to turn on one group, wait ten minutes, then turn off a second group.
BTW, is there a way to test a trigger's actions without waiting for the triggering event?
Edited by Handman - February 05 2009 at 17:09
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: February 05 2009 at 17:37 | IP Logged
|
|
|
Try this:
If (HOUR(NOW()) >= 23 OR NOW() < RELATIVETIME(00:00:00, [DUSK]), 1, 0)
DUSK should be calculated correctly for your location.
"ph_insteongroup("196",ion,0)+wait (600)+ph_insteongroup("194",ioff,0)"
I’ve never tried a WAIT that way. Have you thought about creating a Timed Event 10 minutes away instead. Might be a little more efficient.
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: February 05 2009 at 18:11 | IP Logged
|
|
|
Comparing HOUR, which is an Integer value, to 23:30 which is not an Integer, does not work. The following works in the Verify function ....
If(NOW()>= time("23:30") OR NOW() < RELATIVETIME(00:00:00, [DUSK]), 1, 0)
To test a formula, define a Macro with Command Formula and code the Send Keys..... field with the actual formula. Double click on the Send Keys field and run Verify. You can also invoke the Macro in the Macro/Formula field, clicking on Run.
You might find it easier to change the action type to Macro and split up a complex line as individual lines in a Macro. May make testing individual parts easier.
Edited by grif091 - February 05 2009 at 18:25
__________________ Lee G
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: February 05 2009 at 19:42 | IP Logged
|
|
|
Thanks for the fast responses. Lee, your version works. I don't really understand why the time has to be in quotation marks, but I cannot argue with results. Pete, your version works as well, but only with whole hours (as your example shows). One huge problem with my formula was I used DUSK when I meant DAWN.
As far as the suggestions for MACROS and triggers division of duties, I'll give that a shot. Thanks for the suggestions and solutions. I will let the gratification of a week's worth of automation sink in before I delve into more trouble.
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: February 05 2009 at 20:12 | IP Logged
|
|
|
Handman, check out the Help facility section that describes each function. It is essential in determining what "type" of parameter is required as input to a function and what "type" of value is returned by each function. You will see that HOUR returns an Integer. The value 23 is an Integer so the IF was able to compare an Integer to an Integer. Adding the :30 to 23:30 makes that value no longer an Integer. Changing from HOUR to NOW() makes the returned value a Time type value. The time("23:30") function takes a string value (reason for quotes) and returns a Time type value allowing the IF to compare compatible values (a Time type value to a Time type value).
The ph_insteongroup("196",ion,0) is a valid function except that the first parameter is the Group ID. If the "196" is the Group number and not the Group ID then that parameter is invalid. The following works on my system ...
ph_insteongroup("G2X4OUTPUT1PLM",ion,0) + ph_insteongroup("G2X4OUTPUT1PLM",ioff,0)
The G2X4OUTPUT1PLM is the ID of the PLM/PLC Group definition and does turn on and then off the Group.
Like Pete I have not seen a WAIT function nor could I find a WAIT or ph_wait listed in the Help facility. There is a WAIT command that can be specified as a line in a Macro.
Edited by grif091 - February 05 2009 at 20:20
__________________ Lee G
|
Back to Top |
|
|
Handman Senior Member
Joined: February 02 2009 Location: United States
Online Status: Offline Posts: 229
|
Posted: February 05 2009 at 20:48 | IP Logged
|
|
|
Yes, I named my Insteon Group "196" (not very creative or descriptive, I know). I never realized that strings needed quotes, so you cleared one major question I had right there (HUGE). I just loaded the other trigger actions into a macro and that is a lot easier. Thanks again for the suggestions. I'll be back . . .
|
Back to Top |
|
|
|
|