Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map test #2240

Merged
merged 19 commits into from
Oct 17, 2024
Prev Previous commit
Next Next commit
Update main.js
Additonal logging - toZigbee empty or undefined
  • Loading branch information
asgothian committed Sep 24, 2024
commit 3ac278daceb5f0b296488450d48c799ed7662353
21 changes: 14 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,20 @@ class Zigbee extends utils.Adapter {
}
return;
}
const converter = mappedModel.toZigbee.find(c => c && (c.key.includes(stateDesc.prop) || c.key.includes(stateDesc.setattr) || c.key.includes(stateDesc.id)));
if (!converter) {
this.log.error(`No converter available for '${model}' with key '${stateDesc.id}' `);
this.sendError(`No converter available for '${model}' with key '${stateDesc.id}' `);
return;
}

if (mappedModel.toZigbee) {
const converter = mappedModel.toZigbee.find(c => c && (c.key.includes(stateDesc.prop) || c.key.includes(stateDesc.setattr) || c.key.includes(stateDesc.id)));
if (!converter) {
this.log.error(`No converter available for '${model}' with key '${stateDesc.id}' `);
this.sendError(`No converter available for '${model}' with key '${stateDesc.id}' `);
return;
}
}
else {
this.log.error(`toZigbee is not defined for '${model}' ('${JSON.stringify(mappedModel.toZigbee)}') `);
this.sendError(`toZigbee is not defined for '${model}' ('${JSON.stringify(mappedModel.toZigbee)}') `);

}

const preparedValue = (stateDesc.setter) ? stateDesc.setter(value, options) : value;
const preparedOptions = (stateDesc.setterOpt) ? stateDesc.setterOpt(value, options) : {};

Expand Down