Author Topic: LinuxMCE's z-wave driver for a stand-alone system  (Read 24230 times)

liri

  • Newbie
  • *
  • Posts: 6
    • View Profile
LinuxMCE's z-wave driver for a stand-alone system
« 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.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #1 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

liri

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #2 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,

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #3 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

liri

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #4 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,

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #5 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

liri

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #6 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,

liri

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #7 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?

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #8 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
rock your home - http://www.agocontrol.com home automation

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #9 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.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #10 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

tmetro

  • Guest
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #11 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

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #12 on: July 11, 2009, 01:40:38 am »
Okay, go for it. :)

-Thom

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #13 on: July 11, 2009, 01:13:19 pm »
you could also expose all DCE devices with xPL/xAP..
rock your home - http://www.agocontrol.com home automation

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: LinuxMCE's z-wave driver for a stand-alone system
« Reply #14 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 site has not been updated since Aug 2008 :-(

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 http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk