The Owl USB Energy Meter and using the SQLite Database with PHP

I’ve had The Owl running for a little while now and the software that comes with it is a little bit rubbish to be honest. I kinda works OK I guess but is very limited, so it was time to have a little hack at it and see what I could find.

I basically wanted to plug the Owl monitor into my server and then record all the data into a MySQL database that I could then query and display pretty charts using PHP. I tried a few 3rd party bits of software, but none of them worked, none of them would even connect to the Owl via USB, so that led me back to the original Owl software.

You can export data to a CSV using the GUI, but this is a manual process and I’m more interested in automation, as you may have guessed. So, after a bit of digging, it seems that the Owl software saves data once a minute to a .db file which can be found in C:\ProgramData\2SE\be.db

This file can be opened with SQLite Database Browser 2.0, it’s pretty straight forward if you have a little nose around.

After a bit of playing I finally figured out how to get the data I was after. ‘ch1_kw_avg’ * 0.060 = Average kWh for that minute.

Try this query for example:

This will return the most recent kWh data, near enough your live kWh, the same figure that should be displayed on your Owl monitor.

So, after installing PHP on one of my servers I then setup a basic website (having used this code as a base) which would talk to the database and return the information I wanted. It also auto refreshes every 60 seconds. This is still in it’s very early stages, but I plan to make this app quite powerful with graphs and fancy stuff!

Dave’s Energy Page

‘.$output.’

This of course requires the Owl Energy Usage Monitor software to be running 24/7 and recording all the data in the SQLite DB. this shouldn’t be a problem for me as my servers are always online. With a quick NAT I can now access this page from anywhere, which will be handy once I’ve made a fancy app from it.

For reference, some official documentation can be found here.

  • alebil

    Hi,
    I’ve tried but don’t work, I use the latest version of the OWL SW, below the code snippet that work with my system.
    Anyway thank you for the idea I have resolved a problem in a new interesting way, and I have learned a lot of things.

    8< ——- cut here ————————————————–

    open(‘c:alexbe.db’);
    }
    }

    $db = new MyDB();
    $result = $db->query(‘select ch1_kw_avg from energy_history limit (select count(*) as numero from energy_history)-1, (select count(*) as numero from energy_history)’);
    $dbrow= $result->fetchArray();
    $mykw = $dbrow['ch1_kw_avg'] * 0.060;
    echo ‘ Current Usage ‘.$mykw.’ kWh’;
    ?>

  • alebil

    Sorry I don’t know why the piece of code is truncated I try again
    ———————————————————————–

    open(‘C:ProgramData2SEbe.db’);
    }
    }

    $db = new MyDB();
    $result = $db->query(‘select ch1_kw_avg from energy_history limit (select count(*) as numero from energy_history)-1, (select count(*) as numero from energy_history)’);
    $dbrow= $result->fetchArray();
    $mykw = $dbrow['ch1_kw_avg'] * 0.060;
    echo ‘ Current Usage ‘.$mykw.’ kWh’;
    ?>