changes in motor_id

master
varun 1 year ago
parent 58ebd5ca6c
commit 25f9ced32e

@ -910,7 +910,7 @@ exports.motorAction = async (req, reply) => {
// Stop the motor pump
await Tank.updateOne(
{ customerId, "connections.inputConnections.motor_id": motorId },
{ $set: { "connections.inputConnections.$.motor_stop_status": "1" } }
{ $set: { "connections.inputConnections.$.motor_stop_status": "1",manual_threshold_time:null } }
);
clearInterval(intervalId); // Stop monitoring water level
}
@ -929,7 +929,7 @@ exports.motorAction = async (req, reply) => {
// Update water level threshold
await Tank.updateOne(
{ customerId, "connections.inputConnections.motor_id": motorId },
{ $set: { "connections.inputConnections.$.water_level_threshold": threshold_water_level.toString() } }
{ $set: { "connections.inputConnections.$.manual_threshold_percentage": threshold_water_level.toString() } }
);
// Start monitoring water level based on threshold percentage
@ -940,7 +940,7 @@ exports.motorAction = async (req, reply) => {
// Stop the motor pump
await Tank.updateOne(
{ customerId, "connections.inputConnections.motor_id": motorId },
{ $set: { "connections.inputConnections.$.motor_stop_status": "1" } }
{ $set: { "connections.inputConnections.$.motor_stop_status": "1",manual_threshold_percentage:null } }
);
clearInterval(intervalId); // Stop monitoring water level
}
@ -1390,11 +1390,11 @@ exports.IotDevice = async (req, reply) => {
// Update waterlevel in tanksSchema for each tank
for (const tank of tanks) {
const { tankhardwareId, tankHeight } = tank;
console.log(hardwareId,tankhardwareId)
// Find the corresponding tank in tanksSchema
const existingTank = await Tank.findOne({ hardwareId, tankhardwareId });
console.log(existingTank,"existing tank")
if (existingTank) {
// Update the waterlevel using the tankHeight value

Loading…
Cancel
Save