I can achieve logging of onIniti, but no log for onNodeInit. Looking for expert’s assistance in debugging my code, please.
Thanks.
'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’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.
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.