|
|
@ -2772,6 +2772,7 @@ exports.IotDeviceforstandalone = async (req, reply) => {
|
|
|
|
// save the document to MongoDB
|
|
|
|
// save the document to MongoDB
|
|
|
|
await ottank.save();
|
|
|
|
await ottank.save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Delete excess records (keep only the latest three records)
|
|
|
|
// Delete excess records (keep only the latest three records)
|
|
|
|
const recordsToKeep = 3;
|
|
|
|
const recordsToKeep = 3;
|
|
|
|
const recordsToDelete = await IotData.find({ hardwareId })
|
|
|
|
const recordsToDelete = await IotData.find({ hardwareId })
|
|
|
@ -2825,7 +2826,7 @@ exports.IotDeviceforstandalone = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const status = req.body.Motor_status;
|
|
|
|
const status = req.body.Motor_status;
|
|
|
|
console.log(hardwareId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Find the tank that contains the specified motor_id in its inputConnections
|
|
|
|
// Find the tank that contains the specified motor_id in its inputConnections
|
|
|
|
const tank = await Tank.findOne({ "connections.inputConnections.motor_id": hardwareId });
|
|
|
|
const tank = await Tank.findOne({ "connections.inputConnections.motor_id": hardwareId });
|
|
|
|