Official repo stats
owl-packet-interceptor is a PHP library which intercepts and parses XML packets sent via UDP by an OWL Monitor.
To do so you first need to change the Data Push Settings on your OWL Intuition Dashboard providing IP address and port where you will install owl-packet-interceptor.
At the moment owl-packet-interceptor is able to handle packets coming from these devices:
owl-packet-interceptor is divided in four main packages:
So:
Create a new folder and move into it
Install owl-packet-interceptor
$ composer require dalen/owl-packet-interceptor:dev-master
Create a new php file, say App.php, and write something like:
<?php
require_once('./vendor/autoload.php');
use Dalen\OWLPacketInterceptor\Listener\UDPListener;
use Dalen\OWLPacketInterceptor\Storage\StdOutStorage;
use Dalen\OWLPacketInterceptor\Parser\Parser;
// create listener on port 8000
$listener = new UDPListener('0.0.0.0',8000);
// create a new parser
$parser = new Parser();
// create standard output storage (outputs on the console)
$storage = new StdOutStorage();
// listen for new packets
while(true)
{
// pass the XML string to the parser
$parser->setXMLString($listener->read());
// make the storage handle the Packet object extracted by the parser
$storage->storePacket($parser->parse());
}
Run App.php
$ php App.php
Open a new shell and try to send a packet
$ echo -n "<electricity id='AA12345679'><signal rssi='-86' lqi='91'/><battery level='100%'/><chan id='0'><curr units='w'>1288.00</curr><day units='wh'>9904.89</day></chan></electricity>" | nc -4u -q1 127.0.0.1 8000 > /dev/null 2>/dev/null &
App.php should print
This is an Electricity Packet
Now you're ready to write your own Storage!
MIT