ensure Timer is the category value for CUR2 type (#448)

This commit is contained in:
ZaydSkaff
2025-06-30 15:52:01 +03:00
committed by GitHub
parent b3f8b92826
commit 0b9eef276e

View File

@ -136,6 +136,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 {
@ -255,9 +256,12 @@ export class ScheduleService {
private 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,