Saturday, December 30, 2006

Voice controlled music players revisited

Previously, I mentioned using voice recognition to control our mp3 players. I've been slowly adding playlists to the TellMe app and that seems like the way I'm going to go. It's scaling OK so far and I'm limiting options to our most played music anyway. One annoying thing about the app is for some unknown reason, it destroys the config file. It seems to happen if the machine crashes unexpectedly or the app crashes. I've been making backups of the config file so this hasn't been a major problem yet.

Bye bye caller ID

We've decided to get rid of caller ID on our landline. We rarely get calls we want to answer at home anyway. The main reason is the cost of the service is going up from about $6/month to over $8/month! With Comcast going all out with their telephone service in our area, one would expect SBC/AT&T to be more competitive. Not only that, but one would have hoped prices would come down when SBC merged with AT&T (and subsequently BellSouth). Theoretically, there should be some economies of scale that would lead to lower prices. Instead they're raising prices for their services. Looks more like an oligopoly to me - fewer competitors and more pricing power for them. No wonder the landline business is dying.

I've since disabled all the caller ID logic in our HA system and all calls just go to voicemail. If people need to reach us, they can call our cellphones. Besides, our Treo 700WX's have built-in voice command and they announce incoming caller names and numbers using the old Microsoft Mary TTS voice. So, we're not missing our landline caller ID announce much. It may be a matter of time before we shut off the landline completely...

Friday, December 29, 2006

Improvements to HVAC control

Our HVAC system has a couple dumb Aprilaire thermostats, one for the upstairs zone and for downstairs. They have a contact closure input to activate setback mode. The system relies on LM34 sensors in different parts of the house to control when to cycle HVAC. Those setpoints were hardcoded in the TimeCommander+ schedule. I've now made those setpoints variables in the TC+ allowing them to be changed dynamically from an ASP page, script, etc. It makes the system a little bit smarter.

Wednesday, December 27, 2006

New 16 port switch

Yesterday, I ordered a Netgear 16 port 10/100 mpbs ethernet switch from buy.com. After the $20 Google checkout discount & rebate it comes to about $35. This may not seem like it deserves an entry on my blog, but I designed 1 of the chips in one of the earliest 10/100 mbps ethernet switches...the SynOptics 28115. Back then, that 16 port switch was over $1000 per port (vs. $2.19/port for the Netgear)!!! It's amazing how much has changed in the 12 years since that has come out. Later, SynOptics merged with Wellfleet to form Bay Networks in 1994. Then they were swallowed up by Nortel, and out of that mess, Nortel spun out none other than...Netgear.

On a sad note, the Google Checkout discount ended yesterday. :(

Thursday, December 21, 2006

New toy - Slingbox AV

Just got a Slingbox AV yesterday. Added it to the network, connected it to the DirecTiVo, poked holes in the firewall and we're up & running. It works pretty well. Now we can watch our shows when we're at our other place. Too bad we don't have a higher upload speed. It would be nice to have 1mbps up, but according to Slingplayer, it's getting about 350kbps, which is not bad. Not useful for full screen video, but works pretty nicely. I was just watching it at work not long ago ;)

Got it from Buy.com for $108 after Google checkout discount. In fact, we've bought a bunch of stuff off Buy.com with either $20 or $10 off using Google checkout. I think Google should make that a permanent feature! After all, they have such a huge cash pile and have often said they won't necessarily use it in the best interest of shareholders.

Still pondering whether or not to cough up $30 for the Slingplayer mobile for our Treos. Seems steep for the software (about 30% of the cost of the hardware) and we would probably have to buy 2 copies. Now if they offer it on Buy.com with GCO, I may reconsider :)

Tuesday, December 12, 2006

New media server

I have moved media serving off my HA server onto its own machine. So ends my experiment on consolidating all my HA related apps on one machine. The media server is an old Sempron 2800+ with 1 GB RAM, 500 GB of disk, DVD burner and runs XP Pro. It will take over SlimServer, MediaNet, TVersity and the Kenwood media server (for our Kenwood VRSN8100 amp). Maybe I'll even try to get xlobby running on it.

Tuesday, December 5, 2006

New cellphone & IM control

I just got a Treo 700WX w/ an unlimited high-speed data plan (only $30 for voice & data!) so I've been playing around with that for the past week. I've been looking at ways to allow control of the house through the phone. I'm not keen on opening up holes in my firewall to allow direct access to things, so for now, I'm just using my IM interface.

