Newbie questions...

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
Shazard
Posts: 25
Joined: 21 Jun 2014 13:41

Newbie questions...

Post by Shazard »

Hi, I am new to z-wave.me... so probably simple and stupid questions, but need to ask... as documentation is poor on that.

First... what Documentation lacks - some good advice for those who does not use JS and any Browser based UI, but really really pure REST. What I am missing is that "how to get the actual value of the devices in the network without cosntant polling".

Documentation speaks about JS callbacks which can be invoked when something changes in the network (like manual switch state change). 1st how it is realised in reality? But second... this way of operation does not help me, as I want get the actual value without JS running.

I am writing Android app to control my devices, and got one running in 30 mins, but I suppose it is wrong just go and constantly question the state of device...

I I will have >200 devices querying and parsing whole tree is hard... so as far as I undersatand device itself tells the controller that it's state changed, but how do my REST client (which is Android device) can get this without running WebViews...

Second question...

I didn't understand still what is instances for the devices?
Documentation lacks explanation of the actual terms and examples for this.

Coz in my programming career "instance" refers to physical one single object... when I buy some device I expect it to be exactly one device... how it can be in several instances? What is meaning of instance, and why actually you might need instances... can you switch one switch 2 instances one on other off... so what will be state of physical switch?

---

Update:

Here is part of Documentation I am not getting how to map to pure REST

>General note: Z-Way objects and it's decendents are NOT simple JS objects, but native JS
>objects, that does not allow object modication.

How it can help me if I am using REST?

> bind(function (type[, arg]) ..., [arg, [watchChildren=false]]): Bind function to a change of
> data tree element of its descendants

It might work on browser based... but how you realise that on pure REST client?
All what I have is network POST request over HTTP and syncrhonous response. How do I leverage this?
How actually it is realised on the low level? I suppose it is still some kind of polling happening under the hood?
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: Newbie questions...

Post by pofs »

bind() works on server side, not in browser.
If you need only z-wave devices access (not virtual devices in Home Automation, like weather informer), you may poll /ZWaveAPI/Data/<timestamp> and get what has changed since the last time. It doesn't matter how many devices you have, all the changes would be fetched in a single request. It is much more efficient than querying each value for each device.

> I didn't understand still what is instances for the devices?
Instances are basically sub-devices inside a single physical device.
For example, wall plug device might be not only an on/off switch, but also power meter, voltage sensor, etc. Motion sensor might also have temperature and luminescence sensors.
Initially z-wave standard was designed that each sensor will be a separate instance (also called channel).
But currently some devices use another approach: they have several scales for sensors on one instance instead of having multiple instances each with a single scale per instance. Some devices even use both ways at the same time.
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Newbie questions...

Post by Mike Yeager »

Would the ZWaveAPI/Data/<timestamp> method be a better way to check for changes until I get around to learning the Java method? Right now I'm polling the controller for several different devices and I'm running into a few issues. I suppose I could grab this data and parse what I need out of it?
Shazard
Posts: 25
Joined: 21 Jun 2014 13:41

Re: Newbie questions...

Post by Shazard »

Mike Yeager wrote:Would the ZWaveAPI/Data/<timestamp> method be a better way to check for changes until I get around to learning the Java method? Right now I'm polling the controller for several different devices and I'm running into a few issues. I suppose I could grab this data and parse what I need out of it?
Some good stuff can be found in Z-Wave.me provided mini-ui example on their code samples page. I was writing my next question and looked into that code. It has lot of good answers and I am a bit away from my raspberry PI right now, but I am sure that similar approach is realized on the "real" UI so I think for remote client it is the way you do stuff..

You register "poller" for /Data/<timestamp> (sample UI has 0.5 sec intervals) and each such poll updates JS object tree, which has jQuery triggerPath attached to it, and all your UI stuff is bound on this.

Documentation has this, but it lacks this clarity of Data polling and binding to the result.

Make sure you poll data by updateTime, not simple 0 or you will be getting veeeery long response.

And as Doc says, this response is mirror of actual backend data structure, so you kinda "mirror" what server has... which is NOT guaratneed to reflect actual physical state of devices anyway... that is described in Docs too...

I am now wrapping up to start my own Android project to cover all that functionality as I see noone managed to write Android app... :)
Mike Yeager
Posts: 160
Joined: 03 May 2014 07:02

Re: Newbie questions...

Post by Mike Yeager »

What I need to accomplish is detecting the changes in various Z-Wave devices and notifying another program of the changes. Right now I'm simply polling the controller for the changes I need and acting on them. I'm not very familiar with Java and I seem to learn best by playing with running code. Any idea how I would go about getting this code running so I could see it in action? I'm trying to digest the documentation but it's slow going on my end as well...
dylancaponi
Posts: 19
Joined: 25 Jun 2014 12:47

Re: Newbie questions...

Post by dylancaponi »

I would also like more advice about:
"detecting the changes in various Z-Wave devices and notifying another program of the changes."
and:
"getting this code running" (the mini-ui)
if anyone can help.
User avatar
kambis
Posts: 36
Joined: 23 Jun 2014 08:06
Location: Germany
Contact:

Re: Newbie questions...

Post by kambis »

For some of questions above you can find answers by looking here
Post Reply