I have come on Slack on no solution, many maybe someone can help me here
I want to use the Driver method ready(), which is executed according to the documentation when onInit() is finished. Unfortunately it does not work as I expect because it is called several times.
Does anyone have a code example for me?
My test example:
module.exports = class Driver extends Homey.Driver {
onInit(options = {}) {
this.debug('onInit()');
}
ready() {
return Promise.resolve('Success')
.then(this.log('Driver ready'));
}
module.exports = class DingzDriver extends Driver {
onInit(options = {}) {
super.onInit(options);
this.http = new Http(this.homey);
}
Log:
[log] 2022-10-27 07:51:40 [DingzApp] dingzX app - v1.1.3 is running...
[log] 2022-10-27 07:51:41 [DingzApp] DingzDriver > Driver ready
[log] 2022-10-27 07:51:41 [DingzApp] DingzDriver > Driver ready
[log] 2022-10-27 07:51:41 [DingzApp] [DEBUG] DingzDriver > onInit()
[log] 2022-10-27 07:51:41 [DingzApp] [DEBUG] ### > HttpAPI API has been inited - undefined
Expected:
[log] 2022-10-27 07:51:40 [DingzApp] dingzX app - v1.1.3 is running...
[log] 2022-10-27 07:51:41 [DingzApp] [DEBUG] DingzDriver > onInit()
[log] 2022-10-27 07:51:41 [DingzApp] [DEBUG] ### > HttpAPI API has been inited - undefined
[log] 2022-10-27 07:51:41 [DingzApp] DingzDriver > Driver ready
BDW: This also applies to the Device#ready() method.
THX Chris