fixed commission device

This commit is contained in:
hannathkadher
2025-04-27 22:42:03 +04:00
parent ff731ceea0
commit 6b8aa6836d
2 changed files with 9 additions and 1 deletions

View File

@ -83,6 +83,7 @@ export class DeviceCommissionService {
const tagName = row['Tag']?.trim();
const productName = row['Product Name']?.trim();
const projectId = param.projectUuid;
let deviceName: string;
if (!rawDeviceId) {
console.error('Missing Device ID in row:', row);
@ -97,6 +98,10 @@ export class DeviceCommissionService {
return;
}
if (device && typeof device === 'object' && 'name' in device) {
deviceName = (device as any).name || '';
}
const community = await this.communityRepository.findOne({
where: { uuid: communityId, project: { uuid: projectId } },
});
@ -189,6 +194,7 @@ export class DeviceCommissionService {
subspace: subspace || null,
productDevice: match.product,
tag: match.tag,
name: deviceName ?? '',
});
await this.deviceRepository.save(middlewareDevice);
@ -198,6 +204,9 @@ export class DeviceCommissionService {
tuyaSpaceId,
);
successCount.value++;
console.log(
`Device ${rawDeviceId} successfully processed and transferred to Tuya space ${tuyaSpaceId}`,
);
} catch (err) {
failureCount.value++;
}

View File

@ -40,7 +40,6 @@ export class DisableSpaceHandler
relations: [
'subspaces',
'parent',
'tags',
'devices',
'outgoingConnections',
'incomingConnections',