Author Topic: How to have a motion detector turn on a light for a few minutes, then off  (Read 3793 times)

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #15 on: November 11, 2008, 04:05:50 am »
Having a slow night at work so I checked out the CM11A source which I haven't messed with for a while. A few points to note after reviewing the source again:

1) Security devices emitting X10 codes will fire a Sensor Tripped event. I'm now wondering if in the future I should chane it to a Movement Detected event. Anyone have an opinion on this?

2) Events are fired if a light transitions between On/Off and when any Dimms are triggered by an X10 command. However, the On/Off events are used when the lights are turned on or off, and the State Changed event is used on bright/dim commands. I'm wondering if a better implementation would be to use the State Changed event for On/Off transitions as well as the dims. I'll have to talk to Hari and Ddamron and see how they are doing it in ZWave/Insteon so that we match. Again, suggestions are welcome.

3) Regarding "Capturing" X10 events. Currently the CM11A driver disregards any received command if there is not a configured Security or Lighting device using the House/Unit code. This currently prevents us from using X10 remotes for other purposes. However, I will be adding in changes that will allow this kind of behavior. We just have to decide what event to attatch it to. So far I'm leaning towards a State Changed event fired directly from the CM11A (the CM11A being the emitter of the event). Suggestions?

4) Climate devices are currently disregarded, but will also be added.

I will be working on these over the next week so anyone with some input, please leave it and I will do my best to further improve the X10 support.
« Last Edit: November 11, 2008, 04:07:42 am by jondecker76 »

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #16 on: November 11, 2008, 07:33:47 am »
Jon,

I guess I was very lucky if it only works one way and I found that way by chance! (For once it seemed to me like something works out of the box :-)

So first I followed these excellent instructions:
http://wiki.linuxmce.com/index.php/X10
and setup the motion detector with EK_AlertType set to 4 (for motion events)

Then in Security->Active Sensors, I set the sensor to "movement" for all house modes (so that I don't have a problem with house modes initially. I can always restrict that later on.)

Then in Events, I respond to the Event "Movement is detected" (And not "sensor is tripped", which probably makes a difference). I turn on the light, then add a DCE Delay command (value in minutes as you pointed out), and then an off command.

Is this how you have it?

To answer asplodzor, I did actually find how to reset the Delay on further movement after reading through some threads on the forum.
It's not very user friendly though. I have to look at the table EventHandler in the database pluto_main. There I find the record corresponding to the event I'm building for this motion detector, and find its FK_CommandGroup value.
Then at the beginning of the list of commands in my Event (meaning before the on/delay/off sequence) I add the command DCE->Stop Pending COmmand group and put the PK_COmmandGroup value there in field 28.
So basically whenever this detector is triggered, it first stops any other command sequence from this same event (which if it was pending, would be waiting for "Delay"), so that sequence never gets to turning the light off, until my newest sequence does so (if not killed by a following sequence and so on).
It seems to work (although I only tested it once since it was freezing outside). There might be a way to identify the command group by its description rather than by its ID, but I have not tried that.

Notification was what I was going to try next. Does anyone have an idea how this event can trigger Orbiters in the house to show me a camera that's next to this motion detector?
It seems very easy to set up this kind of notification on the symbian mobile phone orbiter, but I didn't find how to do it easily for the orbiters inside my house? This would be usefull also for a motion detector at the front door for example, so that my TV would pause and show me the video when someone approaches the front door (which I always thought was a basic feature of LMCE).

Jon: when I come back from vacations (in Australia :-) I want to try and create a template for my Rain8 X10 based irrigation controller. Looks like you;re the right person to ask if I need help?

Jean


jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #17 on: November 11, 2008, 08:04:17 am »
jeangot:

I'll help you with any X10 stuff I can. I do most of the X10 source maintaining, bugfixes and upgrades, plus my house is crammed full of X10 stuff (over 100 devices) - some of which I still need to learn how to properly use and/or implement features to the CM11A driver for. So any help and additional testing I get here from the community only helps me to find and fix more bugs and add more features.


secs

  • Regular Poster
  • **
  • Posts: 22
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #18 on: December 03, 2008, 05:18:34 am »
I too am very intersted in this. I have a camera set up overlooking my workshop. I want to activate a device (X10 Appliance plug in) when ever there is movement in that area and idealy when there has been none for 15 minutes, turn the lights off.

I think I have tried most bits and pieces but cannot get it to work.

My X10 is working great. I can turn it off and on with the TEST. I have also added this to Wake House and House Sleep mode and it turns on and off

So under my Wizard Reaction to sensors I have my Camera Showing up and I have

Monitor Mode ticked
All N boxes ticked
and in every mode I have movent selected.

If I check the Alerts Log, I have a list of images of each time I walked in front of the camera.


I have tried adding an event, security sceneriou and I have confused myself.

Can someone point me in the right direction please?

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 890
  • Living with LMCE
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #19 on: December 03, 2008, 08:55:56 am »
...

Notification was what I was going to try next. Does anyone have an idea how this event can trigger Orbiters in the house to show me a camera that's next to this motion detector?
It seems very easy to set up this kind of notification on the symbian mobile phone orbiter, but I didn't find how to do it easily for the orbiters inside my house? This would be usefull also for a motion detector at the front door for example, so that my TV would pause and show me the video when someone approaches the front door (which I always thought was a basic feature of LMCE).

Jon: when I come back from vacations (in Australia :-) I want to try and create a template for my Rain8 X10 based irrigation controller. Looks like you;re the right person to ask if I need help?

Jean


Try to do it from Orbiter (going into screen with camera), see what command gets fired in logs and then use the same from event handler....

HTH,

regards,

Bulek.
Thanks in advance,

regards,

Bulek.

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #20 on: December 05, 2008, 07:48:08 am »
Bulek,

thanks, yes I will do that. Will report if it works. I could event play a beep (saw a command somewhere to do that), then after a certain Delay I could unpause the media and revert to media playing or something like that. Will report if I get any luck.

Jean

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1074
  • hrumpf!
    • View Profile
    • La Smarthomes - SoCal smarthome site
Re: How to have a motion detector turn on a light for a few minutes, then off
« Reply #21 on: December 08, 2008, 05:29:15 am »
Ok, i for some reason cant get this setup properly. I think i will try and delete my cm11 and try again because it isnt seeing anything at all, which i dont get at all.  :-[
Those people who tell you not to take chances, they are all missing what life's all about.

Wiki Hardware Page http://wiki.linuxmce.org/index.php/User:Langstonius

joerod

  • Guru
  • ****
  • Posts: 153
    • View Profile
Is there any update to this?  I tried getting up to the part where it would turn on a light and  can't seem to get it to work.  Any updates or is this out of date..

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
I wiki'd this a while back, when I was still using X10.

see my post here : http://wiki.linuxmce.org/index.php/Using_Respond_To_Events

This worked well for me at the time. I have since switched to Zwave. But the instructions should get you what you want.

Best Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

Techstyle

  • Addicted
  • *
  • Posts: 674
    • View Profile
    • Techstyle UK Ltd.
Seth,

I used your page and it worked fine for me although I think the 'Delay' is in Seconds

Techstyle