Automating access to the TPI for monitoring data seems to be too cumbersome, for little gain.
(I got timing issues with all the telnet and socket libraries i found)
The easiest way I found to get all the info I need is to scrape the internal webpage on the EVL-3.
Then I parse that to display a color coded list of zones, and an ascii blueprint with color-changing doors and windows based on reported state.
Here is the basics:
Code: Select all
$url = 'http://192.168.0.35/2'; //disabled DHCP to get a fixed internal IP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "user:user");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$dom = new DOMDocument;
@$dom->loadHTML( $output );
foreach( $dom->getElementsByTagName( 'span' ) as $sp )
{
$v = $sp ->nodeValue ; //Zone number
$t = $sp->getAttribute('title') ; //Zone state: OPEN, CLOSED
// ... format for display as table, graph, send emails, etc...
}