# Unable to initialise onNodeInit

**URL:** <https://community.homey.app/t/unable-to-initialise-onnodeinit/115180>\
**Category:** Developers\
**Tags:** zigbee\
**Created:** [August 29, 2024, 1:37pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180 "2024-08-29T13:37:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [August 29, 2024, 1:37pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/1 "2024-08-29T13:37:32Z")

</div>

Hi,

I can achieve logging of onIniti, but no log for onNodeInit. Looking for expert’s assistance in debugging my code, please.

Thanks.

```auto
'use strict';

const { Homey } = require('homey');
const { ZigBeeDevice } = require('homey-zigbeedriver');
const { CLUSTER } = require('zigbee-clusters');

// For debugging only
const { debug } = require('zigbee-clusters');
// Enable debug logging of all relevant Zigbee communication
debug(true);

class MyZigBeeDevice extends ZigBeeDevice {

  /**
   * onInit is called when the device is initialized.
   */
  async onInit() {
    this.log('MyDevice has been initialized');
}

// onNodeInit is called when the device is initialised.
  async onNodeInit({zclNode}) {
    this.log('Zigbee node has been initialised');

      // Check if the ZigBee node is available
    if (this.zclNode) {
      this.log('ZCL Node available:', this.zclNode);
      
      // Log the available endpoints and clusters
      Object.keys(this.zclNode.endpoints).forEach(endpoint => {
        this.log(`Endpoint ${endpoint}:`, this.zclNode.endpoints[endpoint].clusters);
      });

      await this.readOnOffAttribute();
    } else {
      this.error('ZCL Node is not available');
    }
}

```

I’ve tried to re-pair my device. Did not work

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 29, 2024, 2:38pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/2 "2024-08-29T14:38:40Z")

</div>

> [@ninja](#):
>
> I’ve tried to re-pair my device. Did not work

As developer you should know that “did not work” isn’t nearly enough information for others to be able to help you.

---

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [August 29, 2024, 3:10pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/3 "2024-08-29T15:10:36Z")

</div>

Hi,

I’m looking for assistance in my code and as I explained in the first paragraph, the logging under onInit was ok but no logging was seen under onNodeInit.

After searching online before posting, what I realised is onNodeInit did not intialize.

One of the solutions I found online was to repair my ZigBee device, which did not work. It is meant to say I’ve already tried this rectification method.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 29, 2024, 4:41pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/5 "2024-08-29T16:41:06Z")

</div>

You’re still not being very clear. What do you mean by “repair”? Repairing, or completely deleting it and pairing it again?

And what “did not work”? The pairing process? The log in `onNodeInit`?

Since debugging is turned on, what do the debug logs say?

---

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [September 4, 2024, 3:17pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/6 "2024-09-04T15:17:14Z")

</div>

Hi,

I apologise for not being sufficiently clear.  
By re-pair, i meant completing deleting the device then pairing it again.

What did not work was the log did not work for `onNodeInit`. With no log of ‘Zigbee node has been initialised’, I would assume `onNodeInit` did not work as well.

Log:  
MyApp has been initialized.  
MyDriver has been initialized.  
MyDevice has been initialized.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [September 4, 2024, 3:28pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/7 "2024-09-04T15:28:39Z")

</div>

Are you sure that your driver is being used for your device? It sounds like it’s not, which could explain why `onNodeInit` isn’t being called.

---

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [October 14, 2024, 11:37am UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/8 "2024-10-14T11:37:32Z")

</div>

hi, what can i do to be sure that the driver is being used for the device?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 14, 2024, 1:27pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/9 "2024-10-14T13:27:39Z")

</div>

How are you running your app exactly?

---

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [October 14, 2024, 1:41pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/10 "2024-10-14T13:41:23Z")

</div>

command line:  
homey app run -r

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 14, 2024, 1:45pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/11 "2024-10-14T13:45:18Z")

</div>

Hmm okay, that should work.

Do you get _any_ Zigbee debug logging (because you use `debug(true)`) at all? Because you should.

---

<div class="post-metadata">

**Author:** ![ninja](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ninja/32/111829_2.png) [@ninja](https://community.homey.app/u/ninja)\
**Post date:** [October 14, 2024, 2:07pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/12 "2024-10-14T14:07:32Z")

</div>

`─────────────── Logging stdout & stderr ─────────────── 2024-10-14T13:56:11.424Z [log] [MyApp] MyApp has been initialized 2024-10-14T13:56:11.734Z [log] [ManagerDrivers] [Driver:zigbee] MyDriver has been initialized 2024-10-14T13:56:11.781Z [log] [ManagerDrivers] [Driver:zigbee] [Device:96d3ee25-5cad-46b4-8be6-710d0188d73c] MyDevice has been initialized`

this is the log.  
i’m not sure if this is considered the debugging log.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 14, 2024, 2:09pm UTC](https://community.homey.app/t/unable-to-initialise-onnodeinit/115180/13 "2024-10-14T14:09:10Z")

</div>

No, you should see Zigbee-specific logging, as described here: [https://apps.developer.homey.app/wireless/zigbee#debugging](https://apps.developer.homey.app/wireless/zigbee#debugging)
