Sunday, December 30, 2007

More Needed Maintenance

We're using the CheaperTronics 8 meter RFID transmitters for vehicle tracking. The problem is they are really sensitive to voltage levels and as the 2032 battery output drops, the transmitters start dropping out. The batteries become useless after several months so today I picked up some AAA battery holders from Radio Shack. I soldered the battery holder wires to the transmitter circuit board loaded it up with a couple batteries and rubber banded it to the case. They work great now. We'll see how long the batteries and reliability last.

Saturday, December 29, 2007

Back to 2000

After doing the Audrey upgrades, I decided to update the rest of my hacks from 2000. We still have the Series 1 TiVo which was hacked back then when a 30GB drive was added to the 14GB original. Later the 14GB drive died and the 30GB was made the lone drive. This time around I added an 80GB drive to bump the capacity up to 128 hours.

Today, I got rid of Win98 on the I-Openers I had hacked and took out the hard drives. Since I was only using these as digital picture frames, I didn't really need a full OS and all the functionality. I loaded the internal flash with the Midori Linux build from here, loaded pics on a USB flash drive and put everything back. Now, it's much quieter without the hard drive and more reliable given that those HDs were refurbs (they have lasted a long time just fine though).

Sunday, December 23, 2007

Summary of New Audrey Hacks

