Best Way to Run a .BAT file from an M1 Trigger?

upstatemike

Senior Member
Just curious what most folks who have an M1 are doing to trigger .BAT or .EXE files based on a change in an Elk M1 zone? Is there a way to do it using Elk RM and a rule?
 
I don't use ELK RM but after a quick scan of its manual I don't believe it can be used to execute PC-based programs. Aside from controlling Russound equipment and an iPod, I did not see any facility to trigger external applications.

Maybe an experienced RM user can chime in and set the record straight.


FWIW, the following Perl script will loop forever and monitor all messages transmitted by the M1. When it sees the message that zone 1 was violated it will execute YourFile.bat.

Code:
use ElkM1::Control;
	my $elk = ElkM1::Control->new('host' => '192.168.0.251', 'port' => 2101, use_ssl => 0);  # Connect to the M1
	while (1) {  # Loop forever
		while (my $msg = $elk->readMessage) {  # Read M1 messages
			if (ref($msg) eq 'ElkM1::Control::ZoneChangeUpdateReport') {  # Look for zone changes
				if ($msg->getZone == 1 and $msg->isViolated) { # Was zone 1 violated?
				   system("YourFile.bat");
				}
			}
		}
	}

For more information, refer to "How to Control an Elk M1 via External Perl Scripting" in the How To forum.
 
Nice sloution! I think it would be worthwhile to post the detailed instructions in another thread. I can see people who don't want to run a full PC based automation program still using something like this for playing wav files and such in response to Elk triggers.
 
IIRC ElkM1::Control is not really a "PC" solution, this could be integrated into an embedded solution to just extend the Elk functionality.
 
You could use something like ElkM1::Control to replace the Homeseer COM interface in My.Elk and port it over to whatever that way....?
 
Back
Top