First thing I needed to do was get an IM client on my Treo that can talk to Yahoo messenger. I found imov messenger , a jabber client. The basic version is free and you can find it at the bottom of the imov page. The only thing I needed to do was to create a jabber account for my normal Yahoo account. I talked about linking jabber to Yahoo here. Once that was set, I installed imov on my phone, set up the login and that was it. I'm now able to control my house over IM from anywhere I have service.

Wednesday, November 15, 2006

Stability issues w/ xlobby

I've been busy at work so I haven't had much time to play around. I've been fighting some stability issues and it seems to be related to xlobby and most likely the xAP plugin. One thing I have changed is in starCOM, I'm issuing xPL messages for every X10/AI/DI/timer/flag change. This was mainly to keep Floorplan in sync with sC. Those xPL messages also get converted to xAP by Floorplan and must be killing the xAP plugin for xlobby. It is already known to have memory leak issues and the large increase in xAP traffic must be causing it problems. So for now, xlobby is no longer running on my system. It's been 2 days since I shut it down and things are much more stable.

On a side note, one of the case fans in my HA server seems to have died. I have two fans in the front of the case blowing air over 3 of the 4 HDs in the system, and this morning one of them was squealing like crazy so I had to take it offline. The server is in our office and it turned out to be the warmest room in the house, so I need to make an extra effort to keep things in the server cool.

I monitor the drive temps in the system and graph them over time. The cooler they are the less likely they are to fail. Here's what the graphs look like (I'll talk about how I make them in a later post):








Wednesday, November 8, 2006

Voice controlled music players

Lately I've been contemplating how to voice control our audio players. The VR part will be HAL. The link from HAL will be scripts that issue xPL commands to the Rio Receivers and SliMP3s/Squeezebox. I will write a script to build the voice commands for playlists/artists/etc, but I have two options to use. I can build them into HAL tasks using my scripts, or build the commands into Tell Me, a HALi app. I think it might be easier to build and update the Tell Me database, but I'm not sure how stable the app is.

One of the problems I'm grappling with will be the size of the command database. I won't be voice activating every artist/album/track/playlist/genre, just the ones we use the most. With 7 players, we have 7 zones and I can easily see the number of voice commands exploding ("Play Metallica in the garage", "Play Metallica in the family room", etc). If I have 1000 playlists/albums/artists then there would be 7000 recognition phrases, but this would be the easiest to generate and requires no logic at all. Which would make it perfect to put in Tell Me, but would it bog down with that many commands?

Or, I can create some tasks to set a zone ("Set zone to garage", etc.) and then issue the play command ("Play Angels & Airwaves"). Then, I'd have 7 zone commands and 1000 playlist/album/artist commands. That's a lot less, but I'd need to keep track of the zone for the subsequent play command. That seems like it would be better suited for HAL since Tell Me can't access variables, and the zone would probably be stored in a variable. However, HAL cannot issue shell commands with variables as parameters, so I would need to link to starCOM via HALi and have sC issue the commands to the music players.

Decisions, decisions... I need to spend some time experimenting with Tell Me.

Monday, November 6, 2006

Perl script to autogenerate playlists from mp3s

I wrote this perl script to autogenerate playlist files (.m3u) for each CD we have. Some servers don't play the songs in CD order, but they will with a playlist.

# assumes mp3 directory structure of g:/mp3/artist/album/tracks.mp3
# generates playlist of format: g:/m3u/artist-album.m3u

$mp3dir="g:/mp3";
$m3udir="g:/m3u";

opendir(ARTIST, $mp3dir);
@dir = grep !/^\.\.?$/, readdir ARTIST;
foreach $artist (@dir) {
print "\nartist: $artist\n";
opendir(ALBUM,"g:/mp3/$artist");
@album = grep !/^\.\.?$/, readdir ALBUM;

foreach $album (@album) {
print " album: $album\n";

opendir(TRACK,"g:/mp3/$artist/$album");
@track=grep /\.mp3/,readdir TRACK;
$playlist="";
foreach $track (@track) {
print " track: $track\n";
$playlist.="g:\\mp3\\$artist\\$album\\$track\n";
}
closedir TRACK;

# create playlist
$m3u_name="$m3udir/$artist-$album.m3u";
$m3u_name=~s/\\ /_/g;
print " m3u: $m3u_name\n\n";
PrivoxyWindowOpen(A,">$m3u_name");
print A $playlist;
close(A);
}
closedir ALBUM;
}

