diff --git a/src/automation/services/automation.service.ts b/src/automation/services/automation.service.ts index 91cca1a..742ea59 100644 --- a/src/automation/services/automation.service.ts +++ b/src/automation/services/automation.service.ts @@ -33,6 +33,7 @@ import { import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service'; import { ConvertedAction } from '@app/common/integrations/tuya/interfaces'; import { SceneDeviceRepository } from '@app/common/modules/scene-device/repositories'; +import { SceneRepository } from '@app/common/modules/scene/repositories'; @Injectable() export class AutomationService { @@ -43,6 +44,7 @@ export class AutomationService { private readonly deviceService: DeviceService, private readonly tuyaService: TuyaService, private readonly sceneDeviceRepository: SceneDeviceRepository, + private readonly sceneRepository: SceneRepository, ) { const accessKey = this.configService.get('auth-config.ACCESS_KEY'); const secretKey = this.configService.get('auth-config.SECRET_KEY'); @@ -245,13 +247,20 @@ export class AutomationService { action.actionExecutor !== ActionExecutorEnum.DEVICE_ISSUE && action.actionExecutor !== ActionExecutorEnum.DELAY ) { - const sceneDetails = await this.getTapToRunSceneDetailsTuya( - action.entityId, - ); + const scene = await this.sceneRepository.findOne({ + where: { + uuid: action.entityId, + }, + }); + if (scene.uuid) { + const sceneDetails = await this.getTapToRunSceneDetailsTuya( + scene.sceneTuyaUuid, + ); - if (sceneDetails.id) { - action.name = sceneDetails.name; - action.type = sceneDetails.type; + if (sceneDetails.id) { + action.name = sceneDetails.name; + action.type = sceneDetails.type; + } } } }