Tuesday, August 01, 2006

X-10 to Z-Wave Bridge

Situation: You want to use an X-10 PalmPad and your existing X-10 interface on your HomeSeer system to control Z-Wave devices. Or, you have both X-10 and Z-Wave devices on the same devicecodes (or on the different housecodes but the same unitcodes), and you want to ensure that if you turn on the X-10 one from a PalmPad, the Z-Wave one comes on as well.

Solution: Create a single event in HomeSeer. The trigger should be X-10 Received. Select the housecode that the X-10 devices are on. For the unitcode, choose Any, and for the command, choose Any. The action is a script command, as follows:

If the devices are on the same housecode:
&hs.ExecX10 hs.StringItem(hs.LastX10,2,";"), hs.StringItem(";on;off;dim",hs.StringItem(hs.LastX10,3,";"),";")

If the devices are on different housecodes:
&hs.ExecX10 "q" & mid(hs.StringItem(hs.LastX10,2,";"),2), hs.StringItem(";on;off;dim",hs.StringItem(hs.LastX10,3,";"),";")

Change the q in the latter to whatever housecode you want to control. For instance, to use a PalmPad set on housecode D to control Z-Wave (or indeed, any) devices on housecode R, make the event trigger be housecode D, and change the "q" to "r".

Limitations: This will work for on and off, but not quite for dim; that requires a tiny bit more smarts, but more than will fit in a one-liner. Maybe someday I'll write an actual script to do that; it would only be a few lines long.

This depends on you receiving X-10 commands into HomeSeer in some way; usually that's a PalmPad, keychain remote, sticky-switch, motion sensor, etc. working through an MR26A, TM751, W800, etc. but it could also be other devices putting X-10 onto the powerline (such as PowerFlashes) and this being picked up by your CM11A, Ocelot, etc. Simply operating the local control on an X-10 device will not generally do this, since most will not transmit when operated locally.

Doing this the other way around (Z-Wave to X-10) would be harder since not all Z-Wave devices will notify HomeSeer when they've been changed, whether locally or remotely, and since the Z-Wave USB interface won't tell HomeSeer when someone has used a remote control to operate a device. That said, it'd be very easy to write a little script that would trigger on status change of devices and echo the command; the echo would simply be delayed until the next polling interval for most Z-Wave devices, since that's the first time HomeSeer would know anything changed.