Sunday, November 5, 2006

xAPping my xPL stuff

I've been busy the past few days migrating my scripts from xPLHAL to xAP FLoorplan. Almost 3 years ago, I stumbled upon xPL while looking for an alternative server for our Rio Receivers. I've been using xPL heavily ever since with xPLHAL as my scripting engine. Lately, I've been finding lots of useful xAP applications and many of the xPL ones have become unsupported. Plus, lately I've been running into some crash/CPU utilization problems with xPLHAL. I started using Floorplan to do some scripting for xAP stuff and have slowly migrated some of my xPL stuff over. This weekend, I decided to just move it all over. No need to have 2 scripting engines bridging between the 2 protocols. Now it's just Floorplan.

I still use some xPL apps:
  • xPL Phone - There is no xAP equivalent for internal modems. there is only support for serial modems.
  • xPL command line sender - The xAP one seems slow and this one is more intuitive to me. I'll just rely on floorplan to translate to xAP if I need to send xAP.
  • xPL support in SlimServer - This is rock solid and I don't want swap it out yet. Plus, since I contributed some code changes in this to SlimServer, I have a pretty good understanding how it works and can tweak it if I want.
  • xPL ActiveX object - I can instantiate this in starCOM so I don't have to call the command line sender ( xPL = new ActiveXObject("xPL.xPLCtl"); ). There is no xAP equivalent.
  • MediaNet - It has built in xPL support that works great. I'm not giving up MediaNet.
  • xPL TTS - I haven't played around the xAP one but this has been solid so don't need to switch it out.
I just finished the last of the script conversions this morning and turned off xPLHAL.

Friday, November 3, 2006

xAP Ping script

I use xAP Ping to monitor my servers. I also have it monitor my network enabled amp. Since the amp sits in a closed cabinet, it can build up heat while it's running. To help with ventilation, I put a PC case fan into the cabinet and have that turn on when the amp is powered on. This amp doesn't have switched outlets on it, so I can't rely on that to power up the fan.

' pingamp.txt
Sub Main()
ping=xap.getfromraw(rawmessage, "ping.results,ping_amp")
if GetGlobal("PingAmp") <> "Fail" and ping = "Fail" then
' this is my starCOM task to turn on X10 devices
ExecuteX10Appl "AmpFan",0
SetGlobal "PingAmp", ping
elseif GetGlobal("PingAmp") <> "Success" and ping = "Success" then
ExecuteX10Appl "AmpFan",1
SetGlobal "PingAmp", ping
end if
End Sub

Create a Floorplan raw device for Ping:
  • alias = Amp
  • source = mi4.ping.myserver
  • class = ping.status
  • section = ping.results
  • item = ping_amp
  • script to run on update = pingamp


Don't forget to create a device called ping_amp in xAP Ping.

Thursday, November 2, 2006

First attempt at integrating HALi & starCOM

I recently found out that in HAL, I cannot pass variable names as arguments to launching a program. Yet more limitations! To get around this, I'm calling HALi from sC:


// instantiate hali object
var HAL = new ActiveXObject("HALiContol.HAli");
while(HAL.Init()==false) {
Timer.DoSleep(500);
}


Then when I need to launch something, I have HAL execute a VBScript calling sC and setting a flag. Then sC goes in a grabs the info it needs:


