mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 07:34:54 +00:00
fixed commission device
This commit is contained in:
@ -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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user