GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: August 02 2008 at 14:00 | IP Logged
|
|
|
OK. Here goes a detailed explaination of how I (with Dave's awesome and patient help) integrated webcamXp into PH so that I could trigger macros in PH from motion detection on cameras monitored in webcamXP.
Experienced PH users can skip over a lot of this explaination. I have put in lots of detail to help the Newbies like me that are still coming up the learning curve.
Integrating the motion sensing capabilities of webcamXP (a compact, capable, and easy to setup web based video delivery application available at www.webcamxp.com) into PH is very straightforward.
Once done, motion or unusual audio noises sensed by webcamXP can be used to trigger a PH macro, or any other PH capability.
The latest version of webcamXP (v 5.3.1.264, or better) now has added capability supporting Windows Message services. This allows an inter-process message to be sent to other applications running on the same computer. Using this capability to send a Trigger message to PH provides significant enhanced power to the PH environment. Notably, in addition to this inter-process messaging, webcamXP also supports many other kinds of alert notifications including email, SMS phone messages, etc.
webcamXP Setup
To utilize the security feature of webcamXP (“WCXP” from now on) with PH, open the Security Tab in WCXP (along the left side), select the video source to be sensed in the Source Selection window, adjust the Sensitivity settings in the Sensivity (sic) tab [I found a setting of Medium 8-squares with 15% to be about right with few false triggers.]
Now select the “Windows Message” tab and fill in the parameter fields as follows:
Code:
Message = 1024 [this is the first Windows Message (WM) Trigger in PH]
LParam = 3445 [This could be any number. Its value is just used in PH as a (hopefully) unique key to prevent false PH triggering from any other WM that might be used by any other programs running on the same computer.]
WParam = n [where ‘n’ is the camera number you have selected in the WCXP Source Selection window. This value will be used in PH to identify which camera sensed motion, in the event you wish to take different actions for different cameras. I'm sensing for motion on camera-2, thus n=2 for me.]
|
|
|
Check the “Send Windows Message” box in the WCXP Enabled Features window.
Of course, be sure to turn on the Enable/Disable button at the top of the Motion Detection window. For the moment you may want to leave it off until PH is set up.
PH Setup
There are many ways to handle a motion response in PH. One could react with a direct Device Control action, but for maximum flexibility I chose to create a Macro that could then be called by a Trigger.
The first step is to create a Macro the Trigger can call. To create a Macro open the PowerHome Explorer (red circled icon below).
Open the PowerHome>Macros window, right click in it and select “Insert”. This will insert a blank macro line. Create a name for your macro in the cursor field and enter a Description. The remaining fields can be left as is. To create your new macro, click on the small white box to the left of its name in the Macros “ID” column. This opens the Macro Detail window, where macros are edited.
My four line macro is set up to be more flexible than I’m using at the moment, but its design is a good generic starting foundation.
Remember theWCXP Windows Messaging (WM) setup had several Parameters, one of which was “WParam” which had the camera number in it. When this WM call arrives at PH this parameter is saved in TEMP3, which can be accessed from within a Macro. Using this as a Jump Label allows a single macro to serve multiple cameras.
Thus examining the macro, we have. . .
Code:
Line 10 examines TEMP3 and jumps to that labeled line (line 30 for camera 2).
Line 20 provides a macro return in the event of no label match at all.
Line 30 is the label for camera 2
Line 40 pops ip a message box titled “Camera” with a message of “Camera 2 Motion” and an automatic timeout to close the window of 20 seconds. For now this is just a holding line for me. This line 40 (and more) will eventually be composed to light lights, sound sirens, etc if a ‘perp’ is detected when we are gone.
|
|
|
Now that we have a Macro, we need to create a Trigger to call it when a camera motion message arrives.
A Trigger is created much like a Macro. Open a PH Explorer>PowerHome>Triggers window. Right click and select Insert. Name the Trigger (I called mine “CAM 2” since that is what I am detecting motion on) and fill in the remaining fields as follows (some are pull down menus, others you fill in). . .
Code:
Description=whatever makes sense to you.
Action Type=Macro
Action=CAM {the name of the Macro we just wrote to handle the event}
Trigger Type=WM_USER
Trigger ID=Trigger 1 {this is the WCXP Message value of 1024 which is the first trigger value in PH by default. Trigger 2 would be 1025, etc.}
Boolean=[TEMP4]=3445 {Normally the Boolean field is just left at 1, but in this case we will use this field as a safety net to prevent false triggering. If this field contains an expression, then it is evaluated. If it evaluates to zero, then the Trigger will not occur. Any other value results in the Trigger being activated. In this case the WCXP first parameter field was set to 3445. This was a totally arbitrary value just intended to be a security key that was likely to be unique. Since this parameter is passed to PH and placed in TEMP4, we can check to make sure this is really an intended security trigger. If there are no other applications running on the same computer with PH, that would ever make a Windows Message call, then this safety feature is not needed, but it is good practice, just to make sure.}
|
|
|
At this point, everything is set to go. You should be able to go to webcamXP and activate the camera motion sensing in the Security tab (make sure to check the desired Enabled (notification) Features box, and let ‘er rip! You should see PH actions within a second of motion being detected.
Enjoy!
Edited by GadgetGuy - August 02 2008 at 19:48
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|