Update zigbee-shepherd-converters to 1.0.1. #36 #62

This commit is contained in:
Koenkk
2018-06-04 21:36:51 +02:00
parent eae8a80588
commit a976c1db93
3 changed files with 17 additions and 23 deletions
+9 -3
View File
@@ -42,7 +42,7 @@ class Controller {
if (error) {
logger.error('Failed to start');
} else {
// Log zigbee clients on startup.
// Log zigbee clients on startup and configure.
const devices = this.zigbee.getAllClients();
logger.info(`Currently ${devices.length} devices are joined:`);
devices.forEach((device) => {
@@ -145,8 +145,14 @@ class Controller {
if (ieeeAddr && device.modelId && !this.configuredReport.includes(ieeeAddr)) {
const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId);
if (mappedModel && mappedModel.report) {
this.zigbee.configureReport(ieeeAddr, mappedModel.report);
if (mappedModel && mappedModel.configure) {
mappedModel.configure(ieeeAddr, this.zigbee.shepherd, this.zigbee.getCoordinator(), (ok, msg) => {
if (ok) {
logger.info(`Succesfully configured ${ieeeAddr}`);
} else {
logger.error(`Failed to configure ${ieeeAddr}`);
}
});
}
this.configuredReport.push(ieeeAddr);