Adding Open Flash Charts to my home monitoring

Share

As mentioned previously, I’ve built a home temperature monitoring system on top of the beer fridge controller that Doug and I built over Christmas. I later added a hygrometer and whole of house power measurement using a Current Cost. There is also a simple server which provides a UI for the system, which previously used PNG graphs generated from Google’s Chart Server API.

I was checking out Jon’s car hacking the other day, and was impressed by his flash graphs. However, as best as I could tell he’s using a commercial flash charting tool, whereas I wanted something open source. I dug around and found Open Flash Charts which was exactly what I wanted.

Why flash charts by the way? I wanted a richer presentation than I could get with PNG, and I am unaware of a way of doing interactive graphs with HTML5 apart from writing massive amounts of javascript. I look forward to someone educating me about an alternative, but until then I will view flash graphing as a punishment for all those overly smug iPad users out there.

So, first off here is an example of a flash chart. This one is power usage at my house from Friday, compared with Wednesday:


Open Flash Charts is actually really simple to use. First off there is some javascript to load the flash component:

    <script type="text/javascript" src="http://www.stillhq.com/local/swfobject.js"></script>
    <script type="text/javascript">>
    swfobject.embedSWF(
      "http://www.stillhq.com/local/open-flash-chart.swf", "2010_04_23_2010_04_21_Watts", "600", "400",
      "9.0.0", "expressInstall.swf",
      {"data-file":"http://www.stillhq.com/json/2010.04.23;2010.04.21/Watts"}
    );
    </script>
    

This javascript relies on a couple of resources being available on your server, which I’ve put into a directory called local. You find these files in the Open Flash Chart .zip file, although you could just snarf them from my server if you want.

Then all you need to do on the HTML side is include a div with the right id where you want the graph to go. For this post, that looks like this:

    <div id="2010_04_23_2010_04_21_Watts"></div>
    

Then you just need to write the JSON which represents the graphs content. That’s well documented on the Open Flash Charts site, but you can find the JSON for my graph at http://www.stillhq.com/json/2010.04.23;2010.04.21/Watts if you want to see it.

Share

I don’t claim these are new

Share

But they’re still funny… As sent to my wife in IMs this evening:

Ahhh, flash. Reminds me of papal wackamole.

Share

Recovering from a bad flash

Share

In the previous post I mentioned that I had a couple of bad experiences with the Debian installer and the Linksys upload web page. Luckily, it’s really easy to recover from these. You do that with the magical RedBoot sequence (RedBoot is the boot loader the slug uses). Do something like this:

Download the Linksys firmware from their web site. I tried this technique with the Debian installer image and it didn’t work, so I only know it works with the Linksys firmware. Put that firmware on a web server on your local LAN which the slug will have access to. Then, connect to the boot loader. You do that by running this command…

    sudo arping -f 192.168.0.1; telnet 192.168.0.1 9000
    

…and then power cycling the slug. You’ll end up with this:

    $ sudo arping -f 192.168.0.1; telnet 192.168.0.1 9000
    ARPING 192.168.0.1 from 192.168.0.100 eth0
    Unicast reply from 192.168.0.1 [00:0F:66:7D:1E:09]  10.717ms
    Sent 17 probes (17 broadcast(s))
    Received 1 response(s)
    Trying 192.168.0.1...
    Connected to 192.168.0.1 (192.168.0.1).
    Escape character is '^]'.
    == Executing boot script in 1.670 seconds - enter ^C to abort
    ^C
    RedBoot>
    

You have to be pretty quick on the draw here with the control C, as you have about 2 seconds to hit the sequence before the slug starts to boot normally instead. Now that you’re logged in, you can download the new firmware:

    ip_address -h 192.168.1.100      The IP of the HTTP server
    load -r -v -b 0x01000000 -h 192.168.0.100 -m http /NSLU2_V23R25.bin
                                     Load the firmware file
    fis write -f 0x50060000 -b 0x01060000 -l 0x7a0000
                                     Write it
    reset                            Reboot
    

And you should be back at the Linksys firmware. Note that you will still have the network settings that you had set before…

Share

14 November 2003

Share

Cooking salmon

Last night I cooked with fresh salmon for the first time. I did it on the barbeque. The basic method was:

  • Preheat the barbie on low
  • Lightly butter the side of the salmon you’re going to cook first
  • Chuck the salmon steaks onto the grill part of the barbie
  • Wait three minutes
  • Rotate 90 degrees
  • Wait two minutes
  • Lightly butter the side that is facing you
  • Flip
  • Wait two minutes
  • Eat

Here’s a sample of how mine turned out:

Syncing FAT filesystems of MMC cards via USB

Why does it take so long? A 64 MB change took in the order of minutes to respond to a sync command.

Siemens SL42 MP3 playlist format

Creating the playlists for the inbuilt MP3 player for my Siemens SL42 is painful at best when you try to use the phone keypad. Basically, there’s no way to say “randomly play everything” unless you use a playlist, and to create a playlist with the phone you need to select each song individually. Anyways, so I mounted the MMC on my trusty laptop, and it turns out the playlist format is trivial. Here’s what I did:

mount /mnt/mmc
cd /mnt/mmc/mp3
rm aaa.mpl
for item in `ls *.mp3`
do
  echo $item >> aaa.mpl
done
unix2dos aaa.mpl

In other words, all you need is a DOS line ending file which lists the MP3 files to play.

AUUG National Committee meeting

In Sydney…

Share