ZWave

From LinuxMCE
Revision as of 06:53, 22 January 2008 by PeteK (Talk | contribs) (Updated Implementation Section)

Jump to: navigation, search


Z-Wave™ is a wireless RF-based communications technology designed for residential and light commercial control and status reading applications such as meter reading, lighting and appliance control, HVAC, access control, intruder and fire detection.

Overview

The support from LinuxMCE system is represented by an executable ZWave (it's placed in /usr/pluto/bin) which is the device implementation and a DeviceTemplate (1754) which is used to create LinuxMCE Devices for ZWave.

The source code is available in LinuxMCE's SVN repository at src/ZWave.

Implementation

ZWave implementation is based on a ZWaveJob-s manager (PlutoZWSerialAPI, a singleton class) which supports asynchronous or synchronous tasks management. We are using the asynchronous model right now because we want to send commands to many ZWave dimmable lighting switches at one moment. We are sending the switch On/Off commands as soon as possible then we are waitting for confirmation. This should make the lights switching almost in the same time and the customer gets a nice feedback. In the synchronous mode, ZWave jobs manager can watch only one job at one moment, that means the lights are switched On/Off successively and it can take some time until all the lights are changed.


The Z-Wave implementation uses two main classes to operate.

ZWave.h/.cpp define the ZWave class, which handles interactions with the DCERouter. PlutoZWSerialAPI.h/.cpp define the low-level Z-Wave implementation. This class handles communication with the Z-Wave adapter. The Zwave class receives (for example) light status change commands from the DCERouter and creates he appropriate 'jobs.' To do this, the ZWave class creates an object of type ZwaveJob. Then it inserts the newly-created job class in the PlutoZWSerialAPI class command queue by passing a pointer to the job class to PlutoZWSerialAPI's insertJob() function. The Zwave class then calls PlutoZWSerialAPI's start() function to command the PlutoZWSerialAPI class to begin executing the commands in its command queue.

PlutoZWSerialAPI is threaded to allow it to execute multiple Z-Wave commands in the command queue without having to wait for each command to be acknowledged by the receiving device before continuing. The current implementation is asynchronous. PlutoZWSerialAPI spawns as a thread its DoAsynch() function, which call's PlutoZWSerialAPI's listenAsynchronous() function. This function processes received replies and matches them with executed commands in PlutoZWSerialAPI's command queue.


Interfaces

ACT Homepro ZCS000/010 & ZCU000/010

Status: Supported (see below)

ACT Homepro ZCU101/201

Status: Support is being worked on

http://forum.linuxmce.org/index.php?topic=3665.0

Intermatic HA22 / HA23C

Status: It appears that the current USB controlers made by Intermatic on the market are not supported at this time

http://www.homesettings.com/products-ha23.html

http://forum.linuxmce.org/index.php?topic=2288.0 (this thread claims no current support)

Selxit viaSENS Homecontroller

Status: Support is being worked on Seluxit_viaSENS_Homecontroller

How to install and use ZWave

These instructions are for HomePro ZWave USB interface (ZCU000/ZCU010). The same method might work for other (future?) supported ZWave controllers.

These instructions have been tested working under VMWare 1.0.1-29996 using FC4 (2.6.16.18) as host operating system.


Let's assume that you have LinuxMCE installed with IP: 10.0.2.128 (these instructions are also done by assuming that you have "hybrid" LinuxMCE installation).

Once you have successfully installed the ZWave USB controller and it is seen on LinuxMCE (media:zwave_homepro_interface.png), you can proceed by populating the ZWave network information to LinuxMCE.

  1. Add your ZWave devices to your master ZWave master remote controller (like ZTH200)
    • Once the devices are added to remote and verified they are working (you can control them with your remote controller), you need to copy the ZWave network information to LinuxMCE.
  2. Go to LinuxMCE admin page ("http://10.0.2.128/pluto-admin/"), then choose "Wizard -> Devices -> Interfaces -> [your ZWave controller] -> Advanced".
    1. On the device page select "Send command to device".
    2. Select command "Download Configuration" and choose "Send Message".
      • Leave the data and file fields as blank
  3. Now LinuxMCE is waiting for the ZWave information and you should send a copy of the ZWave network with your master remote controller to LinuxMCE.
    • If you are using HomePro remote controller this is done by selecting: "Setup -> Copy Remote Ctrl. -> Send Information -> Identical Copy". Once you have done that, the remote will show "Sending information..." and after successful sending it will return to clock screen (this shouldn't take more than couple of minutes).
    • You can monitor the process by watching the Zwave log file on LinuxMCE (usually "/var/log/pluto/*ZWave.log"). Unfortunately the admin page doesn't give much information of what is being done and is everything going smoothly. If the process is successfully, you should see the LinuxMCE communicating with the USB controller
    • Make sure the sending remote controller is near enough the USB receiver, otherwise nothing will happen.
  4. Go to device tree (Show devices tree) and you should see (Media:zwave_devices_tree.png) the newly added ZWave modules/devices on the tree under "CORE -> ZWave".

You should do quick reload (Wizard -> Restart -> Quick Reload Router) in order to use the newly added devices with LinuxMCE. Once you have done that you should be able to control (like switching on/off) the devices under the Light (Media:zwave_lights.png).


Troubleshooting

HomePro USB ZWave controller

If the ZWave controller is not seen (or it's not working) by LinuxMCE, check that linux sees the USB device. The HomePro USB receiver uses USB serial device converter (it's not really a "true" USB device).

Once you plug in the device you should see the following kernel messages ("dmesg") when the correct modules are loaded:

usbcore: registered new driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device
ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
usbcore: registered new driver ftdi_sio
drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

Then you should have the following kernel modules loaded:

dcerouter_6722:/var/log/pluto# lsmod
Module                  Size  Used by
ftdi_sio               32584  1
usbserial              32488  3 ftdi_sio

On the admin page (Interfaces -> Advanced) the ZWave interface COM port should point to USB device:

Device data:
COM Port on PC      pci0000:00/0000:00:07.2+1
dcerouter_6722:/var/log/pluto# lspci |grep USB
0000:00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB


ZWave communication

If the controller is seen by LinuxMCE, try sending some commands ("Wizard -> Devices -> Interfaces -> [your ZWave controller] -> Advanced") and watching the log files ("tail -f /var/log/pluto/*ZWave.log") at the same time.

You can try command like "Report Child Devices" which in my case (since I have 5 ZWave appliances supported by LinuxMCE) gives the following results:

36      11/05/06 10:45:51.358           ZWave::ReportChildDevices got:
36      11/05/06 10:45:51.358           
1                       37
4                       37
5                       37
6                       37
7                       37

In order to get these results you should already have downloaded the ZWave network configuration to LinuxMCE from master (remote) controller.


PIR (Binary Sensor) support

PIR (Passive Infra Red) sensor, a type of motion detector which uses invisible infra red light to detect movement in a room. PIR is sending "Sensor Tripped" events, so that you can use it in security scenarious.

All the tests were made using HomePro ZIR000 (RF Transmitter PIR) model.

HowTo install PIR

 1) Open the PIR box so that you have access to Z-Wave button, it is used to remove/add (reset) the PIR from/to Z-Wave network
 2) Use your Z-Wave Master Controller to add PIR
 3) Copy the new Z-Wave network configuration to your Z-Wave USB device (see command "Download Configuration")
 4) Reload Router
 5) You should see the PIR device available as a child device of ZWave (see LinuxMCE admin web pages), but the setup isn't ready yet.
 6) Power off PIR, then power on again (remove a battery for few seconds). Close the PIR box.
 This step is important because PIR is in awake state only for 10 min after it's powered up.
 7) After 2-3 min from step 6, PIR will send the wake up notification and PIR will be able to set its configuration.
 8) You should receive the events from PIR

Notes

 1) PIR needs 2 min of 'silence' to get to Trigger Off
 2) Z-Wave has some new commands to support PIR :
   - Assign Return Route
   - Set Association
   - Set Configuration Parameter
   - Set Wake Up
 The configuration commands are sent automatically by LinuxMCE's ZWave device.
 But if you are using a different PIR device and you need another setup parameters, you can use the new commands.
 3) The PIR wake up notification is important, no commands are sent to PIR if the notification wasn't received.
 We must be sure that PIR is able to communicate with Z-Wave network.