|
|
|
@ -899,7 +899,7 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
// If threshold type is time, update threshold time
|
|
|
|
|
await Tank.updateOne(
|
|
|
|
|
{ customerId, "connections.inputConnections.motor_id": motorId },
|
|
|
|
|
{ $set: { "connections.inputConnections.$.manual_threshold_time": req.body.manual_threshold_time } }
|
|
|
|
|
{ $set: { "connections.inputConnections.$.manual_threshold_time": req.body.manual_threshold_time,startTime:req.body.startTime } }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Start monitoring water level based on threshold time
|
|
|
|
@ -1355,6 +1355,7 @@ exports.calculateCapacity = async (req, reply) => {
|
|
|
|
|
exports.IotDevice = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { hardwareId, mode, tanks } = req.body;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create a new tank document with the current date and time
|
|
|
|
|
const currentDate = new Date();
|
|
|
|
@ -1386,7 +1387,7 @@ exports.IotDevice = async (req, reply) => {
|
|
|
|
|
for (const record of recordsToDelete) {
|
|
|
|
|
await record.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(tanks)
|
|
|
|
|
// Update waterlevel in tanksSchema for each tank
|
|
|
|
|
for (const tank of tanks) {
|
|
|
|
|
const { tankhardwareId, tankHeight } = tank;
|
|
|
|
|