UserModule Get config

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

UserModule Get config

Post by Isaksson »

Hello.

Now I am inside the event handler for a change:metrics:level and i need to to fetch some configuration from the module.json file.

Code: Select all

self.config.serverip
will fetch the object serverip from module.json so no problem with that, but i have some config that is only for this device. How could i fetch that?
The information i need is actual in config.devices.tagname but i need to tell the code what device i am trying to fetch from.

When i create the event listener then i loop the config

Code: Select all

self.config.devices.forEach
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Re: UserModule Get config

Post by PoltoS »

Note that self.config is just a JSON object representing your configuration and structured according to schema described in module.json. So if you want to store in config pairs of (device, some_value) you needs to add in your schema array of objects with .device and .some_value fields and describe their "view"/validator.
Isaksson
Posts: 133
Joined: 10 Apr 2013 09:43

Re: UserModule Get config

Post by Isaksson »

I have everything set in the .json file but the question is how to fetch it from the json file in a event handler.
Post Reply