Monday, July 27, 2009

Remote Home Automation

Now that I've linked our two homes across the Internet, I can work on doing some serious automation - with the spare parts in my wiring closet :) Except for one thing - I have to get a 2nd W800. I plan on sprinkling around a few motion sensors and a couple DS10As connected to leaf wetness sensors - to be used as leak detectors. So the W800 is a must have.

I already have an old CM11A connected to the thin client & it interfaces to xPLCM11 for basic lighting control. I will be moving a spare USB rocket launcher over there and strapping a netcam on it for use with xPL Rocket.

Saturday, July 25, 2009

Linking xPL Between Two Homes Over The Internet

As I wrote before, I would like to link xPL messages from our 2nd home. I needed to figure out a way to wrap the UDP xPL messages in TCP and tunnel them through some kind of connection. I decide to use EventGhost's Network Event Sender/Receiver plugins so I wouldn't have to write a separate app.

The first step is to establish a secure connection between the two networks. I chose SSH as I already have a device capable of being an SSH server at our 2nd/remote home. I will establish the SSH connection using Putty from our 1st home.



I'm creating a tunnel that will map port 8888 on the remote SSH server to port 8888 on my local machine. I'll need to click the Add button to enable it. I also checked Remote ports do the same, which will allow devices on the remote network to connect to the remote SSH server's port 8888. To enable this remote forwarding, you may have to configure your SSH server. For example, with OpenSSH, you need to add GatewayPorts yes to the sshd_config file.

Once that's set up, I can establish the SSH connection. On the local machine, I will add the Network Event Receiver plugin, point it to port 8888, set a password and an event prefix. On the remote machine, I will add the Network Event Sender plugin and point it the remote SSH server's port 888 and set a password to match the receiver.


Local EventGhost


Remote EventGhost


Now, in the remote EventGhost, I create a macro that captures all xPL messages and sends them the Network Event Sender.



Finally, on the local EventGhost, I create a Network Event Receiver macro that parses the data received and issues an xPL message with the original contents, but with the local EG as the sender instead of the original sender.




That's all there is to it. Now, I've got remote xPL messages coming across to my home network. You can easily add a remote EG receiver and local EG sender to allow xPL messages to flow in the opposite direction.

Friday, July 24, 2009

xPL Rocket Launched

I've released my xPL hack to the SharpLauncher software. Now, you can have remote, network control over your arsenal of USB rocket launchers. You can get it here. Strap a webcam on top of your rocket launcher and you have a super cheap pan & tilt camera.

Thursday, July 23, 2009

Remote Thin Client

I have been working on thin client #2 which will be deployed at our other home. One thing I wanted to get running on it was bluetooth so it can track our presence with BlueTracker. It was quite a pain to figure out since XP Embedded doesn't really support bluetooth so I had to copy drivers, DLL's, etc over from an XP system. In addition to the BT radio drivers, it also needed drivers for the BT enumerator, BT PAN and BT RFCOMM protocol. Finally, I also needed to copy over the file irprops.cpl, which the 32feet.NET BT library needs. Figuring that out wasn't easy as BlueTracker would fatal with this error:

EventType : clr20r3 P1 : BlueTracker.exe P2 : 1.0.0.0 P3 : 4994a8a1
P4 : inthehand.net.personal P5 : 2.3.0.0 P6 : 483fc5c5 P7 : 15d
P8 : 8 P9 : system.dllnotfoundexception

After some Googling, I found this reference that points to an attribute called DllImportAttribute. I opened up InTheHand.Net.Personal.dll in my trusty Emacs editor, searched for that string and found irprops.cpl. Once that was copied over, BlueTracker worked.

Now, I need to come up with a mechanism for getting BlueTracker status across the Internet to our home. Since xPL is UDP, I can't just tunnel it through an SSH connection.


Friday, July 17, 2009

xPL Plugin for SageTV released

I have released my first rev of the xPL plugin for SageTV. You can read more & download it here.

Wednesday, July 15, 2009

xPL SageTV Plugin Update

