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.

Tuesday, June 9, 2009

Impressed With Our ISP Speeds

I haven't run a speed test since years ago when we first got Comcast HSI. Back then it must have peaked around 2 Mbps down and maybe 384 Kbps up. I just ran a test and I'm seeing 15 Mbps down and 9 Mbps up! Very nice!



EventGhost xPL Plugin Version 0.2

I made some suggested changes to the plugin to make it play better in EG. Get it here.

Edit: bumped to 0.2.1 download link updated

Monday, June 8, 2009

Deadbolt Monitoring

With a couple little kids going in & out of the house, they often forget to lock the doors when they come back in. So, I've been looking into ways to monitor the status of the deadbolts (and the sliding door lock). I have some limited options as I'm not putting in any new door frames, so the walls won't be open.

I looked at using plunger switches drilled into the door frames that would get pressed when the deadbolt was locked. I didn't really want to drill into the door frame to install it and have to figure out what to do with the wire on the other side of the door frame.

I opted for the typical magnetic reed switch solution. Fortunately, a couple doors had deadbolt holes deep enough to fit mini reed switches without interfering with the deadbolt. I was easily able to glue them into the deadbolt hole and route the wire to the bottom of the door frame and out to where I needed it to go. For the magnet end of things, I got some 10mm x 1mm rare earth magnet discs from eBay. I superglued these to the end of the deadbolt, so that when the deadbolt closed, the magnet would be close enough to cause the reed switch to close.

One deadbolt hole wasn't deep enough and I didn't feel like drilling deeper into the doorframe. Instead, I found some subminiature reed switches at a local electronics surplus store. They're very tiny with a glass casing, so you need to be careful installing them as they're easy to break. I etched out a place in the deadbolt hole so I could glue the reed switch in, making sure it was far enough away to not get crushed when the deadbolt closed.



The sliding door has a different locking mechanism so I had to be a little creative monitoring that. Again, I used a subminiature reed switch and mounted it on the door frame. I used half of a rare earth magnet and glued that to the lock latch. It took a few iterations to get the right position of the reed switch and some careful wire placement to run the wire, but I was able to get it monitored.

I have everything run to the gameport adapters that I used for contact closure monitoring. I'll post some pictures when I get the chance.

Thursday, June 4, 2009

Hibernating Sage Server & Waking Up HD Theaters

I've finally gotten around to optimizing the powered on time of the media server. To get started, I have Sage export its recording schedule to a network drive by setting this option in sage.properties: scheduler_export_file=. I just specify the path to the file I want it to dump to. It creates a tab delimited file containing the recording schedule for the coming week. I parse this file daily at 1AM and keep track of the earliest start time and latest end time for the day.

The server gets shut down sometime after we've gone to bed and after the last recording. It actually gets hibernated remotely from the HA server using psshutdown. I use the command psshutdown -h \\machine-name to initiate hibernate.

The problem with hibernate is that wake on lan will not work to bring the machine up, but it will work when the machine is shut down or in standby. I opted for hibernate since the machine comes up faster than from power off and uses less power than standby. I needed a way to automatically push the power button to turn on the server. I wired this relay to the power button, connected it to a 12v wall wart plugged into a UPB appliance module. Now, my HA server sends a UPB command to turn on the wall wart & then turn it off. This causes the relay to close and activate the power switch before the relay opens again.

Once Sage is awake, I have EventGhost macros that check to see if the server just came on or came out of hibernate. Those macros then kick off a python script that telnets to the HD Theaters and reboots them so they are powered up and waiting on the sage menu.



import telnetlib

tn = telnetlib.Telnet("192.168.1.2")

tn.read_until("login: ")
tn.write("root\n")

tn.write("reboot\n")