Did anybody know these appliance? OWL USB Power Meter?

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Brenner
Posts: 29
Joined: Thu Apr 19, 2007 9:58 am

Re: Did anybody know these appliance? OWL USB Power Meter?

Post by Brenner »

With the Tool "SQLite Database Browser" I discover the OWL database.

There are some other values that I want to integrate in cacti, but I have absolut no clue to modify your owl.php script so that he can output me the other values (see screenshot attachements).


This was my experiment with no php/sql experience and without real success :(
<?php
try {

$dsn = 'sqlite:/mnt/owl/be.db'; # specify your data file
$db = new PDO($dsn);

#Fuer Zeitversetzes Einlesen der Datenbank
#$t = time() - 60*5;

#Echtzeiteinlesen
$t = time();

$cur_year = date("Y", $t);
$cur_month = date("n", $t);
$cur_day = date("j", $t);
$cur_hour = date("G", $t);
$cur_min = date("i", $t) + 0; # convert '00'..'09' to '0'..'9'

#$sql = "SELECT * FROM energy_history WHERE year = $cur_year AND month = $cur_month AND day = $cur_day AND hour = $cur_hour AND min = $cur_min LIMIT 1";
$sql = "SELECT * FROM energy_param";

$result = $db->query($sql);
$data = $result->fetch();
$dsn = null;

# The below calculations are referenced to "OWL USB CONNECT user guide",
# but I'm not sure whether it's correct for your cases.
# http://www.theowl.com/uploads/downloads ... rguide.pdf


$output = "supply_voltage:" . $data['value'];

#$output = "ch1_amps_avg:" . $data['ch1_amps_avg'] * 100;
#$output .= " ch1_amps_max:" . $data['ch1_amps_max'] * 100;
#$output .= " ch1_amps_min:" . $data['ch1_amps_min'] * 100;
#$output .= " ch1_kw_avg:" . $data['ch1_kw_avg'] * 63;
#$output .= " ch1_kw_max:" . $data['ch1_kw_max'] * 63;
#$output .= " ch1_kw_min:" . $data['ch1_kw_min'] * 63;
#$output .= " cost:" . $data['cost'] / 100;
#$output .= " ghg:" . $data['ghg'] / 100;

echo $output;

} catch(PDOException $e) { echo $e->getMessage(); }
?>

Would you maybe be to kind and can help a once more? :oops:
Attachments
002.JPG
002.JPG (35.82 KiB) Viewed 1830 times
001.JPG
001.JPG (33.34 KiB) Viewed 1830 times
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Did anybody know these appliance? OWL USB Power Meter?

Post by noname »

Brenner wrote:With the Tool "SQLite Database Browser" I discover the OWL database.
I'm using "SQLite Manager" Firefox add-on to explore the database. :)
Brenner wrote:There are some other values that I want to integrate in cacti, but I have absolut no clue to modify your owl.php script so that he can output me the other values
For example..

Code: Select all

<?php
try {

$dsn = 'sqlite:/mnt/owl/be.db';
$db = new PDO($dsn);

$result = $db->query("SELECT * FROM energy_tariffv2");
$data1 = $result->fetch();

$result = $db->query("SELECT * FROM energy_param WHERE key = 'supply_voltage'");
$data2 = $result->fetch();

$result = $db->query("SELECT * FROM energy_param WHERE key = 'ghg_factor'");
$data3 = $result->fetch();

$dsn = null;

$output  =  "b1_cost:"        . $data1['b1_cost'];
$output .= " supply_voltage:" . $data2['value'];
$output .= " ghg_factor:"     . $data3['value'];

echo $output;

} catch(PDOException $e) { echo $e->getMessage(); }
?>
% php owl2.php
b1_cost:21 supply_voltage:228 ghg_factor:46
Brenner
Posts: 29
Joined: Thu Apr 19, 2007 9:58 am

Re: Did anybody know these appliance? OWL USB Power Meter?

Post by Brenner »

It works.

Many many thanks again!

:D :D :D
acidburns
Posts: 1
Joined: Tue Mar 10, 2015 2:22 am

Re: Did anybody know these appliance? OWL USB Power Meter?

Post by acidburns »

Hi, everyone!
Found this old topic about the OWL power meter.
The new style of the Owl is the cloud web interface.
There's a tricky config place, where can we put the IP address and a port for OWL metere data push :)
I'm curious if someone had already tried it to integrate in Cacti graphs :)

See attached pic.
Attachments
Capture.PNG
Capture.PNG (60.18 KiB) Viewed 1174 times
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests