From: Clive F. <sc...@fi...> - 2003-12-27 08:52:54
|
> My questions to anyone who can help me is, what can I do or read to > find out how to do, in order to get MisterHouse to play a sound file > whenever motion is detected in a certain range of hours?? > > I know how to write a perl script that will execute a program at a > certain time, but how do I access the serial port/CM11a data whenever > it comes available upon motion detection??? Not sure if you got an answer to this. The following example is based on code/examples/x10_motion_sensor_******.pl and code/common/hello_play.pl # Category = Test $movement_sensor_unit3 = new Serial_Item ('XA1', 'UNIT3MOVEMENT'); $movement_sensor_unit3 -> add ('XA1AJ', 'UNIT3 ON'); $movement_sensor_unit3 -> add ('XA1AK', 'UNIT3 OFF'); $movement_sensor_unit3 -> add ('XA2', 'XA2'); $movement_sensor_unit3 -> add ('XA2AJ', 'DARK'); $movement_sensor_unit3 -> add ('XA2AK', 'LIGHT'); # Motion detected if (state_now $movement_sensor_unit3 eq 'UNIT3 ON') { set $sitting_room_lamp "on"; play(file => "hello_from_bruce.wav"); } Clive |