I've overcame my laziness, well most of it, and implemented a majority of the xPL media schema. I am still leaving in the capability to send the actual SageTV commands for specific control. I have also added the ability for the plugin to respond to some queries, specifically what's currently playing and querying playlist items. Finally, I've peeled it out of InfoPop into its own JAR.



Monday, July 13, 2009

Touchscreen Thoughts & More SageTV-xPL

Touchscreens are a very popular add-on to home automation systems. A lot of people have been tying ELO touchscreens to HP thin clients or other low powered Windows boxes. We haven't deployed any touchscreens other than the few ancient 3Com Audreys we have sprinkled around the house. Personally, I'm holding out for some low priced tablets, and luckily, I'm OS agnostic. I built our automation GUIs using AJAX, so any modern browser can use them. Our screens may not be as fancy as some of the flash or application based screens (although with some graphics help, they could be), but they run great on our Windows machines, Nokia tablets and Linux netbook. I have been eyeing the progress of the Crunchpad, and I'm hoping they can hit their price targets. If they do, I'll be shifting my efforts to building screens.

In the meantime, I continue to plug away on xPL-SageTV integration. I've got one way control going now, sending xPL messages to my plugin. I added a property in sage.properties that maps the SageTV client names (MAC address and SAGETV_PROCESS_LOCAL_UI) to a more friendly name for the xPL messages (FR, LR, MasterBedroom, etc.) For the xPL control, I contemplated using the media.basic schema, but there's some overlapping stuff that I'm too lazy to implement. Also, I can't implement all the SageTV specific functions in the media.basic schema, so I'm opting to use control.basic to control the plugin. I'm using the 'device' and 'current' fields from control.basic, where device will be the friendly SageTV client name and current will be any SageTV command (Home, Play, etc.).

So far, I haven't separated it from the Infopop code as it shares so much overlap setting up the xPL side. Plus, I'm not sure how to build my own independent plugin. I'll figure it out at some point.

Saturday, July 11, 2009

New Project: SageTV & xPL

I finally got around to trying to customize SageTV. I've never written any Java before so it's been slow going. I don't have any Java books, but I always "learn" by doing - I figure out enough stuff to make things work.

I started off with the xPL4Java SDK and looked at the example code. I played around with the NetBeans development environment, but I didn't really like it. After getting the samples running, I took a look at the source for the SageInfoPop SageTV Import. It was built using Eclipse IDE, so that seemed like a natural one to use since this is the first thing I wanted to modify.

After about 2 days, I've managed to get xPL running with SageInfoPop. It takes in xPL osd.basic messages, extracts the message, initiates a connection to the SageInfoPop YAC port and sends it the data to display. I really wanted to send it directly to Sage, like SageInfoPop does, but couldn't get my mind around the OOPness to make it happen.

At some point, I should sit down with a good book on OOP and really understand it all. In any case, now I can program Java in addition to VB.net, C#.net, JavaScript, PHP, Python & Perl. Anybody want to offer me a job? ;)

Anyway, I'd like to continue to integrate SageTV & xPL so that I can have full 2 way control of SageTV over xPL. This was a good start.

Thursday, July 9, 2009

Upgraded & Configured Thin Clients

I finally got my 512MB flash disks from Transcend and upgraded all 3 T5700s and bumped their RAM to 512MB as well. This gives me enough resources to install .NET 2.0 so I can run some of my xPL apps on it. The xFx xAP hub fatals so I have to run a different hub to run xAP apps. So far, I've loaded one up with xEKG, an alternate version of my xPL Gameport app and EventGhost.

Sunday, July 5, 2009

xPL Driver for j9 Automation Engine

I just churned out an xPL driver for the j9 Automation Engine. I don't use the application, but it seems like a great automation package and it's feature set is rapidly growing. Here it is.

Below is a sample script in the AE rule engine. It's triggered whenever an xPL message is received by the driver. Depending on the fields in the message, it will parse the message body and issue an xPL command in response.



Wednesday, July 1, 2009

Vendors - Good and Not So Good

