ic: website Home · Archives · Photo Gallery · ic: forum Web feed (RSS)
The life and times of james Hart: his family, his music, life in Luton and his occasional escapes onto the internet.

Sunday, 9 September 2012

A (long overdue) day trip to Bexhill

We took a brief journey to wish my Mother a (slightly belated) happy birthday, yesterday. Once we had navigated the M25 (blocked by a very recent accident) and the A21 (painfully slow) we had a lovely day, with lunch at the Box Tree café on Wickham Avenue, near the park, then taking a walk along the sea front to see the bus, hanging off the edge of the De La Warr Pavilion (known as "Hang On A Minute Lads, I've Got A Great Idea").

It was rather serendipitous, really, since Eddie Izzard - the main sponsor of the artwork (which was part of the London 2012 Festival) was visiting, too; we left him to it, but it was rather good to be able to take a photo of him admiring the art he played a great part in funding.

A few photos of the day are below - there are, as always, more in the gallery.

(It's worthy of note that our journey back - via the A23 and M25 via Heathrow - was a lot less eventful... perhaps simply because it was late on a Saturday evening!)

Posted by james at 8:29 PM

Sunday, 2 September 2012

Owl + USB energy monitor - how to get live data from it (techie)

We've had an Owl energy monitor for a while; we decided on the version with the USB interface, since it's possible to download thirty days worth of energy use, which can then be used to get a better idea of when we're using too much electricity... that's the theory, anyway!

I thought I might see if I could get live data off the device, using the USB cable and the software that came with it. I was delighted to find that the latest version of the software - although it only works with Windows - can run in the background, and updates a fairly simple SQLite database with the latest data from the Owl.

It's therefore possible to run queries against the database, using the SQLite3.exe command line (which is obtainable from the http://www.sqlite.org/download.html>sqlite.org website (at the time of publishing, it's in the sqlite-shell-win32-x86-3071300.zip file) to output the data:

C:\Uses\james> echo select * from energy_history; | sqlite3 C:\ProgramData\2SE\be.db

The data will rattle up the screen - it's up to you how you use this information, but the key bit is getting the information from the fields of the database; the separator is |.

The important fields are (save for fields 2 to 6, which contain individual date and time elements) 7 and 15, which contain an electrical current value and the full date. To get the current kW reading, though, one has to multiply the current value by 60 and then by the voltage supply as set in the options of the Owl (generally 240) then dividing by 1000. In this case, then:

1719928|2012|9|2|12|34|0.0385|8.855|46|1292|0.0385|0.0385|8.855|8.855|2012-09-02 12:34:00.000

The current power at 12:34 on the 2nd September is 0.0385 * 60 * 240 /1000 = 0.5544kW

How you express this depends on what you'd like to do with it; I've written a bit of shell script that uses gawk to extract the data then compiles it into an RSS file, and I use the Simple RSS Widget on my Android phone to display the most recent state of our electricity use. For completeness, here's the script:

#!/bin/bash
webroot="/var/html/"
webrss=$webroot"/"$rssfile
pubdate=date +"%a, %d %b %Y %H:%M:%S %z"
nowdate=date +"%H:%M:%S %d-%m-%y"
guid=date +%Y%m%d%S%M%H
thisdata=echo "select * from energy_history;" | /usr/bin/sqlite3 /media/owl/be.db | /usr/bin/tail -n 1
thisused=echo $thisdata | /usr/bin/gawk -F "|" '{ avg = (int($7 * 60 * 240)) } END {print int(avg/10)/100} '
thisdate=echo $thisdata | /usr/bin/gawk -F "|" 'END {print substr($15, 1, 19)} '

echo '' > $webrss echo '' >>$webrss
echo '' >> $webrss echo ' Owl report' >>$webrss
echo '        Current status of Owl energy monitor' >> $webrss echo ' http://www.your.site/'$rssfile'' >> $webrss echo ' '$pubdate' ' >> $webrss echo ' '$pubdate' ' >> $webrss echo ' 600' >>$webrss
echo '        ' >> $webrss echo ' Owl update at '$thisdate'' >> $webrss echo ' Current Owl display: '$thisused'kW' >> $webrss echo ' '$guid'' >> $webrss echo ' '$pubdate'' >> $webrss echo ' ' >>$webrss
echo '' >> $webrss echo '' >>$webrss

# do the test

Posted by james at 12:02 PM

 This site is owned and operated by Image Communications, including all content and stuff. It's powered by Movable Type 5.2