From d5e076c0561796213ae465b110d2cd8431a71076 Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Tue, 27 Aug 2024 17:21:01 +0300 Subject: [PATCH] Change log retrieval period to one day for device logs --- 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 0641d6f..7f1bf44 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 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 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 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: oneHourAgo, + startTime: oneDayAgo, endTime: now, data: logs, } as getDeviceLogsInterface;