View    Log in    Register

Home Editor's Desk Products Information Center About Us Contact Us

How-To

Updated February 18, 2008 07:00 PST

How-to: Bridge the Gap Between Z-Wave and X10 (Part 3)

By Karl Denninger

In the last part of the series on bridging the gap between X10 and Z-Wave, we explored the possibilities using an Elk M1G. This installment takes a look at another possible approach: HomeDaemon, a Linux-based home automation application that I developed. It is designed to run on FreeBSD Version 6.x and above - although it will also compile and run on most versions of Linux with limited or no effort.

HomeDaemon uses Dan Lancini's "x10d" daemon as its "low level" tool to communicate with the X10 network, and the X10 "CM11" computer interface. This interface speaks to a standard PC RS-232 port.

HomeDaemon's Z-Wave support uses the Leviton RZC0P RS-232 interface, again, requiring a PC serial port. (HomeDaemon also supports the ADICON Leopard and the assorted ADICON hardwired digital and analog interfaces, but I won't be covering those capabilities in this article.)

The first step is to install the "HomeDaemon" package from source, using the README files contained within the package.

HomeDaemon uses a control file called "events.english" to describe both the devices you have in your network and the "event list," or things you wish to have happen based on a user-defined set of conditions. The software keeps the "state" of the devices in the system in a sharable memory segment, allowing all of the various components to interact with one another.

Start with a bare "events.english" file containing four devices:

  • An X10 PIR (a "Hawkeye" sensor) (and its associated RF interface, which is not otherwise used), located in the dining room.
  • An X10 "relay" switch, that controls a fan located in the master bedroom.
  • A Vizia-RF Leviton Z-Wave dimmer, which controls a dining room candelabra.
  • Finally, a CA9000 Intermatic Z-Wave PIR, which is in the master bedroom.

Then set up an event file that will do the following:

  • Turn on the fan in the master bedroom when the Z-Wave Passive Infrared (PIR) sees motion. Shut it off after 20 minutes of no motion being detected.
  • Turn on the candelabra in the dining room when motion is detected there to 70 percent of brightness. Shut it off after one hour of no motion.
  • Turn off both fan and candelabra, if they are on, at 12:00 midnight Monday through Friday.

    #
    # events.english control file - X10 definitions
    #
    A1 T Motion-Dining
    B1 X Master-Fan
    *
    # Empty section - variable declarations
    *
    # Empty section - ADICON input declarations
    *
    # Empty section - ADICON output declarations
    *
    # ZWAVE Device Declarations
    #
    # unit.subunit Description Type
    #
    # Types - 3 = Switch
    # 4 = Dimmer
    # 5 = Controller
    # 6 = PIR (Intermatic CA9000 verified)
    #
    1.0 Master-Controller 5
    2.0 HomeDaemon-Interface 5
    3.0 Dining-Dimmer 4
    4.0 Master-PIR 6
    *
    # Everything below this point are events descriptions; first line is description,
    # then tests, then actions, then separator for the next event.
    #
    Turn Off Everything At Midnight
    T 00:00
    +
    X Master-Fan OFF
    Z Master-Dimmer OFF
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Turn On Dining Room Lights On Motion
    J Motion-Dining ON
    +
    Z Dining-Dimmer 70
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Turn off Dining Room if idle for one hour
    Z Dining-Dimmer ON 01:00
    +
    Z Dining-Dimmer OFF
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Turn on Master Fan if we see motion
    z Master-PIR ON
    +
    X Master-Fan ON
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Turn off fan if idle for 20 minutes
    X Master-Fan ON 00:20
    +
    X Master-Fan OFF
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@

For each of the PIR events, every time motion is seen the event in question is "retriggered" - that is, the time is restarted. We are using the "Z" and "X" commands, which will turn the units back on if they are shut off locally. Events like this can be of arbitrary complexity, and through the use of system variables, can keep state for arbitrary amounts of time or perform simple arithmetic evaluation.

Master Bedroom Event
Here's an example from my own home's system:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Master Timed Off
    Z Master-Cans ON 0:15
    X Indicator-Night OFF
    V Master-Lock-Ind = 0
    V Master-Holdoff = 0
    +
    Z Master-ZFan OFF
    Z Master-Cans OFF
    Z Master-Bed OFF
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

This event looks at a number of variables and conditions, some of which are X10 based, some Z-Wave based, and some of which are stored variables. It first checks to see if the master bedroom cans have been on for 15 minutes (and not retriggered, as would be the case if motion had been seen within that 15 minutes).

It then looks to see if the "Indicator-Night" X10 unit is turned OFF. This is an X10 unit number that is turned "on" when I go to bed (via a bed-mounted wireless controller), and tells the entire house that "everyone is in bed."

Finally, it checks the "Master-Lock-Ind" and "Master-Holdoff" variables, both of which must be zero. These are set to nonzero by other events (if I want to "lock" the master bedroom lights on for some reason) and are controlled by yet another button on that X10 controller on my headboard. Only if all of these conditions are true are the below events - turn off the Master Fan, the Master Cans, and the Master Headboard bed lights - off.

Foyer Event
Here's another example from my home's system:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Foyer Evening
    z Foyer-Motion ON
    V Outdoor-Dark = 1
    X Indicator-Night OFF
    X Indicator-Lock OFF
    +
    X Dining-Cans DIM 30
    X Foyer-Light DIM 30
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

This event looks for a Z-Wave CA9000 PIR called "Foyer-Motion" to turn on. The Variable "Outdoor-Dark" must be "1," which is set elsewhere in the event list if it is dark outside (there is an event which sets this on one hour before sunset and turns it off one hour before sunrise.) Next, we look again at the "Indicator-Night" X10 flag to see if the house is in "day" mode (it must be OFF) and also at the "Indicator-Lock" flag (which is set ON if we want the event processing bypassed - for example, if we have guests and want the lights to remain where we put them)

If (and only if) all of these conditions pass then we turn the Dining Room X10 cans and the Foyer Light on to a DIM level of 30. These are both Leviton "extended DIM" capable X10 scene switches, and thus can be "dimmed" directly (without going through "full brightness").

As you can see, arbitrarily complex and mixed networks are not difficult to support using HomeDaemon. Support for "mixed" networks can also include ADICON hardwired inputs and outputs along with the ADICON Leopard if desired using the same capabilities in the events file.

Please send your comments or questions on this article to the editor: catherine@zwaveworld.com.

 

Search for more information?

Web
www.zwaveworld.com
www.zen-sys.com
www.z-wavealliance.org