Page 1 of 1

UserModule Get config

Posted: 03 Aug 2015 10:03
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

Re: UserModule Get config

Posted: 06 Aug 2015 02:59
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.

Re: UserModule Get config

Posted: 10 Aug 2015 12:55
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.