integrated iot

master
Varun 1 year ago
parent 8d07a8e50d
commit 88b272ee4a

@ -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 });

@ -522,6 +522,7 @@ module.exports = function (fastify, opts, next) {
fastify.get("/api/APIRead", { fastify.get("/api/APIRead", {
schema: { schema: {

Loading…
Cancel
Save