Author |
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: December 29 2011 at 10:34 | IP Logged
|
|
|
Hi,
I'm getting ready to implement motion into my automation system. I have had a couple of Insteon 2420Ms and a dozen X10 MS13As that will communicate with my W800RF32A.
Would any of you be willing to share your motion logic / macros? It is much easier to start with an example and modify it rather than start from scratch. I mostly want to turn lights on and off in response to motion, but want some intelligence in the system as well - what time of day is it?, Turn of KPL buttons as well, etc...
The more I think about the logic of how to implement motion, the more complicated it gets...
Thanks guys,
Cris
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 29 2011 at 11:54 | IP Logged
|
|
|
Here is generally what I use for motion-activated lights...
Code:
10 Set Global MDETECT T "Sink"
20 Macro MDETECT
30 Jump if( ph_getinsteonstat( "SINK LIGHT") = 2, 2, 1)
40 Device Control INSTEON+SINK LIGHT+ADIM+50
50 Jump if(ph_ismacrowaiting("SINK MOTION") > 0,1,3)
60 Formula ph_extendmacrowait("SINK MOTION", 300, 0)
70 Jump 999
80 Wait 300
90 Device Control INSTEON+SINK LIGHT+OFF |
|
|
MDETECT is a routine I pass all motion through that conditionally does stuff based on home/away, etc.
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: December 29 2011 at 19:19 | IP Logged
|
|
|
Fantastic! That is very helpful, thank you. How does MDETECT work? I would like powerhome to react differently to motion depending on day/night and home/away and guest/no guest global variables. I just found my first attempt years ago at motion detection and I used:
Wait if(ph_getglobal_n("{ONPEAK}">0,240,70)
to change the wait period depending on whether I was paying onpeak electricity rates or not. If there is a way to offload this to a separate macro (so I wouldn't have to put this line in every single macro), I would be interested if you are willing to share.
Anyone else willing to share their motion logic / macros?
Thanks,
Cris
|
Back to Top |
|
|
crisx Groupie
Joined: September 14 2006 Location: United States
Online Status: Offline Posts: 72
|
Posted: December 29 2011 at 19:31 | IP Logged
|
|
|
Also, it looks like I had my times backwards for my WAIT statement above, right? If ONPEAK, light won't shut off for at least 4 minutes, but if not ONPEAK, it will shut off in 70 seconds. Am I interpreting that correctly?
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 30 2011 at 09:27 | IP Logged
|
|
|
MDETECT just checks variables and device status and does things, if necessary.
You could put that WAIT in a macro and call it at each place instead of reentering that code each time.
if( ph_getglobal_n( "{ONPEAK}">0, 240, 70)
...returns 240 if ONPEAK is greater than zero, so, probably. ;)
|
Back to Top |
|
|