I'm trying to catch a pair/unpair event in a user module. Since I didn't found a event that is emitted, I bound this to variables to functions that emit custom events:
zway.controller.data.lastIncludedDevice.bind( funtion1);
zway.controller.data.lastExcludedDevice.bind( function2);
this work but now always. Sometimes I get an error "Notification: error (core): Can not instantiate module: PairingMonitor: ReferenceError: zway is not defined"
This only happens sometimes, so I guess, it depends if on the execution of this lines, zway is defined or not. I also tried to do a pause before, but it was still failing sometimes.
How can I wait for zway to be defined? or how can I catch pairing and unpairing events?
Thanks!