News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Questions on ZWave source code

Started by kinman, December 21, 2007, 06:18:08 AM

Previous topic - Next topic

kinman

Dear all, I have looked at the ZWave source code (LinuxMCE-1.1-SRC/src/ZWave) and I have some questions:
- Is there any document such as command reference or programming guide for the ZWave computer interface?
- What is the difference between asynchronize and synchronize mode?
- In my understanding, the ZWave computer interface seems to be a passive device, the software send a command to and then wait for response from it. How the software receive PIR events/triggers from the computer interface?

cheers /kin

PeteK

The design for the Z-wave code has an interface that communicates with the DCE router (Zwave.cpp), and inserts Zwave jobs into a queue.  This queue is read by the low-level Z-wave interface PlutoZWSerialApi(.h,.cpp), which handles the low-level communication with the Zwave transciever.

Asynchronous mode creates threads that run this process asynchronously, with the DCE interface adding jobs to the queue and the Z-wave interface removing them as quickly as it can.  The threads are synchronized via mutexs in order to keep things in line.
Synchronous mode has the DCE interface send commands directly to the Z-wave interface.

SerialConnection.* is a layer over the serial communication which takes care about the general protocol specification like communication parameters, the start of every message, the checksum algorithm etc.

The Zwave computer interface is a bi-directional serial device, so when it receives notifications from other devices, it can pass them on to the PC.

ddamron

Is the ZWave driver bidirectional?  I was under the impression it wasn't..

If so, HOW do they set the device state?!?!?!?!? (I can only find events ON/OFF to fire )
:)
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

PeteK

Currently, it only fires PIR sensor commands.  It doesn't feed back light states, though a lot of the polling code is in there.  I'll poke back around in it this weekend and see if there are any more clues in there.

ddamron

Thanks Pete, I started another thread where I found where the state is saved in the database...
but I really don't want to modify the database if I don't have to..
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

kinman

Thank you Pete. It seems the programming document for ZWave interface is only for hardware and software vendors internal use. Otherwise I have to reverse engineering the LinuxMCE-1.1-SRC/src/ZWave.

Can I say that asynchronous mode is multi-thread? synchronous mode is single-thread and the commands/responses are sent/received sequencially?

Can I treat the ZWave computer interface as a Hayes modem? Send "AT" command and wait for "OK". Except that PIR events will be received without sending command.

PeteK

You are exactly correct in that the asynchronous mode is multi-threaded.  The synchronous mode is single-threaded.  As for treating the interface as a modem, I'm not exactly sure what you mean.  When you send an ON/OFF command, it sends that command to the transciever, then waits for a reply or a timeout, and passes that information back.

Unfortunately, Zensys charges a lot for the dev. kit and access to the protocol documentation.  The Pluto guys may have the latest versions, and depending on the licensing, may be able to release them.

kinman

I got it Pete! I find those commercial software for ZWave are lack of flexibility. MrHouse has limited support for ZWave. It seems the ultimate solution is Pluto/LinuxMCE. Instead of looking for document and source code, I better learn how to program on the DCE platform.

PeteK

Sounds good.  Let me know how I can help.  The more automation options the better.  There's been rumor of updated Zwave support in this new release, but I haven't heard anything for sure.  The current Zwave implementation only supports a few, out of production adapters, so there is a strong need to update it to support modern adapters with the current Zwave protocol.

totallymaxed

Quote from: PeteK on December 21, 2007, 07:12:41 PM
Sounds good.  Let me know how I can help.  The more automation options the better.  There's been rumor of updated Zwave support in this new release, but I haven't heard anything for sure.  The current Zwave implementation only supports a few, out of production adapters, so there is a strong need to update it to support modern adapters with the current Zwave protocol.

Hmmm... well I may have been the source for that little rumour. Unfortunately the main Z-wave engineer at Pluto has recently moved on to another company so this has not happened!

Please send me a private message as I might be able to help you on the tech documentation etc etc.

Merry Christmas

Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses [url="http://forum.linuxmce.org/index.php?topic=14026.0"]http://forum.linuxmce.org/index.php?topic=14026.0[/url]

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: [url="http://wp.me/P4KgIc-5P"]http://wp.me/P4KgIc-5P[/url]

Facebook: [url="https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465"]https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465[/url]

[url="http://www.dianemo.co.uk"]http://www.dianemo.co.uk[/url]


totallymaxed

Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses [url="http://forum.linuxmce.org/index.php?topic=14026.0"]http://forum.linuxmce.org/index.php?topic=14026.0[/url]

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: [url="http://wp.me/P4KgIc-5P"]http://wp.me/P4KgIc-5P[/url]

Facebook: [url="https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465"]https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465[/url]

[url="http://www.dianemo.co.uk"]http://www.dianemo.co.uk[/url]

kinman

I find Pete is the new author :D

// Author: PeteK <pete.k@plutohome.com>, (C) 2007

ddamron

Kinman,

I'm integrating the Insteon PLM using GSD/Ruby.. and I'm almost done.
I've learned quite a bit of 'tricks'...
if your serious about zwave integration via gsd, keep in touch with Pete and myself...
I wonder if the pluto team would 'lend' the devkit out...
ahh well, lemme finish the Insteon, then worry about the zwave...

Regards,
Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

kinman

#14
Hi Dan/Pete, I am interesting in ZWave using GSD: LinuxMCE-1.1-SRC/src/Generic_Serial_Device/Embedded Devices/*/Ruby/ do you mean we can just work on *.rb no need *.cpp/*.h? Because I am familiar on Perl and afraid of thousand lines of C codes.

cheers/kin