From b9ab26441a3a602c850caae86a9f5ec887275573 Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:35:56 +0300 Subject: [PATCH] Change log retrieval period to one hour in DeviceService --- src/device/services/device.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/device/services/device.service.ts b/src/device/services/device.service.ts index 7f1bf44..0641d6f 100644 --- a/src/device/services/device.service.ts +++ b/src/device/services/device.service.ts @@ -721,8 +721,8 @@ export class DeviceService { ): Promise { try { const now = Date.now(); - const oneDayAgo = now - 1 * 24 * 60 * 60 * 1000; - const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneDayAgo}&end_time=${now}&codes=${code}&size=50`; + const oneHourAgo = now - 1 * 60 * 60 * 1000; + const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneHourAgo}&end_time=${now}&codes=${code}&size=50`; const response = await this.tuya.request({ method: 'GET', path, @@ -731,7 +731,7 @@ export class DeviceService { const camelCaseResponse = convertKeysToCamelCase(response); const logs = camelCaseResponse.result.logs ?? []; return { - startTime: oneDayAgo, + startTime: oneHourAgo, endTime: now, data: logs, } as getDeviceLogsInterface;