diff --git a/src/automation/autoDataExtractor.js b/src/automation/autoDataExtractor.js index 599c95d..ff1476d 100644 --- a/src/automation/autoDataExtractor.js +++ b/src/automation/autoDataExtractor.js @@ -73,10 +73,9 @@ const getSanitizedData = (data) => { return sanitizedData; }; -const extractData = async (camParams, bedId) => { - const coordinates = await getMonitorCoordinates(bedId); - console.log("Moving to coordinates: ", coordinates); - await CameraUtils.absoluteMove({ camParams, ...coordinates }); +const extractData = async (camParams, monitorPreset = { x: 0, y: 0, z: 0 }) => { + console.log("Moving to coordinates: ", monitorPreset); + await CameraUtils.absoluteMove({ camParams, ...monitorPreset }); const snapshotUrl = await CameraUtils.getSnapshotUri({ camParams }); @@ -112,26 +111,25 @@ const extractData = async (camParams, bedId) => { return getSanitizedData(response.data.data); }; - const _getCamParams = (params) => { - const { hostname, username, password, port } = params; - - const camParams = { - useSecure: Number(port) === 443, - hostname, - username, - password, - port: Number(port), - }; + const { hostname, username, password, port } = params; + + const camParams = { + useSecure: Number(port) === 443, + hostname, + username, + password, + port: Number(port), + }; - return camParams; + return camParams; }; -export const updateObservationAuto = async (cameraParams, bedId) => { +export const updateObservationAuto = async (cameraParams, monitorPreset) => { try { const cameraParamsSanitized = _getCamParams(cameraParams); - const payload = await extractData(cameraParamsSanitized, bedId); + const payload = await extractData(cameraParamsSanitized, monitorPreset); return payload; } catch (err) { diff --git a/src/automation/helper/getMonitorCoordinates.js b/src/automation/helper/getMonitorCoordinates.js index 6a53c44..2757564 100644 --- a/src/automation/helper/getMonitorCoordinates.js +++ b/src/automation/helper/getMonitorCoordinates.js @@ -7,7 +7,6 @@ export const getMonitorCoordinates = async (bedId) => { const preset = await prisma.preset.findFirst({ where: { bed: { externalId: bedId }, - deleted: false, }, }); diff --git a/src/controller/ObservationController.js b/src/controller/ObservationController.js index 71f6c38..dea6516 100644 --- a/src/controller/ObservationController.js +++ b/src/controller/ObservationController.js @@ -303,7 +303,10 @@ const updateObservationsToCare = async () => { console.log("updateObservationsToCare:cameraParams", cameraParams); - const v2Payload = await updateObservationAuto(cameraParams, bed_id); + const v2Payload = await updateObservationAuto( + cameraParams, + monitorPreset + ); await makeDataDumpToJson( payload, v2Payload, diff --git a/src/utils/dailyRoundUtils.js b/src/utils/dailyRoundUtils.js index 48b67cf..f2d7527 100644 --- a/src/utils/dailyRoundUtils.js +++ b/src/utils/dailyRoundUtils.js @@ -50,6 +50,7 @@ export const getBedById = async (bedId) => { }, include: { camera: true, + monitorPreset: true, }, }); };