LinuxMCE Forums

General => Developers => Topic started by: liri on June 09, 2009, 04:51:13 pm

Title: LinuxMCE's z-wave driver for a stand-alone system
Post by: liri on June 09, 2009, 04:51:13 pm
Hey,

I have had exchanged some ideas with Hari on #linuxmce about the Z-Wave driver
though that was long ago and I am returning to this project now, where it is much
more imminent.

I am planing on having a linux box running the z-wave driver to control house accessories
but I won't be putting linuxmce on it as it is supposed to be a dedicated z-wave box.
I'm planing to write a web interface to provide complete management for it.

This isn't going to be a commercial product, it's a personal project and I'm only interested
in the z-wave functionality for my smart home so I am not going to dive into developing my
own z-wave driver by reading the current's driver source code or docs, the only development
which I'll be pursuing is the web development for the GUI (something nice, ajax and stuff :-) ).

I'd like to get a better understanding at where does this stand on having the z-wave driver
running on an environment outside of LinuxMCE.


Thanks.
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on June 09, 2009, 06:47:08 pm
Hari's Z-Wave device is a DCE device, and thus should be used within the construct of DCE.

This means you would need,

* DCE Router
* LibDCE
* PlutoUtils
* SerializeClass
* MySQL for the database
* Lighting Plugin (to provide some abstracted functionality)
* Climate Plugin (same thing)
* Security Plugin (same thing)
* The ZWave device template in the database
* the templates for each child device

You can then build a complete system around this, using LibDCE to send messages to the lighting plugin and to the ZWave device.

You get in return:

* A stable architecture
* an extensible architecture
* interoperability with our stuff

or, you could just reinvent the wheel like any other programmer...but in my view that would be retarded. :)

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: liri on June 09, 2009, 09:14:41 pm

How does the current Z-Wave driver work?
In simple terms it is passed commands to put "jobs" in queue and then there's
another component to poll for these jobs and execute them.

Assuming that is correct, what is used to send the Z-Wave driver the commands?
what kind of interface is it? (is it like heyu? a binary which you call with some arguments)
I'm guessing those "queued jobs" are simply entries in a mysql database table
which the poller side checks and execute.



Regards,
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on June 10, 2009, 12:02:57 am
The Z-Wave driver is a DCE device, it sends and recieves DCE messages, which are generated and recieved by every other part of LinuxMCE.

DCE is defined here:

http://wiki.linuxmce.org/index.php/Developers_Guide

And is implemented by the DCE library, and is utilized by DCERouter and the other DCE devices.

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: liri on June 10, 2009, 08:50:01 am

Alright, that's a good doc, thanks.

I don't have a problem installing all of these components,
I'm just trying to figure out how it all fits together.

To get more practical on this - once all of these components are installed,
telling the DCE system (let's just call it that instead of z-wave driver) to
turn on/off some z-wave lamp device is involved in doing what? sending
a command to the listening port of the DCERouter? inserting a mysql record?

Regards,
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on June 10, 2009, 08:57:28 am
It involves sending a message through the DCERouter to the ZWave device, either by:

(1) connecting to port 3450 and fashioning a raw DCE message
(2) using libDCE and the generated classes from sql2cpp, etc.. to fabricate a message, (look at different DCE devices, there are methods for each and every DCE command, these are generated by DCEGen).
(3) using MessageSend to send the message to the DCERouter.

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: liri on June 10, 2009, 09:01:07 am
Hey Thom,

Thanks for the quick reply once more.
I am not looking to invent the wheel or spend too much time on a "driver"
interface, like I said before, the only development I'm looking at would
be the web interface for myself.

So options 1 and 2 involve either writing my own dce router client pretty much
which is too time consuming and do not serve my goal.

I'm hoping that MessageSend is a binary/shell script tool which provides me
easy interfacing with the DCE router?

Regards,
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: liri on June 10, 2009, 10:03:40 am

Googling a bit I have found the answer to MessageSend, being http://wiki.linuxmce.org/index.php/MessageSend
which is described pretty good. I guess I can count on using that.

This brings me to another layer of this integration... device, category, templates, a bit confusing.
So a z-wave lamp controller for example would need to be known to the dce for that to be able
to control it, meaning it would need to be inserted into the database. Is this a complex
entity building for the z-wave lamp controller or does it conclude with some general record
describing the device?
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on June 10, 2009, 11:35:50 am
the z-wave dce device will create all childs from the node list in the dongle with help of the general info plugin. The childs are "regular" lmce devices, like dimmable lights, switch, generic sensor, ...

best regards,
Hari
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: Marie.O on June 10, 2009, 01:06:09 pm
liri,

if I were in your shoes, I'd get me a MiCasaVerde box (http://www.micasaverde.com). It is exactly what you need.
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on June 10, 2009, 05:06:10 pm
I would use sqlcvs and get a copy of our database to use for the database information.

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tmetro on July 11, 2009, 12:36:51 am
Hari's Z-Wave device is a DCE device, and thus should be used within the construct of DCE.
...or, you could just reinvent the wheel like any other programmer...but in my view that would be retarded. :)

