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

AJAX, PHP & MySQL

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 xPL.gg 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:
Nokia770.com
Internet Tablet Talk
Maemo.org

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)
else:
return str(value)

#
# set work directory
#
os.chdir('c:\\images')
#
# 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 imagePattern.search(image)]

#
# 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
#
os.rename(oldName,newName)
break

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.