Why is there no ZWaveAPI description ?

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
danilo
Posts: 11
Joined: 16 Feb 2013 00:33

Why is there no ZWaveAPI description ?

Post by danilo » 24 Mar 2013 01:16

I have been playing around with the RaZberry now for a while considering it for an actual project with the Aeon Labs HEM and the NorthQ Power Meter. But the lack of useful documentation is driving me crazy. There is no description of the ZWaveAPI that is of any use. I am about to give up on the whole project and start to suspect that the whole Z-Wave thing is not all it is cracked up to be.

With much trial and error I finally managed to get the Aeon Labs HEM to cough up its sensor values with commands like:
http://192.168.1.15:8083/ZWaveAPI/Run/d ... valueOf(0)
REMARK: This gets you the wattage on the Aeon Labs HEM Clamp 3.

However, I had to suck it out of my fingers how to do that and read between the lines in several different documents.

Now, I am trying to read the meter value of the NorthQ, but it is impossible as there is no description of the CommandClass[0x32] (Meter) to be found anywhere. If I try with http://192.168.1.15:8083/ZWaveAPI/Data/0 to get the data structure out of the controller, I get the following for the NorthQ CommandClass[0x32]:

"0": {
"name": "0",
"value": null,
"type": "NoneType",
"sensorType": {
"name": "sensorType",
"value": 1,
"type": "int",
"invalidateTime": 1363996799,
"updateTime": 1363996800
},
"sensorTypeString": {
"name": "sensorTypeString",
"value": "Electric ",
"type": "str",
"invalidateTime": 1363996799,
"updateTime": 1363996800
},
"val": {
"name": "val",
"value": 7.25,
"type": "float",
"invalidateTime": 1363996799,
"updateTime": 1364055449

I can access "data" and "name" of CommandClass[0x32] , but how to I get the data holder "val" out of this "0" structure?

Does anybody know how to do this ?

Is there any documentation forthcoming that actually allows for some useful work with the RaZberry?

Some simple but complete examples would be really useful or a simple (but complete) Python script that shows how the read a value from a sensor or a meter would be really heplful.

Of course even better would be an actual complete API description.

danilo

User avatar
PoltoS
Posts: 5081
Joined: 26 Jan 2011 19:36

The Meter Command Class is

Post by PoltoS » 24 Mar 2013 01:16

The Meter Command Class is described in the manual.
to access the data with numeric names you have to use array notation: Meter.data[0].val.value

Just to say, in JavaScript all objects are associative arrays and data.level.value is equivalent to data["level"]["value"]

Thank you for pointing on umbigous description - we will improve this. We will also publish some usefull examples next week.

dholland
Posts: 9
Joined: 24 Mar 2013 18:39

I am struggling with pulling

Post by dholland » 24 Mar 2013 01:16

I am struggling with pulling the delta, previous, rateType, etc from the Meter Command Class also. Examples would be a great help.

User avatar
PoltoS
Posts: 5081
Joined: 26 Jan 2011 19:36

Here is the result for http:/

Post by PoltoS » 24 Mar 2013 01:16

Here is the result for http://localhost:12345/ZWaveAPI/Run/dev ... ter.data[0]. Pretty same you will see if you request /ZWaveAPI/Data/<timestamp>. Use val to get the current meter value.(Note! /ZWaveAPI/Run/devices[10].Meter.data[0]  syntax requires new version of RaZberry Z-Way) {    ...    "sensorTypeString": {        "name": "sensorTypeString",        "type": "str",        "value": "Electric ",        "updateTime": 1364505734,        "invalidateTime": 1364505733    },    "val": {        "name": "val",        "type": "float",        "value": 0,        "updateTime": 1364505735,        "invalidateTime": 1364505733    },    "scaleString": {        "name": "scaleString",        "type": "str",        "value": "kWh",        "updateTime": 1364505734,        "invalidateTime": 1364505733    },    ...    "ratetype": {        "name": "ratetype",        "type": "int",        "value": 1,        "updateTime": 1364505735,        "invalidateTime": 1364505733    },    "delta": {        "name": "delta",        "type": "int",        "value": 0,        "updateTime": 1364505735,        "invalidateTime": 1364505733    },    "previous": {        "name": "previous",        "type": "float",        "value": 0,        "updateTime": 1364505735,        "invalidateTime": 1364505733    }} 

danilo
Posts: 11
Joined: 16 Feb 2013 00:33

Thanks it works - looking forward to Python examples

Post by danilo » 24 Mar 2013 01:16

Thanks Sergei for your explanations. It works now. To read the meter I can now either ask:
IP_RASPBERRY:8083/ZWaveAPI/Run/devices[3].instances[0].commandClasses[0x32].data[0].val.value

or your new abbreviated form:
IP_RASPBERRY:8083/ZWaveAPI/Run/devices[3].Meter.data[0].val.value

and I get the kWh reading of the NorthW Power Meter.

I am looking forward to your publication of more examples. (Especially if you can show how to pack these commands reading a sensor or a meter value into a Python script that runs on the Raspberry).

Regards,

danilo

Post Reply