WebCam

Home Webcam
Home arrow Home Automation
Home Automation : IP Power 9212 E-mail
After my developments with the IP Power 9212 I have written a small perl program to show how to talk to the device using UDP.
Remember, I found all this by sniffing the traffic over my LAN whilst using the example programs. I'd recommend you do the same instead of blindly using the example below as it is good working practice to understand the principles of UDP communications, and how this device uses those principles.


NOTE: This code is not endorsed or supported by IP Power, and sending the wrong UDP commands to your unit may damage it and damage the warranty. I take NO responsibility for anything this script does/doesn't do to your unit, nor can I accept any responsibility if you utilise and portion of this or any documentation that may cause harm to your unit.


#!/usr/bin/perl

## Create a UDP socket to the device
use IO::Socket::INET;
$MySocket=new IO::Socket::INET->new(PeerPort=>7070,
        Proto=>'udp',
        PeerAddr=>'192.168.0.15',
        TimeOut=>10);

## First check what inputs are triggered

$MySocket->send("AVOISYS00");
$MySocket->recv($text,128);
chomp($text);
if ($text) {
	($return_val,$junk)=split(/avoisys/,$text);

	if ($return_val eq "255") {
		## All inputs are off
		$all_off=true;
	};
	if (($return_val & 128) eq 0) {
		## input 8 is on
		$input8=true;
	} else {
		## input 8 is off
		$input8=false;
	};
	if (($return_val & 64) eq 0) {
		## input 7 is on
		$input7=true;
	} else {
		## input 7 is off
		$input7=false;
	};
};

## Now switch on 2 and 3 outputs
$MySocket->send("AVOISYS12");
$MySocket->send("AVOISYS14");

To discover the commands for yourself, you need the IP Power 9212 development VB software. You will also need some software to sniff connections over your lan. For this i'd suggest either tcpdump for linux, or ethereal for windows.
Start the software, and start sniffing data on your ethernet interface, filter it by IP address and view only communications to/from your IP Power device (i.e. the IP you setup with the device). To do this in tcpdump:
tcpdump host 192.168.0.20

This will then start displaying data captured whilst communications take place to the device on 192.168.0.20. You then need to send/receive various commands from your IP Power device. Watch for any statements that contain AVOISYS as those prefix all commands/return commands from the IP Power device.
Good luck!
 
< Prev

(C) 2009 thebmwz3.co.uk
Joomla! is Free Software released under the GNU/GPL License.