function Devices::FlagUpdate(Index) {
with (Devices.Flags) {
case dsOn:
if (Item(Index).Name=="HALFlag") {
HALZone = HAL.Sensors.ItemByName("ZONE").State;
HALPlaylist = HAL.Sensors.ItemByName("PLAYLIST").State;
Devices.Flags.Item("HALFlag").State=0;
ShellCmd.Run("perl medianet.pl " + HALZone + " " + HALPlaylist);
}

...

Tuesday, October 31, 2006

VBScript to export Outlook contacts to import into HAL

This script exports your Outlook contacts into a format usable by the build_addrbook_dbf.pl script from yesterday. useage:

export_contacts_hal.vbs username

You'll need to edit the file to change this line to your Outlook profile user name:
if user="FirstUser" then

It is written to work with multiple user profiles. I have not tried it with only one user profile. Some instructions inside the script.

Monday, October 30, 2006

Perl script to build HAL addrbook.dbf

Building on the previous post, I've modified that script to create the HAL address book database from a text file. This can be used to import data from Outlook or whatever PIM you use. You just need to export your data into a CSV and massage it into the right format. Instructions in the file. Of course, backup your files before you play.

the script

Sunday, October 29, 2006

Perl Script to Build HAL Tasks Database

Here's a script I just finished to build the HAL tasks database. You can now edit your tasks in text and use this script to create the .DBF and .FPT files. No more kludgy HAL point and click editor :) It requires the XBase package from my previous post.

the script

Make sure you backup your HAL data before using this script!!!

Saturday, October 28, 2006

Power Consumption

One of the problems with all of the gadgets running in our house is it uses a lot of electricity to keep everything going. Starting in the summer of 2005, I began to work on reducing our electricity usage. The obvious things were changing out most of our light bulbs for compact fluorescent (and upgrading from standard X10 light switches to Leviton X10 switches for non-incandescent loads). Tons of Hawkeye motion sensors were sprinkled thoughout the house (they talk to the W800 RF receiver which starCOM interfaces to). Lights are turned off in all rooms now based on motion. This has worked well with 2 little kids running around the house leaving things on.

DC power supplies can use anywhere from 3-5 (or more watts) all day long. We probably have 50 or so of these in the house. Most of our chargers are on appliance modules that are on timer so they don't suck power all day. During the night when we all go to sleep, the system turns off the power to some TVs and modulators (which are on appliance modules). It also turns off a lot of those DC power supplies that aren't charging anything. It turns them back on in the morning.

The system knows the state of security system so when we leave the house, it forces all non-essential PCs to hibernate.

DS10 alarm sensors are put on some windows and talk to the W800. This way, the system knows that windows are open and will not turn on the HVAC. LM34 temperature sensors are distributed throughout the house, and the HVAC system is only activated when the coldest/warmest room needs it. Outside temperature sensors tell the system that it's no longer necessary to run HVAC and will remind us to open the windows, etc. In the summer, box fans are put in the windows when it's cool enough to open them. They're on appliance modules and turn off when the room they're in is cool enough.

I've also done a lot of server consolidation, going from 4 full time servers to only 2 right now. There's also been a fair amount of weather proofing done eventhough our house was brand new when we moved in.

Here's a graph of our electricity usage & cost since we moved in. You can click it for a larger view. We've cut it down about 50% from our highest peak usage.



For reference, we have all electric appliances, except a gas range and gas water heater.

Thursday, October 26, 2006

Reading HAL Databases

HAL databases are stored in a Fox Pro format. Why would anyone want to read those databases? Maybe to script the creation of tasks, macros & events? This post will get you halfway there - reading the databases. First off, you'll need Perl. Get ActivePerl if you don't have Perl already. After installing it, open a command prompt and start the package manager by running ppm. At the ppm prompt, type search DBD-XBase, then type install. After it finishes, type exit and now you're ready to write some code.

This is a very simple script that takes 1 argument (the .DBF filename) and dumps out the contents of the file, field by field.

# dumpdb.pl
use XBase;
$\ = "\n";
$, = ' ';
my $table = new XBase $ARGV[0] or die XBase->errstr;
@fields= $table->field_names;
for (0 .. $table->last_record) {
foreach $field (@fields) {
my ($deleted,$val) = $table->get_record($_, $field);
print "$field = $val" unless $deleted;
}
print "";
}
$table->close;

usage: perl dumpdb.pl FILENAME.DBF

Wednesday, October 25, 2006

Keeping xAP Jabber connected

One thing I've noticed is that xAP Jabber seems to get disconnected from the Y! network after not sending a message for a period of time. I fired up the xAP message viewer to see if there were any messages being sent when Jabber disconnected. I found that Jabber would send a User.Status message with the field xstatus set to nothing (as opposed to "Online" or "Logged off").

I wrote a small raw script for xAP Floorplan to send a message whenever it detects that status message:
Sub Main()
status=xap.getfromraw(rawmessage, "User.Status,xstatus")
user=xap.getfromraw(rawmessage, "User.Status,username")
' replace w/ your user name
if user= "yahoo_house_xyz@yahoo.localhost" then
' save status in global in case you want to use it somewhere else
SetGlobal "IMHouse", status
if Len(status) < 2 then
xAPBody="line1=wake myself up ping"
' replace w/ your user name
xAPTarget="mi4.jabber.jabber:yahoo_house_xyz.yahoo.localhost"
' the following 3 lines need to be all 1 line
x=xap.SendxAP("display.text" & chr(10) & "{" & chr(10) &
xAPBody & chr(10) & "priority=1" & chr(10) & "}" &
chr(10),"message.display",xAPTarget)
end if
end if
end sub

I saved it as jabberstatus.txt. The next step was to trigger this every time xstatus changed. Following this Floorplan example, I created a raw device for Jabber in floorplan. I filled in the fields as follows:
  • Alias = jabber status
  • Source = mi4.jabber.jabber
  • Class = Messenger.Event
  • Section = User.Status
  • Item = xstatus
  • Script to run on update = jabberstatus
That's it. Now, whenever Floorplan detects Jabber being disconnected, it sends a message that causes Jabber to reconnect. So far, it seems to work. Jabber has stayed connected overnight for the first time since I installed it. Use the xAP Message Viewer to resend the User.Status messages to test out the script. Make sure you check the Script Debug tab in Floorplan to make sure you didn't make any typos (or copy any of mine!)

Tuesday, October 24, 2006

HAL Deluxe

I was one of the lucky people who got a copy of HAL Deluxe for about $7 back when Lowe's was blowing them out.

While HAL has an exceptional voice recognition system, it has such a kludgy interface. It doesn't support any kind of scripting engine eventhough every major and just about every minor HA package does. It has a tedious point & click interface to add events, and there's no way to easily copy/paste events to make things more efficient. For whatever reason, they don't support MS standard SAPI like just about every other HA package. You have to buy their HAL Voices to get decent speech synthesis. If you have AT&T Natural Voices, you're out of luck. You still have to buy HAL Voices eventhough they are derived from the AT&T voices!! Fortunately, I won a gift certificate from Automated Outlet during a Cocoontech chat, so that lessened the pain of having to buy a copy of something I essentially already had.

Other than that, it does OK for what I use it for. ;) In the time since I bought HAL Deluxe, they've come out with something called HALi, an ActiveX programming interface to HAL. Recently, I finally gave in and upgraded to HAL 3.5 just to get HALi and see if it could be useful for anything. I'm hoping HALi will provide a better way to integrate HAL with starCOM, but 2+ years after its release, there were no samples of HALi using Windows scripting...

Using xAP Jabber with Yahoo! Messenger

xAP Jabber is another app from mi4.biz. It can send/receive instant messages to/from your IM client. Its native protocol is of course Jabber, but there are many Jabber servers that have transports to communicate with other IM platforms, like AIM, Yahoo and MSN. I use Yahoo! Messenger and this is how I set up xAP Jabber to talk to my IM client.

First thing I needed to do was to get a Jabber client so I could create a Jabber ID. I downloaded Exodus. Next, I needed to find a Jabber server with the Y! transport, so I looked over here. After clicking on a server and finding it supported Y!, I fired up Exodus and created a Jabber ID (I'll call it jabber_house_xyz). Now, this Jabber ID needs to have its own Y! ID to communicate with Y! users. So I created a Y! account (yahoo_house_xyz) for the Jabber ID to link to. I had to add it to the contact list of my real Y! ID (I'll call that ID my_real_idxyz) and then add my_real_idxyz to the contact list for yahoo_house_xyz. Next I needed to get the Y! transport up, so I followed this (except selecting Y!). I registered it with my new Y! id (yahoo_house_xyz).

After that, I added my_real_idxyz to the Exodus contact list, selecting Yahoo for contact type and entering the ID. Now, my Jabber account was set up and linked to Y! After exiting Exodus, I started xAP Jabber which brought up the settings file. I entered the login info for my Jabber account then followed the instructions to set up the rest of the app.

One thing I needed to do to get it to work with Y! was to configure xAP Jabber to send messages as chat messages instead of headline messages. (sending #set displaystyle yes) to the xAP client. For some reason, it dislikes headline messages.

Now, xAP Jabber is all set up to forward Message.Display messages to my IM client. It's also possible to issue commands over IM to my house to control things, etc. Each IM sent to xAP Jabber gets sent as a xAP message, which can be acted upon by a scripting engine (like xAP Floorplan). Actions can be performed and replies can be sent based on the commands xAP Jabber received.

Monday, October 23, 2006

xAP Switchboard

This is an app I'm playing with at the moment. You can get it from mi4.biz. Using the Outlook Plugin from mi4.biz, Switchboard imports your contacts from Microsoft Outlook 2003. When it receives caller ID info, it will do a lookup in your Outlook database to identify the caller. It can then send this info to OSD (on screen display) or TTS (text to speech) devices/apps.

I have Outlook 2002, but I just found out that the Switchboard database is MS Access format. So from Outlook, select File > Import and Export > Export a File > Microsoft Access > Contacts. Then select a file name & click Next to create the Access database of the Outlook contacts. Next, run Access, open TelDir.mdb in the Switchboard directory. Then select File > Get External Data > Import and select the file you created from Outlook. You'll get a popup call Import Objects. Select Contacts and click OK. Now in the TelDir: Database window, double click Contacts which opens up your Outlook database. Select the first column, right click and select Insert Column. Adding this blank column helps match the Outlook database with the Switchboard database for an easy copy & paste. Now just highlight all rows with the data you want, right click, select Copy, open the XAP_Contacts database, scroll to the bottom, select the very last row, right click and paste in your contacts. Close the Contacts window. Now you can delete the Contacts database from the TelDir: Database window. Exit and that's it. You should have your Outlook contacts available.

Unfortunately, this doesn't lend itself to updating frequently, but at least it's an easier way to get the info into Switchboard if you don't have a version of Outlook other than 2003.

xAP

One of the many parts of my HA system is xAP. If you don't know what it is, there's a great write up on xAP over on Cocoontech. I've been playing around with numerous xAP applications lately and I'll talk about some of these later.

Two of my favorite xAP sites are:
mi4.biz
www.xapautomation.org

and there's also a xAP group over on yahoo groups.

Links to some random freeware apps I use

sysinternals - a bunch of very useful freeware utilities
truecrypt - set up an encrypted partition on your disk, great for usb keys
mrtg - tool to chart your network traffic/utilization, is someone leeching off your connection?
rrdtool - another excellent graphing app. I use this for charting temps, disk/cpu utilization
xming - lightweight xwindows server for windows
cygwin - linux-like commands/apps for windows
webcam 2000 - camera server. I use this for my security cams
realvnc - control remote computers
blat - command line mail sender, I use this for sending sms or email w/ status updates from the house
ms sapi 5.1 - microsoft speech synthesis engine

Sunday, October 22, 2006

ASP page for TC+ Flags

One of the first things I added to my system with sC was the ability to replicate all the WinEVM MegaController functions in ASP scripts (using the IIS web server in Win2k). This code enumerates all the flags defined in WinEVM, shows their state and allows them to be turned on & off. It can be easily modifed for relays (replacing DeviceCollection = Devices.Flags; with DeviceCollection = Devices.Relays;) or X10 (DeviceCollection = Devices.X10Devices;). You can find my first iteration of ASP pages over on the PTS example page. Grab the ASP MegaController zip file for sample code to control IR, DIs, AIs, Timers and Variables from your browser.


<%@ LANGUAGE=JScript %>
<html>
<head><title>Flags</title></head>
<body bgcolor=#A5DFBA><center><font face=arial>
<%

// flag page
// set/clear flags
// (c) 2002-2006 kJ's Doghouse.com
// http://www.doghouselabs.com

var Devices;
var DeviceCollection;
var EnumDevice;
var EnumItem;

//
Devices = Server.CreateObject("starCOMplus.PTSDevices");

var Name = Request.Form("Name").item;
var Control = Request.Form("Control").item;

// perform the command if we got one
if (Control=="ON") {
Response.Write("<B><center>Issued: " + Name + " ON</center></b>");
Devices.Flags.Item(Name).State = 1;
} else if (Control=="OFF") {
Response.Write("<b><center>Issued: " + Name + " OFF</center></b>");
Devices.Flags.Item(Name).State = 0;
} else {
Response.Write("<B><center> </center></b>");
}


Response.Write("<center><table border=0>");
var odd=1;

// enumerate flag devices
DeviceCollection = Devices.Flags;
EnumDevice = new Enumerator(DeviceCollection);
for (; !EnumDevice.atEnd(); EnumDevice.moveNext()) {
EnumItem=EnumDevice.item();
if (EnumItem.Name.length >1) {
if (odd==1) {
Response.Write("<Tr>");
}
Response.Write("<td>");
Response.write("<b>" + EnumItem.Name + "</b></td>");
Response.Write("<form method=POST action="+Request.ServerVariables("Script_name")+">");
Response.Write("<td width=1> </td>");
if (Name==EnumItem.Name) {
if (Control=="OFF") {
Response.Write("<td width=55>\n");
Response.Write("<center><font color=red><b>");
Response.Write("OFF");
} else if (Control=="ON") {
Response.Write("<td width=55>\n");
Response.Write("<center><font color=green><b>");
Response.Write("ON");
}
} else {
if (Devices.Flags.Item(EnumItem.Name).State==0) {
Response.Write("<td width=55>\n");
Response.Write("<center><font color=red><b>");
Response.Write("OFF");
} else {
Response.Write("<td width=55>\n");
Response.Write("<center><font color=green><b>");
Response.Write("ON");
}
}
Response.Write("</td>\n");


//ON Button
Response.Write("<td>");
Response.Write("<input type=submit value=ON name=Control>");
Response.Write("<input type=hidden name=Name value=" + EnumItem.Name + "></td>");
//OFF button
Response.Write("<td><input type=submit value=OFF name=Control></td>\n");
Response.Write("</form>");

// blank form to keep spacing good
Response.Write(" <form method=POST action="+Request.ServerVariables("Script_name")+">");
Response.Write("<td width=28> </td></form>");

if (odd<2) {
Response.Write("<td width=1> </td>");
odd=odd+1;
} else {
Response.Write("</tr>");
odd=1;
}
}
}
Response.Write("</table>");



// clear stuff out
Devices = null;
DeviceCollection = null;
EnumItem = null;
EnumDevice = null;

%>
</body></html>

starCOM

The original software provided by JDS (WinEVM - docs here) never evolved past a Win 3.0 look and feel. It had absolutely no provisions for any kind of networked interface. Because of these limitations I started using Pine Tree Systems' starCOMPlus (sC). I still use WinEVM, but only for downloading schedule updates into the TC+. Otherwise, sC is connected full-time.

I got involved with sC during its early alpha releases (2001ish I think) and I was heavily involved in hammering on it throughout its beta period. Because of that, sC is the most complete and STABLE interface for the JDS line of controllers. :-D

sC exposes all the devices and events of the TC+ to a COM/ActiveX interface allowing the TC+ to be controlled by other external apps. This allows the TC+ to be networked and greatly improves its usability in a home automation system. sC also provides much more flexible and powerful programming, unlike the rigid, limited "starglish" language in WinEVM. You can create your own WinEVM-like schedule (called a hosted script), that runs inside sC. It doesn't replace the WinEVM schedule, but runs on the HA server in parallel. Programming sC can be done with VBScript, JScript (my preference) or probably even Perlscript (which I've never tried but probably should).

All mission critical apps are in the WinEVM schedule that is downloaded directly into the TC+. I'm not trusting HVAC and irrigation control to a Windows 2000 PC, although my server has been extremely stable considering the amount of stuff running on it & all the tinkering I do on it.

Saturday, October 21, 2006

Hardware pieces

My system is a combination of a hardware controller and software. The hardware controller is a JDS TimeCommander+ (TC+). It's been discontinued by JDS so you won't find much information on it on their site anymore. It features 2-way X10, analog inputs (which I use for temperature sensors), digital inputs (for contact closure detection) and relays (to control the HVAC system).

The TC+ is connected to an InfraRed Xpander which provides 2-way infrared control. However, the IR receiving functionality is not very reliable. I use a different method using Slim Devices SliMP3s (discontinued, noticing a pattern?) as IR receivers.

The TC+ is in the wiring closet connected to a serial port on the home automation server about 12 feet away. The serial connection is over a Cat-5 cable with DB9-RJ45 connectors. The HA server is a 2.6 Ghz Celeron running Win2k Pro and loaded with 1 GB RAM, about 700 GB of disk space, a DVD burner, 2 modems and 2 video input cards. I'll add more details later...

Ok here goes...

This is going to be my attempt to document what I've been doing with my home automation system ( have a look http://www.doghouselabs.com/autohouse). It's been a hobby of mine for about 10 years or so, but I'm continually adding stuff. Hopefully this blog will capture some of what I'm doing now. I plan for it to have a lot of detail and code samples. And when I'm not working on something new, I'll try to talk about what I've already built into the system. So be prepared for flashbacks sprinkled throughout the story line. It works for Lost so maybe it'll work for me ;)