mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
Update AutomationService to use SceneRepository for scene details
This commit is contained in:
@ -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<string>('auth-config.ACCESS_KEY');
|
||||
const secretKey = this.configService.get<string>('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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user