A quick look at the code shows that ZWave.cpp seems to implement the "DCE" interface needed by LinuxMCE, while ZWApi.cpp implements the Z-Wave primitives and actual interface to the USB device (via a serial library).

So it seems quite probable that these two pieces could be split, and thus avoiding reinvention, as well as the need to provide a lot of support infrastructure that may not be needed by simpler projects.

I ran across discussion on the MisterHouse list about how some of the developers aren't happy with the MH driver architecture and they mentioned the idea of using xPL/xAP as the API:

http://www.xplproject.org.uk/
http://www.xapautomation.org/

which appears to be a community developed protocol designed to layer over proprietary automation protocols, such that you might have say a gateway box (or daemon) that talks Z-Wave, and another gateway box that talks INSTEON, with both connected to Ethernet and speaking xPL/xAP to the main controller.

The LinuxMCE driver could then be split into two components: a DCE wrapper around an xPL/xAP client, and a Z-Wave driver that implements the xPL/xAP network interface.

Then HA software in any language can interact with your Z-Wave driver, and you can gain contributors to it from multiple projects. Plus LinuxMCE gains access to other xPL/xAP devices.

 -Tom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on July 11, 2009, 01:40:38 am
Okay, go for it. :)

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on July 11, 2009, 01:13:19 pm
you could also expose all DCE devices with xPL/xAP..
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: totallymaxed on July 12, 2009, 03:19:16 pm
you could also expose all DCE devices with xPL/xAP..

Hmmm...looks/sounds interesting...but the http://forum.linuxmce.org/index.php?topic=7636.msg49121#msg49121 (http://forum.linuxmce.org/index.php?topic=7636.msg49121#msg49121) site has not been updated since Aug 2008 :-(

Andrew
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: valent on June 03, 2010, 12:49:16 am
Has somebody done this? Is it possible to get zwave driver and compile it on my laptop so I get zwave support without need of full LinuxMCE install?
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on June 04, 2010, 12:44:41 pm
Yes, there is a standalone Variant, tested on Fedora and Angstrom (arm/mini2440)

br Hari
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: valent on June 04, 2010, 03:51:39 pm
Hari how can I also test it on Fedora? Any special do any special packages need to be installed? Anything needs to be compiled? Is there a wiki page with instructions?
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: tschak909 on June 04, 2010, 04:09:20 pm
Dude, honestly, if you're asking these questions, you need to re-evaluate whether you'll be able to pull this off.

-Thom
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on June 04, 2010, 10:08:55 pm
no instructions :-)

1) check it out: http://svn.linuxmce.org/trac.cgi/browser/people/hari/mini

2) use the force ^H^H^H Makefile (yes, it has some dependencies; no, they are not listed)

3) use the provided mini install script

some hints:

1) CreateDevice is your friend, be aware, z-wave devices are not created automagically

2) I'd suggest to run the pluto-admin php pages somewhere

3) this has rough edges, don't hurt yourself :-)

br Hari
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: valent on June 05, 2010, 08:59:36 am
Dude, honestly, if you're asking these questions, you need to re-evaluate whether you'll be able to pull this off.

-Thom

I like challenges.
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on July 17, 2010, 08:15:53 pm
A quick look at the code shows that ZWave.cpp seems to implement the "DCE" interface needed by LinuxMCE, while ZWApi.cpp implements the Z-Wave primitives and actual interface to the USB device (via a serial library).

So it seems quite probable that these two pieces could be split, and thus avoiding reinvention, as well as the need to provide a lot of support infrastructure that may not be needed by simpler projects.

done by this guy: http://www.scottwaye.com/zwave.html

br Har
Title: Re: LinuxMCE's z-wave driver for a stand-alone system
Post by: hari on July 17, 2010, 08:18:17 pm
Hari how can I also test it on Fedora? Any special do any special packages need to be installed? Anything needs to be compiled? Is there a wiki page with instructions?

Hi valent,

see this: http://forum.linuxmce.org/index.php?topic=10442.0

don't hesitate to ask if you encounter problems.

br Hari