Javascript automation module

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
TheJoyOfPainting
Posts: 3
Joined: 04 Oct 2017 10:56

Javascript automation module

Post by TheJoyOfPainting »

Hi guys,

I've been trying to write a javascript automation module that is loaded and initialised when the z-way service starts.
I can see that the module is loaded with a simple console.log inside the index.js but the init method never gets called.

How can I configure the module to be instantiated and initialised when the z-way service starts? Thanks!
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Javascript automation module

Post by PoltoS »

Please register on https://developer.z-wave.me and check for the documentation there. It describes pretty well how to do modules
TheJoyOfPainting
Posts: 3
Joined: 04 Oct 2017 10:56

Re: Javascript automation module

Post by TheJoyOfPainting »

Thank you PoltoS.
I have read the documentation and it does not correspond with the actions in the automation controller logic. The documentation states that if the module.json file has a property ''autoload' then the module will automatically be instantiated on z-way service startup. However, I have read the code in the AutomationController.js and it does not instantiate the module, even with 'autoload' set to true.

It will only instantiate the modules that are listed in a config.json file in the instances array. Even if you add your module to the instances array in the config.json inside the folder defaultConfig, it will not instantiate because it does not use this file! it uses another config.json file which is placed somewhere else on the raspberry pi and will only default if an exception occurs upon startup.........
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Javascript automation module

Post by PoltoS »

Not sure about the autoload property - never seen it. Of course you need to add the module to your config. This should be done in Apps->Local menu. This will add it to config.json (the correct one located in storage folder). Those you mention are for factory default reset.
Post Reply