|
|
@ -1494,6 +1494,7 @@ exports.IotDevice = async (req, reply) => {
|
|
|
|
const waterCapacityPerCm = parseInt(existingTank.waterCapacityPerCm.replace(/,/g, ''), 10);
|
|
|
|
const waterCapacityPerCm = parseInt(existingTank.waterCapacityPerCm.replace(/,/g, ''), 10);
|
|
|
|
const water_level = water_level_height * waterCapacityPerCm;
|
|
|
|
const water_level = water_level_height * waterCapacityPerCm;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (water_level >= 0) {
|
|
|
|
existingTank.waterlevel = water_level;
|
|
|
|
existingTank.waterlevel = water_level;
|
|
|
|
|
|
|
|
|
|
|
|
// Save the updated tank document
|
|
|
|
// Save the updated tank document
|
|
|
@ -1513,6 +1514,8 @@ exports.IotDevice = async (req, reply) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Send the latest three documents
|
|
|
|
// Send the latest three documents
|
|
|
|
const latestOttanks = await IotData.find({ hardwareId })
|
|
|
|
const latestOttanks = await IotData.find({ hardwareId })
|
|
|
|
.sort({ date: -1, time: -1 });
|
|
|
|
.sort({ date: -1, time: -1 });
|
|
|
|