Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
asgothian committed Jan 14, 2025
1 parent 0aa1636 commit 0571f48
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,12 @@ class Zigbee extends utils.Adapter {
}

const epName = stateDesc.epname !== undefined ? stateDesc.epname : (stateDesc.prop || stateDesc.id);

const key = stateDesc.setattr || stateDesc.prop || stateDesc.id;
if (has_elevated_debug)
if (has_elevated_debug) {
const epmsg = (stateDesc.epname !== undefined ? ' Endpoint '+epName : ' unnamed Endpoint');
this.log.warn(`ELEVATED O4: convert ${key}, ${safeJsonStringify(preparedValue)}, ${safeJsonStringify(preparedOptions)} for device ${deviceId} with Endpoint ${epName}`);
}
else
this.log.debug(`convert ${key}, ${safeJsonStringify(preparedValue)}, ${safeJsonStringify(preparedOptions)}`);
let target;
Expand All @@ -797,6 +800,7 @@ class Zigbee extends utils.Adapter {
} else {
target = await this.zbController.resolveEntity(deviceId, epName);
target = target.endpoint;
EPID=target.ID

Check warning on line 803 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'EPID' is not defined
}

if (has_elevated_debug)
Expand Down Expand Up @@ -830,7 +834,17 @@ class Zigbee extends utils.Adapter {
}

try {
if (has_elevated_debug) this.log.warn(`ELEVATED OX: calling convertSet with Parameters ${safeJsonStringify(target)},${safeJsonStringify(key)},${safeJsonStringify(preparedValue)},${safeJsonStringify(meta)}`)
if (has_elevated_debug) {
let metastring = ['{'];

Check warning on line 838 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'metastring' is never reassigned. Use 'const' instead
for (const prop in meta) {
if (prop != 'device')
metastring.push(`${prop}: ${JSON.stringify(meta.prop)}`);
else
metastring.push(`${prop}: "zigbee device"`);

Check failure on line 843 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint

Expected indentation of 32 spaces but found 28
}
metastring.push('}');
this.log.warn(`ELEVATED OX: calling convertSet with Parameters ${safeJsonStringify(target)},${safeJsonStringify(key)},${safeJsonStringify(preparedValue)},${safeJsonStringify(metastring.join(','))}`);
}
const result = await converter.convertSet(target, key, preparedValue, meta);
if (has_elevated_debug)
this.log.warn(`ELEVATED O05: convert result ${safeJsonStringify(result)} sent to device ${deviceId}`);
Expand Down

0 comments on commit 0571f48

Please sign in to comment.