Aeon Labs Z-Stick Series 2

Forum about Domotiga Open Source Home Automation for Linux.

Moderator: RDNZL

Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

I played around with these GE switches that don't support associations tonight.
I pulled down open-zwave just for fun and built and ran the MinOZW example which simply sets up the network and waits.
When I switch my switches locally a bunch of debug output is printed indicating to me that some message is passed back to the controller and is handled by the software.
Here is the message:
2011-01-15 02:51:41:967 Received: 0x01, 0x0f, 0x00, 0x49, 0x84, 0x03, 0x09, 0x04, 0x11, 0x01, 0x26, 0x27, 0x73, 0x70, 0x86, 0x72, 0xd5
2011-01-15 02:51:41:967 UPDATE_STATE_NODE_INFO_RECEIVED from node 3
Upon receiving this message openZwave sends a Basic Report and SwitchMultiLevel Report request and gathers the actual details of the change.

The fact that we aren't getting that message at all in DomotiGa makes me wonder if they are doing something extra when enabling things that notifies the switches that they should be passing this message back to the controller when their status changes.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

Thats good News for you!

After investigating this a bit I think that the current version of DomotiGa doesn't listen to the Zwave bus if it hasn't sent any data previously, I guess that is the problem.
When I was implementing a polltimer just now, I have noticed that there is some unfinished code in the module for implementing polling the bus for data.

I think I have to restructure the code, so it uses a _Read() event instead of writing something and then try to read the responses...

Most of the open-zwave code is taken from the older LinuxMCE code, where I took parts from too.
But they are using threaded event handlers and callbacks.
Regards, Ron.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

Do you know if it is possible to interface gambas with c++? If so I bet the czwave class could be greatly simplified to just make calls into openzwave.

I notice that openzwave already has support for per device polling too.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

You can interface with libraries via the EXTERN function.
See gambasdoc.org but haven't seen support for callback, lets say the open-zwave code has packets received how does domotiga knows about it?
Gambas3 has more support but is not stable yet.
I'm going to revamp my zwave code this afternoon, let see if we can catch those packets :mrgreen:
Regards, Ron.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

I'll explore a little the possibility of creating a C/C++ version of CZWave that could use openzwave.
The callbacks in that class could interface directly with mysql and we may be in good shape.
I can't see anything in CZWave.class callback-like functions that interfaces with any other gambas code other than for debug printing and interfacing with mysql.

No promises, but I'll see what it'd take.

( Sorry for hijacking this thread. Should we move this into another topic? )
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

I have removed the receivefunction call from sendfunction and parse all incoming data from serial port via _read event.
Works a bit but every data received needs to get a ACK back and that takes too long this way resulting in CAN messages from stick.

If status of a device has changed with openzwave how domotiga knows about it without a callback or event?
But its always good to do some coding to see what it brings.. i do that all the time :mrgreen:
Regards, Ron.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

How does domotiga currently get notified of the device status changes?
I assumed that CZWave was just writing the changes to the db and that some system was watching the db for changes.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

I see it now.
Devices.ValueUpdate().
I'll have to think about that.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

Worst case we could set up a poor-man's callback system using xml-rpc or something similar until we get gambas3.
Do you think that'd be too slow and heavy to work for our needs with openzwave?
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

Regarding using EXTERN to access open-zwave library...

One showstopper written by Benoit this afternoon...
Calling C++ functions from Gambas is almost impossible.
Regards, Ron.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

So far I've been able to create a simple c++ library that can Init openzwave and has a notification callback.
I did notice that if I built it as straight up C++ gambas couldn't find the symbols in the library.

By building my library with C bindings like this:
extern "C" {
...
my Code
..
}

I am able to get it to compile and call into the openzwave c++ functions from gambas.

So far this is just a hacky experiment.
Today I'll try hooking it up with XMLRPC unless you can think of a more direct way for me to communicate back with the main program.
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

Great work!
You are a better C/C++ guru then me ;-)
I didn't start to code DomotiGa in Gambas for nothing...

I think xmlrpc is ok for this, if you need more rpc methods let me know.
If this works we can look if there is a better way later.
Regards, Ron.
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

Just a quick update:

Tonight I got openzwave initializing from within DomotiGa.
I can also turn switches on and off using openzwave.

Still a ways to go.
There is one thing I'm noticing though. OpenZWave is taking around 45 seconds to start up and query all the nodes in my network. Is there currently a way to let the user know that a device isn't ready to be controlled yet? Do any other systems have similar startup delays?
Jaren
Starting Member
Starting Member
Posts: 18
Joined: Thu Jan 13, 2011 10:57 am

Re: Aeon Labs Z-Stick Series 2

Post by Jaren »

Another question:

Should I be writing this stuff as a full-on replacement for the existing CZWave.class?
Or should it be a new module so people have the option of using either one?
Or should I add a checkbox in the Zwave interface to choose if you want openzwave or not and then just duplicate all the functionality within CZWave so you can do it either with or without openzwave?

Anyone have a preference?
User avatar
RDNZL
Forum Moderator
Forum Moderator
Posts: 1008
Joined: Sun Sep 24, 2006 1:45 pm
Location: Dordrecht, The Netherlands
Contact:

Re: Aeon Labs Z-Stick Series 2

Post by RDNZL »

45 seconds? How many devices do you have?
There is currently no mechanism to disable controlling for a period of time.
Can't it just read the devices and their types from the controller at startup and do the polling later?

About how to integrate it, if you can offer the same or more functionality as the current code, I think it's best to replace it, but maybe others think different.
I don't know if you can duplicate the functionality of the Z-Wave controller code?

I'm currently trying/examining to code the same type of integration with libxpl, so DomotiGa gets XPL support too.
Some type of interfaces are hard to code right in the single threaded Gambas language.
Regards, Ron.
Post Reply

Return to “DomotiGa Forum”