Reading Sensor Value of Aeon Labs HEM - getting NULL

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

Reading Sensor Value of Aeon Labs HEM - getting NULL

Post by danilo »

Hi there,
I am trying to read the sensor values (Watt) of the Aeon Labs HEM.

In the RaZberry UI I can see the wattage per Clamp. (But the Update function more often then not does not update the values).

Then I issue the following JSON calls:
http://IP_RAZBERRY:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[0x31].Get()
followed by:
http://IP_RAZBERRY:8083/ZWaveAPI/Run/devices[2].instances[0].commandClasses[0x31].data.val.value


All I get as an answer is NULL. But that is the way I am supposed to get a Multisensor-Report, isn't it?

How can I get the Wattage per clamp with JSON? (3 clamps).

Somehow it would be useful to see the data model of the connected devices on RaZberry, so that I know which JSON call will get me the meter data. (or any other data I need to read).

Does anybody know how I can get the Wattage values from the Aeon Labs HEM?

Regards,

danilo


EDIT:
After much trial and and error I seem to get the clamp Wattage out with the following commands:
http://IP_RAZBERRY/ZWaveAPI/Run/devices[2].instances[2].commandClasses[0x31].data.val.valueOf(0)

Whereas the number in instances is the clamp number, i.e. instances[2] = clamp 2

However there is still a problem. Get() does not update the data . The value of val only changes after a manual update through the Demo UI.

Any ideas how i can get the data updated before reading it?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Have you tried to do .Get()

Post by PoltoS »

Have you tried to do .Get() on specific instance?

valueOf() is the correct way. Next version will have .value accessor too (for unification)
danilo
Posts: 11
Joined: 16 Feb 2013 00:33

Yes I tried .Get() on specific instance

Post by danilo »

Yes I did for example:
http://IP_OF_RAZBERRY:8083/ZWaveAPI/Run/devices[2].instances[2].commandClasses[0x31].Get()

response was: NULL

Then I did:
http://IP_OF_RAZBERRY:8083/ZWaveAPI/Run/devices[2].instances[2].commandClasses[0x31].data.val.valueOf(0)

response was: 0

The corrcet value should have been: 955 for 955W.

I only get the updated value after I update manually through your UI.

Can you give me a few example lines on how to correctly get the values out of the Aeon Labs HEM with JSON ?

Also if I want to constantly (every 10s) read the Aeon Labs HEM values and store the results in a file on the raspberry memory card, how do I proceed? Write a Python script and run it on the Raspberry?
Can you publish a sample code how to read Sensors on the RaZberry witrh a Python program?

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

Problem solved - Aeon Labs HEM needs USB Power

Post by danilo »

Ok I got the problem solved.
I had to remove the batteries from the Aeon Labs HEM and run it with USB power then it started updating the data when I issued the Get() command.

How can I include the JSON comands into a script so I can log the sensor values every 5 seconds and store them in a file on the raspberry memory Card?

I would like to run that logging program (or script) directly on the raspberry so that I can turn it into a data logger. I will then periodically pick up the logged values remotely.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

You can edit config.xml to

Post by PoltoS »

You can edit config.xml to change original automation/main.js by your file. This file can contains something like this:setInterval(function() {
zway.devices[N].instances[0].commandClasses[0x31].Get();
}, 10000);

zway.devices[N].instances[0].commandClasses[0x31].data.val.bind(function(){
var o = loadObject("meter_data_N");
o[new Date()] = this.value;
saveObject("meter_data_N", o);
});
Post Reply