This is just a note to myself to document the hacks I added to the Audrey:

  • Enable access to Audrey internal web server
    Edit file /config/rm-apps, change this line
    rb,/kojak/kojak-slinger, -c -e -s -i 127.1
    to look like this
    rb,/kojak/kojak-slinger, -c -e -s

  • Installed Plus pack (
    This adds some Unix commands like mv, grep, and especially fs-cifs which lets us mount windows file shares. Added these lines to the bottom of /kojak/ to mount the mp3 directory on our windows server:
    sleep 10 # wait for networking to come up
    /nto/bin/fs-cifs -a //mywindowsservername: /mp3 user password

  • Installed telnetd/inetd (
    This lets us telnet into the Audrey so we don't have to sit typing at it. Made installing all these hacks easy to do from the comfort of a real keyboard.

  • Added the ability to push WAVs by installing playsound_noph from here and added this file (/data/XML/playsound.shtml) to the Audrey web server:

    <html><head><title>WAV Push</title></head></body>
    <!--#exec cmd="playsound_noph $QUERY_STRING &" -->
    Now WAVs can be remotely pushed to the Audrey by loading this URL: http://audrey.ip.address/playsound.shtml?http://windows.server/wavs/abc.wav

  • Installed GUI MP3 Player phplay ( also relevent
    So now we can play music off our server.

  • Created my own icon for phplay and added it to the Audrey Options menu (

  • Installed the Mr. Audrey package manager (
    This is necessary to install the gui-less MP3 player (plaympegaudio_noph) to push MP3s to the Audrey since I couldn't find it anywhere except in an install package for Mr. Audrey. Just transfer this file to the Audrey, chmod +x and then execute it to install the package manager

  • Installed plaympegaudio_noph ( Same thing, transfer it to the Audrey, make it executable and run it. Created /data/XML/playmp3.shtml:
     <html><head><title>MP3 Push</title></head></body>
    <!--#exec cmd="plaympegaudio_noph $QUERY_STRING &" -->
    Similar to the WAV push, the MP3 push can be done by accessing the URL. It can be automated in a script using wget to download the URL.

  • I think that's all. I replicated the changes to 3 other Audreys by dumping an image to a CF and installing it on the other 3. Not bad for an evening's work :)

    Saturday, December 22, 2007

    Shoehorned a High Efficiency PS into the kitchen PC

    I picked up the smaller SPI180LE power supply for this PC. It doesn't fit nicely into the chassis so I dremeled and drilled and wedged it in pretty good. Now it runs about 35 watts in idle. Not as great a savings as I expected but in the long run, it'll add up.

    I'm also working on some long delayed integration of our 3Com Audreys. They've been nice touch screen control panels for the various ASP scripts on our HA server, but I've added some of the more common HA fixes: being able to set the LEDs remotely, pushing WAV files to them, MP3 playing capability and the ability to mount Windows shares.

    The Audrey's blinking LEDs will now signify there is a voicemail in HAL. I added this code to the starCOMUltra hosted script to run a script to blink all the Audrey's LEDs when there are new messages:

    function HALVM() {
    HalNewMsgCountOld = HalNewMsgCount;
    HalMsg = HAL.Phone.Mailboxes.ItemByName("Main").Messages;
    HalMsgCount = HalMsg.Count;
    for (i=HalMsgCount;i<=HalMsgCount;i++) {
    if (HalMsg.Item(i).IsNew) {
    if (HalNewMsgCountOld!=HalNewMsgCount) {
    if (HalNewMsgCount>0) {
    ShellCmd.Run("perl site/scripts/ 1",7);
    } else {
    ShellCmd.Run("perl site/scripts/ 0",7);

    The Perl script just accesses the Audreys' internal web server to toggle the lights:

    `wget "http://xx.yy.zz.1/cgi-bin/SetLEDState?$ARGV[0]" -t 1 -O c:/ftp/audrey_light.out`;
    `wget "http://xx.yy.zz.2/cgi-bin/SetLEDState?$ARGV[0]" -t 1 -O c:/ftp/audrey_light.out`;
    `wget "http://xx.yy.zz.3/cgi-bin/SetLEDState?$ARGV[0]" -t 1 -O c:/ftp/audrey_light.out`;

    I still need to figure out how to take advantage of the WAV pushing feature...

    Wednesday, December 19, 2007

    GTalk Babble Bot

    Ok, this is not HA related but we use Google Talk as our primary chat too. They've just announced that they've created bots that can translate conversations on the fly. VERY COOL. Check it out!

    Monday, December 17, 2007

    D201GLY2 Kitchen PC built

    I've got the kitchen PC built and running Win2k although text is kinda crappy on the Vizio 20" TV. I tried all sorts of drivers and even loaded up XP to see if it would make a difference. Doesn't appear to. Native resolution of the TV is 1366x768 and I can't get the card to do that - best I get is 1280x720. It's OK for now.

    Anyway, it's running with a 160GB HD and 1 GB RAM. I'm leaving the DVD out to save some power. It peaks around 55 watts and idles around 48 watts. I'm hoping to pick up a high efficiency power supply like the SPI220LE to see if I can get the power down even further.

    Sunday, December 9, 2007

    HA Server Rebuild...again

    Rebuilt the HA server yet again. There were some issues I had with Win2k and the hardware combination (E6420 Core2 and ECS PT890T-A mobo). Anyway, with XP it's perfect and all the compatibility issues I was having are gone.

    The kitchen PC is moving forward. I found a good deal on a D201GLY2 board at Cost Central. Free shipping and $5 off with Google Checkout. Beats which doesn't have it in stock and has raised the price about $2/week for the past several weeks. I guess they were noticing lots of page views for the D201GLY2 and even though they didn't have it in stock, they raised their price anyway. Lame. Anyway, I need to get a gig of cheap PC2 4200 memory and I'm all set. I got a nice cheap uATX case here with free local pickup. Total cost should be about $100 less the TV/display as I'm reusing a hard drive and CD. Not bad.

    Saturday, December 1, 2007

    Web content filtering

    Part of my HA setup includes running the Squid proxy/cache. I also run Adzapper in conjunction with Squid to remove annoying ads, popups, tracking bugs and scripts. Lately, there's been a huge uproar over Facebook's Beacon program, which has been found to be very intrusive spying on your web surfing habits. This article looks at the various options to block Beacon and finds that blocking a certain URL pattern will work. So I've added this line to my Adzapper config file:

    AD http://(**.|)**

    Now we're safe from their prying eyes, until they change their URL pattern...

    Thursday, November 29, 2007

    Black Friday Aftermath

    Is everyone enjoying their Black Friday goodies? I picked up a "Black Saturday" deal on a 20" Vizio LCD TV. The TV is going into the kitchen. We don't actually have a cable jack in there but we do have Slingbox. We're going to replace our kitchen Audrey with a PC. I'm just waiting for the the D201GLY2 to become more widely available. It's a very low power, micro ATX, passively cooled Celeron based CPU/mobo combo. It'll be perfect for this type of application.

    Monday, November 26, 2007

    Acronis True Image $19.99 Shipped Free @ Newegg

    I use the free version of ATI that comes with Maxtor/Seagate drives. It is a lifesaver and comes in especially handy when I'm building/re-building my HA server which seems to be occurring more frequently right now. The free versions have limited functionality (no incremental backups for example), but the full retail version is a deal for $19.99.

    Get it here

    Thursday, November 15, 2007

    Language searching in GMail

    Lately, I've been getting a bunch of Ukranian or Russian spam in my GMail account. Apparently, there is now a method of searching your email based on language. In the search box, just put lang:Russian or to make a filter, put that in the Has the words field

    Sunday, November 11, 2007

    Costco still has TONS of $1.49 ten packs of 13W CF bulbs

    See thread on Cocoontech

    New Toy - GPS Receiver for 700WX

    I picked up an IBlue 737 GPS receiver from buy gps now. The receiver is very compact, about the size of a pager and it is very sensitive - it doesn't need to be left on the dash - it works very well in a cup holder or the door handle. It communicates to the 700WX via bluetooth and we use it with Google Maps Mobile and our unlimited data plan. It doesn't have all the extras of a dedicated GPS (like text-to-speech, etc.) - it just tracks your location. However, any place we can Google, we can get turn by turn directions to it from where we are at the moment. Also, since it's so small, there's no large device to tote around or leave in your car baking in 120 degree temps, hoping nobody steals it.

    Friday, October 19, 2007

    Using VOIP for VR

    We haven't been using microphone VR with HAL - just telephone VR - until now. I loaded up Teamspeak on one of our laptops. Teamspeak is software that gamers use to talk to each other across a network. I installed the Teamspeak server on the HA server and the client on both the laptop and the server. This allows us to talk VOIP style from the laptop to the HA server. I added a USB SoundBlaster to the HA server and set the HA Teamspeak client to output to the SoundBlaster. The lineout from the SoundBlaster got connected to the Mic input of the HA server - that input is used by HAL for its microphone VR. Now, if we talk into the laptop microphone, the audio gets sent across the network to the HA server to HAL's VR engine. This client can be added to all pcs around the house so there's no need for distributed microphones.

    Friday, September 21, 2007

    More AJAX and all that good stuff

    For the past month, I've been working on a UI based on the house floorplan. It's integrating all the stuff I've learned with AJAX, PHP and MySQL to show the state of the house at a glance. I'm using DHTML to create layers of stuff that can be made visible (like lighting control) and then hidden when not needed. That way it's not cluttered all the time. Right now, it reflects the following info: motion in each room and how long it's been since there was motion, temperatures and if they're rising or falling, lighting control and status, which cars are home, if mail was delivered, weather/air quality/uv, audio controls and what's playing in each zone, Google calendar items for today, the lottery ;), surveillance camera popups and the past 6 events recorded, security system status, server cpu & drive temps and a little icon that shows that our craigslist bot found something we're looking for. It's a long list but I still want to add MORE while keeping it nice and neat looking.

    I'd like to post a video of it in operation at some point, but I'm very pleased with it so far. I wouldn't mind doing this kind of coding for a job. I'm getting tired of designing chips. This seems like a lot more fun to me.

    Sunday, August 19, 2007


    After playing around with writing some Google Gadgets, I got to see how easy it is to create pages with AJAX. As a result, I spent the last several weeks adding MySQL to our setup. All status from devices in starCOMUltra are mirrored to a MySQL database. xAP Floorplan scripts have been changed to use MySQL for checking status instead of querying the starCOMUltra COM object directly. It adds an extra layer, but this should make the system more robust as MySQL is more capable to scale as the number of queries grows. It will also allow other apps to keep functioning without erroring out (albeit with stale data) when I take down sCU to do some maintenance.

    One thing that can make the number of queries grow is building web pages with AJAX. I've been re-writing our house floorplan control page to present the state of the house updated every 10-15 seconds. Since it pulls data from MySQL instead of the sCU COM object, it leaves sCU to respond to more immediate needs like turning on lights, etc. Using AJAX, I'm reducing the load on the web server since the page no longer does an HTTP refresh. The screen is updated seamlessly since the page doesn't reload entirely and that improves the user experience. I've also converted our TiVo control pages to AJAX so they no longer have the annoying refresh after clicking a button.

    This required a move of many pages to Apache instead of IIS, so I'm running both servers. IIS serves ASP and Apache serves AJAX with PHP. This works out well because it offloads IIS which isn't as robust a server.

    Overall, this is working out to be a great improvement for our system making it more stable and robust. It's also been a great opportunity to learn about and use AJAX, PHP and MySQL in a real application - much better than learning from canned demos.

    Friday, July 20, 2007

    SlimServer Google Gadget Control Video

    Sorry no audio on the video. The Google Sidebar is on the right side and I show how it can get the status for various zones in the house. Then we switch to the Guest Room zone, which is already playing and shown in the SlimServer screen in the background (to show the communication between the toolbar & SlimServer). The track is skipped using the sidebar and the changes are eventually reflected on the SlimServer screen when the browser refreshes. Then from the SlimServer screen, the track is skipped and the sidebar shows the updated status. Next, we go back to the previous track using the sidebar gadget.

    Then the gadget is popped out from the toolbar and placed on the desktop. The volume is adjusted and reflected when the browser refreshes. Tracks are skipped and more volume adjustments are done before the gadget is popped back into the toolbar.

    You can see the lag between controlling via the toolbar and the browser showing updated status because it has to wait for the refresh interval. There's a lot going on behind the scenes. When a button is pressed on the toolbar, an xPL message is sent out by SlimServer with the new track information. xAP Floorplan generates an XML file from the track information in the xPL message. Then the XML file is read using getxmlhttprequest in the gadget, and the status is updated almost immediately.

    Right now, it just does basic control, volume and power for SlimServer and MediaNet. Below this media panel on the toolbar are various temperatures pulled from StarCOMUltra via COM. The next gadget lower is a simple lighting control and status, also pulled from StarCOMUltra.

    Tuesday, July 17, 2007

    More Google Desktop Work

    I've been adding more automation gadgets to Google Desktop. I've now tied it to starCOMUltra using the COM interface so I can control virtually anything in my system. I'm working on media control and I'll be posting up an updated screen shot soon. It's pretty much like writing ASP pages with a little XML thrown around.

    I also picked up a Philips DVP-5982 1080P DVD player from Costco for $60. It's been sitting around while I play around with Desktop stuff.

    Saturday, July 14, 2007

    Using Google Desktop Sidebar for Automation

    I just wrote a little Google Gadget to create a small control panel on the Google Desktop toolbar. This gadget sends xPL x10.basic messages to control X10 devices. It requires the DLLs for sending xPL commands via ASP - xpl_asp.dll and xqutil.dll - which are bundled in the gadget. Screenshot showing the gadget on the top of the toolbar.

    The .gg file format is just a zipfile. Open it up and copy the 2 DLLs to c:\windows\system32. Register the xPL DLL by opening a command prompt and typing "regsvr32 c:\windows\system32\xpl_asp.dll"

    If you already have Google Desktop installed, double click to install it. To edit the gadget and put in your own devices, follow these directions. It's probably a better idea to make the Gadget load the device list from an xml file instead, but I leave that as an exercise for you :)

    You can use pretty much any ActiveXObject with Google Desktop. I have another example where I instantiated the starCOMUltra COM server.

    Wednesday, July 11, 2007

    New Toy - SimpleTech NAS

    Just received my SimpleTech 500GB NAS. Rather than do a file server and have a PC running all the time, I decided to get one of these. It comes with 2 USB ports so I can add additional storage via external USB drives as I need space. One thing I wanted was the ability to spin down the drive when not in use. I read a couple places that said it does this, I just need to enable it. It's only 100 Mbit but then so's my home network.

    The answering machine continues to perform what HAL is unable to. More shotgun fixes are being offered (try this, try that, try ...), but no diagnosis is being done. In the meantime, I'm testing out Grand Central, which makes HAL voicemail seem almost like my answering machine...

    Tuesday, July 10, 2007

    HAL Pains

    My new server has been up & running for a few weeks now and HAL seemed like it was working fine, until I realized it crashes after someone leaves a message. Every other aspect of it works fine - the VR, telephone VR from local and remote phones, the outgoing message & the recording of the message. At some point, after the caller hangs up, HAL hangs itself resulting in this message:

    "Program Error

    Hal System Serv.exe has generated errors and will be closed by Windows. You will need to restart the program.

    An error log is being created."

    I have been directed to this thread as a means to debug my problem. I've tried de-installing and re-installing the HAL modem as written and I've even gone as far as de-installing, blowing away all data files and re-installing HAL. It still crashes.

    I'm trying to find out what kind of debug options there are in HAL so I can at least narrow down the problem, but I'm not optimistic. Otherwise I wouldn't have been directed to the above thread...

    In any case, the trusty answering machine has been turned on for the first time in over 10 years at least. Before I started putting up with HAL crashes, I was using Fax Talk communicator for PC based voicemail. I never had any problems with it like I do with HAL. Too bad the copy I have is an ancient Win 3.1 app.

    Saturday, July 7, 2007

    Random Stuff

    My pair of Nokia 770s arrived this week and I've been playing with them on & off. They appear to have some issue with one of our wireless routers, a Netgear. This appears to be a common problem. It doesn't seem to want to connect to it at all, it keeps trying to connect to our Linksys eventhough it's far away. A few places I've been visiting for more information:
    Internet Tablet Talk

    The 8M RFID transmitters also arrived and I plugged them in and they worked right away. They're in a much smaller formfactor than the 40M and use only one 3V lithium battery instead of 2. The transmitters in the garaged cars come in strong, but the one in the driveway/street parked car isn't quite working well. I've moved the MSS-100 & RFID receiver closer to the front of the house and it's still a little sketchy. I'm going to have to do a little more tuning. I'd hate to have to put an antenna on the receiver.

    Finally, I've been doing more Python scripting. Wrote a few scripts to do screen scraping of certain websites, like Craigslist. I'd put them up, but I don't want people copying them and hammering those sites. There's no benefit to me then :)

    Monday, July 2, 2007

    HA Server Rebuild...Again

    I had to rebuild my HA server due to a failure in my current server. It took a while to get everything configured, but it's finally up and stable. It's a Core 2 Duo e6420 running on an ECS mobo with 2 GB of ram. I put in an Antec EarthWatts high efficiency power supply. Compared to the Athlon XP 2800+ box, this one runs only about 100 watts (vs 145) and is considerably cooler. The exhaust air is only slightly warm compared to the Athlon's, which was hot.

    I've been having problems with the RFID transmitters, which appear to be failing. However, when I send them back, the seller says they work fine. I've tried putting the receiver on the PC serial port, on an Edgport serial to USB adapter and on a Lantronix MSS-100 serial to ethernet adapter. I tried new batteries, relocating the receiver, etc. This happened 3 times, so I've returned them in exchange for some 8M units. Hopefully those will work better.

    I've since relocated the receiver closer to where the cars are using the MSS-100 so that should compensate for the transmitters being 8M instead of 40M. We'll see when I get them later this week.

    In the meantime, I'm also waiting for a couple Nokia 770 internet tablets that I wooted last week.

    Saturday, May 26, 2007

    Learning Python

    I've been teaching myself Python the last few weeks. It's the scripting language of choice for Google and a lot of their APIs have Python interfaces. My first attempt to play around with it was replacing my Outlook calendar VBScripts with Python scripts that read Google calendar. We're now syncing our Treos to Google Calendar, so we have no need for Outlook's calendar. The Google Calendar API page provides sample code to interface to it and I modified it to fit our needs.

    The next thing I did was to replace my Perl script that renames pictures from our digital cameras with a Python script. It requires Exiftool to read the metadata from the photo file. It renames all the generic IMG_0001.jpg and DSC_0001.jpg file names with names based on the date they were created (061231-001.jpg, 061231-002.jpg, etc.). Script is below:

    # renames original file names from camera files
    # DSC.*.jpg or IMG.*.jpg to a name based on the date, ie 071231-001.jpg

    import os
    import re

    # formats the extension to 3 characters based on the number of pictures taken that date
    # ie 001, 010, 100, etc
    def imageCount(value):
    if value<10:
    return '00'+str(value)
    elif value<100:
    return '0'+str(value)
    return str(value)

    # set work directory
    # list all files
    dirContents = os.listdir('.')
    # set the image file name pattern
    imagePattern = re.compile('^[img|dsc].*.jpg',re.IGNORECASE)

    # create list of images based matching the above pattern
    imageList = [image for image in dirContents if]

    # iterate through the original names to rename the files
    for oldName in imageList:
    # shell call to get exif info creation date of image
    exifOut = os.popen('c:\\bin\\exiftool -CreateDate '+ oldName + ' -d %y%m%d').readlines()

    # above output comes back as list, so iterate through list
    for exif in exifOut:
    # get rid of trailing newline
    exif = exif.replace('\n','')
    # split to get just the creation date
    exifDate = exif.split(' : ',2)

    # now loop through and check to see if we have other images with the
    # filename we want to rename to. assume we won't go over 100
    # pictures from that day
    for i in range(100):
    # create new file name
    newName = exifDate[1] + '-' + imageCount(i+1) + '.jpg'
    # now test if the proposed filename exists since we don't want
    # to rename over an existing file
    fileStat = os.path.exists(newName)
    # if it doesn't exist we can rename
    if fileStat==False:
    print 'renaming ' + oldName + ' to ' + newName
    # rename and break out of loop

    Saturday, May 12, 2007

    google Calendar API

    I'm now using OggSync for Windows Mobile to sync my phone's calendar to my gcal. My next step is to remove my dependence on Outlook for calendaring. I started playing around the with the Google Calendar API using Python. I've been meaning to learn Python so here's a good opportunity. I've since removed a couple scripts from my system for accessing Outlook and replaced them with Python scripts that interact with gcal.

    I had some problems with sCU beta testing and X10 reliability. Turns out the problem was the phone cable used to connect my TC+ to the powerline interface. I replaced it and all's well again.

    Thursday, April 26, 2007

    Make sure those PICs are securely seated!

    The PIC in one of my RFID transmitters was not properly seated and as a result it didn't work. It was just slightly unseated on one side, but after removing and replacing the PIC, everything worked fine again.

    Haven't had much time to post these days. I've been busy finishing up a chip at work and beta testing starCOMUltra...

    Friday, March 30, 2007

    Palm Treo 700WX - A Mixed Bag

    We've had our Treos now for about 5 months. It's been great having them but at the same time, I've had problems with mine. We've been taking full advantage of the unlimited Power Vision internet access provided with our plan. We have a few apps we use all the time on our phones:

    imov Messenger Basic - this is the free version of their jabber chat client. It also has hooks to Yahoo!/AIM/ICQ transports so you can communicate with people on those networks too. I use it with my Google chat account (which is built into Gmail). It seems more reliable with Jabber (which Google chat is based) than with the other transports. Directions to configure it with Google chat.

    Google Maps - it's now available as a CAB file to install directly on your phone! We use this all the time. We can easily look up a store, etc. while we're on the road and call them directly from gmaps!

    Slingplayer Mobile - of course, what good is unlimited internet on your phone if you can't watch TV? We've been trialing the software and will likely cough up the $30 each. It is so convenient to watch TV while you're waiting in line, etc. - especially with two kids around running amuck. We may have to spring for a 2nd Slingbox for the other DirecTiVo so we aren't fighting for the 1 Slingbox.

    Now for the bad things about the phone. The camera SUCKS! There is a problem with Bluetooth and 700WX that causes Bluetooth to stop working. The Treo needs to be reset to restore Bluetooth. It seems there is a fix from MSFT but there is no download available from Palm. Finally, to top it off, there is apparently a problem with the headset jack that dates back to previous Treos (650, 600). It's starting to affect my phone. It's pathetic that Palm has known about this problem for 2 or 3 generations and they still make the same mistakes. Can you say class action lawsuit? People have sued for less (scratches on their iPod for example). I really like the phone, but this may be my last Palm device unless these problems are fixed.

    Sunday, March 25, 2007

    starCOMUltra and Clearing up the RF Airspace

    One of the new features of sCU is the addition of 32 software timers! This makes using the Hawkeye motion sensors with the WGL800 much more reliable. Now, I can start a software timer when a motion sensor is triggered, and rather than relying on receiving the OFF signal from the sensor, my system just waits until the timer has expired. This increases accuracy of turning off lights in rooms with no motion since there's no chance the OFF signal got lost colliding with another sensor's signal (especially since there are over 30 sensors in our system). Furthermore, since I'm not relying on the OFF signal, this allows me to change the timeout period of the sensors to their maximum (or near maximum) values. This reduces the amount of RF traffic since OFF signals won't be coming back every 1, 2, 4 or 8 minutes - especially in areas of high activity where the sensors could be triggering ON and OFF a lot. The end result is less RF traffic and better reliability for the X10 wireless part of our system.

    Setting up software timers is easy in sCU. First, define them:
        ScriptTimers.Item(4).Name = "KitchenMotion";

    Set them upon detection of motion:

    function AUXPorts::AUX1_LineIn(Line) {
    switch(Line) {
    case KitchenMotionOn :
    if (DarkCheck(KitchenDark)!=0 &&
    Devices.X10Devices.Item("SinkLight").State==0) {
    ScriptTimers.Item("KitchenMotion").Time = 90;

    Finally, do something when the timer expires:

    function ScriptTimers::Trigger(Index) {
    switch(Index) {
    case 4: // KitchenMotion
    if (Devices.X10Devices.Item("SinkLight").State==1 &&
    Devices.Flags.Item("DarkOutside").State==1) {

    Saturday, March 24, 2007

    RFID update

    The minor reception problem I was having is gone. I just moved the receiver slightly and all 3 transmitters are coming in perfectly. It's just sitting on my office desk - no need for a fancy antenna. Everything's great except I read that the battery life on these things is about 2-3 months! I'll find out soon enough and maybe I'll have to figure out a new way to power these things...

    Friday, March 23, 2007

    Cleaning out the DirecTiVo

    The chassis fan on one our free DirecTiVos started sputtering before its imminent death. Fortunately, I had a spare fan in my junk box so it should have been a quick 10 minute job to remove the old fan, splice & solder the old fan connector onto the new one & put everything back. It took a little longer though as I had to vacuum out the chassis.

    I never would need a Sharper Image air cleaner as long as I have my DirecTiVos to filter the air! ;)

    Anyway, did I mention they were free? DirecTV gave them to us when I told them we were going to switch to Dish (but we really weren't!) So for the price of a 1 year commitment, they coughed up two of these and some monthly discounts. Calling DirecTV to get discounts has become an annual ritual around this time of year. I just called yesterday since our last 1 year term ended, and they offered to take $10 off/month and to waive the DVR fee of $5.99/month for a year. They also threw in all the movie channels free for 2 months. Not the best deal people have gotten, but not bad for 10 minutes on the phone. Just call DirecTV and ask for retentions and tell them you want to switch to Dish ;)

    Wednesday, March 21, 2007

    RFID tracking going well

    It took about 15 minutes to pop the batteries in the transmitters, throw them in the 3 cars and write up some code in starCOMUltra to do the vehicle tracking. They send out a beacon about every 2.5 seconds which the receiver picks up and sends a 4 character string to a serial port that sCU is watching. This code tracks the arrival of cars:

    function AUXPorts::AUX2_LineIn(Line) {
    var TempLine;
    if (Line.substr(0,4)=="2xyz") {
    if (CarsCheck(Car1)==0) {
    TempLine ="# AUX 2:\tCar 1 Home";
    Speech.speak("R is home");
    } else {

    To track the departure of cars, my sCU script checks every 2 minutes if a car hasn't been heard from in a little while:

    function ScriptTimers::Trigger(Index) {
    var secs;
    Site.LogDevice("# sCU Timer: " + ScriptTimers.Item(Index).Name +
    " ("+ Index + ") expired");

    switch(Index) {
    case 1: // 2 minute
    ScriptTimers.Item("TwoMinuteTimer").Continuous = -1;
    ScriptTimers.Item("TwoMinuteTimer").Time = 120;
    if ((secs-CarsInTime[0])>90 && CarsCheck(Car1)==1) {
    LogDevice("# Cars:\tCar 1 Away");

    I haven't done any fine tuning of the placement of the receiver or of the transmitters in the cars. I have noticed that the car parked outside has occasional dropouts so I'll definitely be looking at re-positioning and possibly adding an antenna to the receiver. Overall, it was a very smooth install and I got right back to sCU beta testing.

    Monday, March 19, 2007

    RFID kit coming

    I ordered an RFID receiver and 3 transmitters from and I think I'll finally get them today. They've been downstairs in the mailroom of the company below us since Thursday morning. For whatever reason, we don't get USPS delivery directly since we occupy the 2nd floor of a building. It has to go through the downstairs company and they have to sort it out for us, but the guy who sorts it has been sick for a week. I guess nobody at my company gets anything important via mail because nobody else complained about not getting mail all week.

    In any case, the transmitters will be put in our cars to replace the DS10A's I've been using for vehicle tracking. This will be much more accurate and a good test run to see if I'll "need" to add more transmitters to the system.

    On a side note, starCOMUltra testing has gone full speed ahead. I've shut off starCOM and switched over completely to Ultra. I've spent the past week converting over piles of scripts and ASP pages to use Ultra and it's been very stable. It's been a good exercise as it's giving me a reason to clean up and streamline a bunch of scripts. I've been making good progress but I think the RFID stuff will sidetrack me this week.

    Sunday, March 11, 2007

    starCOMUltra beta testing

    Just got my hands on the first beta copies of starCOMUltra, the follow on to the HA software I use. This is going to keep me busy for a while, but my testing won't be as hardcore as it was when starCOMPlus was in beta. My HA system is rock solid and I'm doing the beta on my main server, so I can only test it when I want to take the system offline.

    Friday, March 2, 2007

    Google study on hard drive failures

    Some people at Google wrote up a paper on hard drive failures based on data from their server farms. One surprising finding they found was that cooler drives actually fail more often! Download the pdf here.

    Media server shutdown

    With the extra horsepower and memory on the new HA server, I've moved all the media serving back from the Sempron to the HA box.

    In about April of last year, I started putting all the media serving onto the HA server. You can see in the graph of the CPU utilization that over time, the usage increased (ignoring all the glitches in data collection - the long flat spots). That along with xlobby started to bog everything down. Last December, I migrated all the media serving to the Sempron box and you can see the drop in CPU utilization.

    When I cut in this new HA server in early February, the CPU use didn't change much. I've since added back all the media serving and it's been running very well for the last 2-3 weeks. The CPU utilization hasn't changed much since the the HA server has been serving media. Maybe I'll even add back xlobby.

    Sunday, February 11, 2007

    Hot swappable IDE drives

    I have lots of storage needs but I hate having external hard drive cases. So I've taken a couple things to make my own hot swappable IDE solution. I bought a few of these removeable IDE drive trays and installed the tray enclosures in all my desktops. I powered the enclosure like an internal drive, connecting it to a spare power adapter inside the case. IDE drives are not hot swappable in Win2k and later versions, so I used a USB-IDE adapter like this. I routed the other end of the USB cable outside my case and connected it to a USB extension cable so I can easily connect it to the front USB connectors on the desktop PCs. All my spare drives are mounted in the removeable trays, so whenever I need an external drive, I just slide the tray in the rack, connect the usb cable and turn the key on the rack to power up the drive. Then when I want to take the drive out, I just treat it like an external USB drive. I think that's a lot easier than having to find the right power supply for the 5 different external USB cases I probably would have then having to find an open power outlet. I even have a spare enclosure that I can use with my laptop like an external case.

    Tuesday, February 6, 2007

    Daylight Savings Time and servers and ...

    I just ran a program to patch my HA server for the upcoming change in the start and end of DST. Since it still runs Win2k, there's no more support, but there is an application from Microsoft that will let you adjust the start and end of DST. Microsoft's DST info is here. Now, the problem for me is going to be my JDS TimeCommander+, which is EOL'd. I guess I will have to manually update the time or figure a way to script it in starCOM. I had mixed results with setting time via starCOM (trying to sync the clock to account for the TC's drift).

    Monday, February 5, 2007

    HA Server Rebuild

    The main drive in my HA server died, so since I had to re-install the OS, I decided to swap machines as well. The old machine was a Celeron 2.6 gHz and the new one is an Athlon 2800+ XP that I had lying around. I originally chose to build the HA server with the Celeron due to its lower power consumption, but as I added more & more features, it began to bog down. The Athlon provides a little boost in processing power (about 20% or so) but consumes a proportional amount more electricity. I think things are just about all running, but I still have to go through some stupid software activation hoops (HAL).

    Friday, January 19, 2007

    ImageMagick, command line thumbnails and more

    Part of the security camera feature of our system is to take a snapshot of motion in a zone. The snapshot is then shown on our camera control page, showing the last 10 events captured. To ease the loading of these images across the Internet, I needed to automatically generate thumbnails of the pictures. I found an image manipulation package called ImageMagick that has just what I need.

    I call one of their apps, convert, from a perl script (in this case, resizing the image to 25% of its original size):

    convert -sample 25%x25% image_in.jpg image_out.jpg

    Thursday, January 18, 2007

    Checking Gmail with xAP Mail Monitor

    xAP Mail Monitor can't authenticate over SSL, so by itself it can't check Gmail. Like the previous post, Stunnel can fix that. I changed my stunnel.conf file as follows:

    accept =
    connect =

    I had to leave the POP3 port as 110 since you can't specify the port in Mail Monitor. Re-start Stunnel and start Mail Monitor. Add the account by clicking File > Properties and selecting "Mailbox and Logins" under "Mail Monitor Configuration." Add an address, setting email address to, mail server as localhost, login username your_gmail_address and set your Gmail password. That's it.

    This will also work with most other mail apps that need SSL support. Just fill out the POP settings as above.

    Wednesday, January 17, 2007

    Command line emailing via Gmail's POP3 interface

    Gmail has a POP3 interface which lets you use your own email client. This opens up a lot of possibilities. One thing I use a lot is the command line email tool Blat, but it can't deal with Gmail's SSL requirement. That's where Stunnel comes in. It will wrap the TCP connections from Blat inside SSL.

    After installing Stunnel, edit the config file stunnel.conf. I made the following changes:

    ; Use it for client mode
    client = yes

    accept =
    connect =

    Save the changes and start Stunnel. This makes it look like you have an SMTP server running on your local machine at port 465. Next, just point blat to this local smtp server.

    blat -install 1 465 - your_user_name your_password

    That's it. You can now send email from scripts and batch files using Gmail's SMTP server.

    You can also point other mail apps to this port if they don't support SSL for sending mail.

    Wednesday, January 10, 2007

    Slim Devices rocks!

    I found a deal on an original Slim Devices Squeezebox ($10!!!), but it had a broken screen and IR receiver. I contacted Slim Devices' tech support to see if they offered replacements. I had fully expected them to charge for the parts. Instead, they offered the IR daughterboard and screen assembly for free! Since their office is nearby, I was able to drive over during lunch and pick up the parts. I have to say, that is amazing customer support!

    Now, I've got 2 fully functional Squeezebox 1s to go along with 2 of the original SliMP3s.

    Tuesday, January 9, 2007

    Script to create playlists of VOB files

    We have a D-Link DSM-320 media player and we use TVersity as its media server. We use it mainly to watch movies across our network. One thing we can do is watch the original VOB files ripped from a DVD, but the problem is there are multiple VOB files for a movie and after each one ends, the next one has to be manually started. (You can merge to VOBs into one, but the DSM-320 has a 4GB file limit.) One solution is to create a playlist for each movie, containing all movie's VOB files.

    I wrote this Perl script to do just that. (It is similar to the script I wrote to auto-generate music playlists.) It traverses a directory and creates playlists for all subdirectories containing VOB files.

    Just set $path (source) and $dest (playlist directory) in the script and then run it. It assumes the folder containing the VOBs will be named after the movie and it uses that folder name as the playlist name.

    Wednesday, January 3, 2007

    Using RRDtool to graph CPU temps

    I mentioned that I use RRDtool to chart temperatures of my server components. RRDtool works on Windows and Linux.

    I'm using Speedfan to monitor temps, and I wrote a perl script to parse the Speedfan logfile, extract the data I want and run RRDtool to update the database and create these graphs:

    48 hours




    Click here for my sample perl script.