Merge pull request #449 from SyncrowIOT/fix-get-schedule-api

fix: adjust category handling for CUR_2 device type in schedule retrieval
This commit is contained in:
faljawhary
2025-07-03 00:03:38 -06:00
committed by GitHub

View File

@ -266,6 +266,7 @@ export class ScheduleService {
const schedules = await this.getScheduleDeviceInTuya(
deviceDetails.deviceTuyaUuid,
category,
deviceDetails.productDevice.prodType as ProductType,
);
const result = schedules.result.map((schedule: any) => {
return {
@ -295,9 +296,12 @@ export class ScheduleService {
async getScheduleDeviceInTuya(
deviceId: string,
category: string,
deviceType: ProductType,
): Promise<getDeviceScheduleInterface> {
try {
const path = `/v2.0/cloud/timer/device/${deviceId}?category=category_${category}`;
const categoryToSent =
deviceType == ProductType.CUR_2 ? category : `category_${category}`;
const path = `/v2.0/cloud/timer/device/${deviceId}?category=${categoryToSent}`;
const response = await this.tuya.request({
method: 'GET',
path,