Page 1 of 1

How to set up scenes

Posted: 17 Apr 2015 18:00
by elvizgz
Hello!

First of all, I would like to know how to set up a scene.

I have a remote control device (Aeon Panic Button) that activates a scene when pressed. In my situation, I need to execute an external script when button is pressed so I did the following in home automation:

* Activate module SwitchControlGenerator which traps events from remotes and create virtual devices for them.
* Create a logical rule using as condition (remote condition) the virtual device generated by
SwitchControlGenerator module. When value is on, it changes value of a binary switch which executes my external script.

My problem is that when I restart my raspberry, the virtual device generated by SwitchControlGenerator is not always present so my button doesn't do what I need. If I enter Home Automation and save again SwitchControlGenerator module, then I see in z-way-server.log that the device is created and then everything works as I expect.

I there any way to ensure that the virtual device is always present in the system? Maybe my approach is wrong and I should do it differently. Perhaps setting up scenes?

Re: How to set up scenes

Posted: 21 Apr 2015 20:15
by elvizgz
I found a way to ensure that the virtual device is always present. SwitchControlGenerator module checks global.ZWave in order to add virtual devices. global.ZWave is instantiated in ZWave binding module. The problem is that on init, the order or loading active modules is not always the same. So if SwitchControlGenerator was loaded before ZWave binding, the virtual device for my remote control wasn't generated. I've duplicated SwitchControlGenerator module as a userModule and added a sleep before checking global.ZWave. With this, I ensuer Z wave binding is executed before SwitchControlGenerator.

I know it's not the most elegant way of doing it but it's a start. Does anyone know if using field dependencies in module.json would ensure dependent module is loaded after the other one?