Using Respond To Events
From LinuxMCE wiki
A Real World Example
Recently I have added a few X10 motion sensors to my system at home. The first step in getting them online is to follow the instructions located here, to make the necessary modifications to the CM11A template, and the motion sensor itself:
After these changes are in place do a reload of the router per the instructions, and then we can continue with making things happen.
A background here. My wife asked me, now that all the lights in the lower floor of the house and the garage are controlled by the core, if it would be possible to have those lights come on, when she pulled into the garage. And as this system is one of the most configurable that I have ever seen, I set out to make it happen. First, I will list the items that I am using with the system to make this happen
Now the cm11a can usually be had very inexpensively on eBay, I think I payed $15 shipped for the one I am using the other items can cost $20 to $25 each, but on eBay or X10.Com you can get deals where you can get the TM571 with a set of wireless switches, and some socket rockets for as little as $20. I purchased a 5 Pack of the ms14A's for $25. Just have to watch for the specials. ;)
Ok, now that these items are in your possession, you need to assign them a House code and a device code. My TM571 is set to house code A. I set the motions sensor under security devices for the garage to House/Unit code A15.
1.) Log into the webadmin, and in the left column, click on Respond To Events.
2.) Come up with a name for your event
3.) From the dropdown menu chose "A sensor (door/window/motion/etc) is tripped.
4.) Click Add
Now you should see your event listed above. Next we click the Edit link, and start to set up the event.
Setting the event criteria
Now that we have our event, we can use the "Edit" link to set it up.
1.) Click Edit
A new window opens up:
Now we see that the Description and the Event are already filled in, next we need to set the criteria up:
2.) "What Device? "=" Choose Motion Detector from the dropdown
3.) "What time of day?" = This can be DAY, NIGHT, or a 2400hr based time, i.e 1800hrs for 6PM
- A note here. Thanks to TSCHAK and possy for helping me not over think the process. I was messing with time slots for this night only event, like 1800hrs to 0600hrs, and duh! The word "NIGHT" was in their descriptions, and as the system knows when it is night (sunset).... So thanks again, you guys rock :)
4.) "What trigger state?" "Event parameter" choose "Tripped" from the dropdown. = I left this next space blank.
5.) Click update
Setting the device instructions
This next step can be as simple as turn on a light using the Lighting Wizard, however, as we are trying to be green, I also wanted to give instructions to have the light turn off after 5 minutes, which is plenty of time to get into the house, and go upstairs. So we use the "Advanced Wizard" to make these settings.
1.) Choose "Advanced Wizard" from the dropdown
2.) Choose lights from the next dropdown (Garage Lights)
3.) Choose command from the next dropdown (On) - Click Add
These next 2 steps program in the 5 minute delay
4.) Choose device from the dropdown (DCERouter)
5.) Choose command from the dropdown (Delay) - Click Add
6.) Choose device from the dropdown (Garage Lights)
7.) Choose command from the dropdown (Off) - Click Add
Now to set the delay, the system uses milliseconds. 5 minutes in milliseconds is 300000. So to get 5 minutes, we set:
- 102 Time (string) to 300000 as seen above.
That is it. Now you should have a event that turns the garage lights on when movement is sensed only at night according to the system, and then turns them off for you after 5 minutes have passed.
A note here, this event fires every time the sensor "sees" motion. So if you are unloading groceries, every time you walk past the door/sensor, the event resets, and therefore so does the 5 minute clock.
This is a scenario for Night mode. As the garage has windows, and the door opener light, there is no need for it to fire during the day. That is why we put the "NIGHT" entry in. However for the basement that is attached to the garage, I have left that area blank, as I always want the lights to come on, and then turn off after 5 minutes.
I hope this helps someone get more "automated" and a bit more "Green" by not having lights burning all day long. If anyone has any other ways, or shortcuts in setting up this event, please feel free to modify this document.
Enjoy your "Automated" lifestyle.
--Sethj 15:18, 2 November 2009 (CET)