Skip to content

Commit

Permalink
for lint
Browse files Browse the repository at this point in the history
  • Loading branch information
arteck authored Oct 30, 2023
1 parent f2174c5 commit 1b6be5a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,23 @@ class Developer {
return;
}
const cfg = obj.message.hasOwnProperty('cfg') ? obj.message.cfg : null;

let publishTarget;
try {
const publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
publishTarget = this.zbController.getDevice(devId) ? devId : this.zbController.getGroup(parseInt(devId));
if (!publishTarget) {
this.adapter.sendTo(obj.from, obj.command, {localErr: `Device or group ${devId} not found!`}, obj.callback);
return;
}
} catch (error) {
this.error(`SendToZigbee failed from publishTarget ${devId} (${error})`);
this.error(`SendToZigbee failed from publishTarget ${devId} (${error})`);
}

if (!cid || !cmd) {
this.adapter.sendTo(obj.from, obj.command, {localErr: 'Incomplete data (cid or cmd)'}, obj.callback);
return;
}
this.debug(`Ready to send (ep: ${ep}, cid: ${cid}, cmd ${cmd.name}, zcl: ${JSON.stringify(zclData)})`);

try {
await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {
// map err and msg in one object for sendTo
Expand Down

0 comments on commit 1b6be5a

Please sign in to comment.