I got 3 sticks of 512MB SODIMMs for the 3 HP T5700s we have now. I got them from eBay vendor memoryx for only $17 apiece using eBay's Make Offer feature. Since they're local to me, I was able to pickup instead of paying another $8 for shipping. The memory works great.

I ordered 3 512MB SSDs from Transcend. A day later, they called me to verify my shipping address since I was shipping it to my work, not my billing address. Another day later, I get a backorder notice. I don't understand why they don't write it's backordered on the website so I can take that into account on when I order it. Apparently, they're always backordered as others in this thread have run into the same problem. It's annoying. I would have ordered these a couple weeks ago to line up with the arrival of my last 2 T5700s, now I have to wait.

Finally, I ordered a cheap webcam for PTZ project. I had the misfortune of ordering from Focal Price. Fifteen days after I received the shipped notice, I had not received the camera. I contacted them and was told to wait 15 business days, not 15 days. I waited 15 business days and nothing. I was told to wait 5 more business days. Twenty business days later I was told to wait 25 business days. I asked for a refund. They said wait 5 more business days after which I asked for a refund again. They refused to refund my money, instead I was asked to split the costs and get back half of what I was paid! Or I could pay $1.70 for registered post and they would send another camera. So I could pay $1.70 more for my $6 webcam or get a $3 refund and have gotten nothing. What a joke, so I paid the $1.70 and got my camera in 5 days from when they shipped it. Of course, I couldn't take advantage of their supposed "30 day guarantee" because they kept telling me to wait 5 more days until their guarantee ran out. I'm not buying cheap PC crap from them ever again. DealExtreme has always been my source of cheap PC gear, but I thought I'd try a new vendor. Bad choice.

Tuesday, June 30, 2009

Somewhat Quiet Last Few Months

I've been a little preoccupied with other things, but I have been working on some small projects here & there. I just haven't felt like writing about them. I'll try to summarize what I've been doing for the past several weeks/months.

Last night, I hardwired the sensor that detects when our alarm is armed. Originally, it was a CDS cell covering the armed LED on one of the alarm keypads. The sensor was then connected to the CDS input of an X10 Hawkeye. It worked well 99% of the time, but once in a while, it would a miss detecting a change due to some RF collision. Not a major problem as the alarm is completely separate from the HA system, but annoying for automating events. So, I ran a pair of wires from the CDS cell at the keypad to the wiring closet. I terminated it on the X-Axis of the third gameport controller I've deployed. It works perfectly now.

I've gotten fairly adept at fishing wire with no special tools. For the CDS wire, I routed it from eyelevel where the keypad is to just above the baseboard. I used a string with bolts tied on and dropped it into the wall from an eyelevel hole. I drilled a small hole above the baseboard and used a vacuum to suck the string out. I then fished the wire through by taping the string to it.

I also added a 2nd HDHomerun (which also involved fishing wires - some Cat-5E and RG6.) I have it currently connected to an HD antenna in the attic.

I've been slowly deploying more of the UPB modules I got on clearance from Fry's. As my UPB network got bigger, I started to notice some limitations in my handling of it. I wrote my own code to handle UPB since my old TimeCommander+ does not have the capability. It resides in my xPL starCOMUltra bridge as described here. It's actually just a generic serial interface in the bridge. All of the actual code handling UPB is in the hosted JScript.

To make a long story short, I was having problems with retries and sending commands to the UPB PIM too fast. I solved this by adding JScript code to build a command queue and beef up the retry/busy/NAK logic. It uses the built in Queue structure, similar to JavaScript and described here.

I also bought a couple more HP thin clients off of eBay. I am now planning on installing .NET on them, so I've also purchased these 512MB flash disks so I have enough room for it (.NET needs about 150MB free on the C: drive). I also found some cheap 512MB RAM upgrades as well. One will be deployed at our other house for more minor automation projects and the second one will replace the current T5700, which functions as a networked contact closure device. I want to test out & phase in the new one before taking the existing one offline to upgrade and move elsewhere in the house.