mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-09 22:57:24 +00:00
fix: adjust category handling for CUR_2 device type in schedule retrieval
This commit is contained in:
@ -266,6 +266,7 @@ export class ScheduleService {
|
|||||||
const schedules = await this.getScheduleDeviceInTuya(
|
const schedules = await this.getScheduleDeviceInTuya(
|
||||||
deviceDetails.deviceTuyaUuid,
|
deviceDetails.deviceTuyaUuid,
|
||||||
category,
|
category,
|
||||||
|
deviceDetails.productDevice.prodType as ProductType,
|
||||||
);
|
);
|
||||||
const result = schedules.result.map((schedule: any) => {
|
const result = schedules.result.map((schedule: any) => {
|
||||||
return {
|
return {
|
||||||
@ -295,9 +296,12 @@ export class ScheduleService {
|
|||||||
async getScheduleDeviceInTuya(
|
async getScheduleDeviceInTuya(
|
||||||
deviceId: string,
|
deviceId: string,
|
||||||
category: string,
|
category: string,
|
||||||
|
deviceType: ProductType,
|
||||||
): Promise<getDeviceScheduleInterface> {
|
): Promise<getDeviceScheduleInterface> {
|
||||||
try {
|
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({
|
const response = await this.tuya.request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
path,
|
path,
|
||||||
|
Reference in New Issue
Block a user