UserModule Get device metric

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

UserModule Get device metric

Post by Isaksson »

Hello.

When update event listener is created then it is possible to get metric from device.

Code: Select all

this.controller.devices.on(this.config.device, 'change:metrics:level', this.handler);

Code: Select all

this.handler = function(vDev)
Now its easy to get metric from device with

Code: Select all

vDev.get("metrics:level")
But i need to fetch the metric from an device direct from the configuration file.
This is what i have right now that i thought should work.

Code: Select all

controller.devices.get(self.config.device).get("metrics:level");
But that did now work, could someone point me in the right direction.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: UserModule Get device metric

Post by pz1 »

You just can't. I have had a long discussion about in a different thread. No answer about why you can't get there.

It has been implemented in module OpenRemoteHelpers. It is a simple call there.
For example:

Code: Select all

http://raspberry_ip:8083/OpenRemote/metrics/SolQoS_77/QoS
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

Re: UserModule Get device metric

Post by Isaksson »

Thanks for the reply, but i have to say that this is very strange, this is one of the most basic task that you want an module to handle.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: UserModule Get device metric

Post by pz1 »

I could not agree more...
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

Re: UserModule Get device metric

Post by Isaksson »

Maybe PoltoS or someone in the team could dig a little deeper in this?
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

Re: UserModule Get device metric

Post by Isaksson »

Anyone from the development team?
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: UserModule Get device metric

Post by PoltoS »

This works:

http://localhost:8083/JS/Run/this.contr ... rics:level")

So, your example should work in JS too

Just make sure that controller is not oveloaded by any local var. May be write this.controller (if this refers to global context).

Also make sure that self.config.device is correct - may be self is not correctly defined.
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

Re: UserModule Get device metric

Post by Isaksson »

Thanks, i will make some more tests.
What do you say pz1, maybe you also will spend some time on this and maybe we could solve the issue?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: UserModule Get device metric

Post by pz1 »

Isaksson wrote:What do you say pz1, maybe you also will spend some time on this and maybe we could solve the issue?
Would it be an option for you to put your module on Github?
Post Reply