start and stop

master
varun 3 years ago
parent e60f9a018e
commit 2e5bc65d63

@ -263,7 +263,7 @@ exports.motorAction = async (req, reply) => {
if(action === "start"){ if(action === "start"){
// start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'}) start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'})
supplier_tank = req.body.from supplier_tank = req.body.from
supplier_tank_type = (req.body.from_type).toLowerCase() supplier_tank_type = (req.body.from_type).toLowerCase()
@ -371,6 +371,7 @@ exports.motorAction = async (req, reply) => {
intervalId = setInterval(async function () { intervalId = setInterval(async function () {
// Calculate new water levels // Calculate new water levels
const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type}); const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type});
console.log(rcvr_info)
console.log(rcvr_info.motor_status) console.log(rcvr_info.motor_status)
const newWaterLevel = receiver_waterlevel+450; const newWaterLevel = receiver_waterlevel+450;
console.log(newWaterLevel,"2",receiver_tank_info.tankName) console.log(newWaterLevel,"2",receiver_tank_info.tankName)
@ -424,14 +425,15 @@ exports.motorAction = async (req, reply) => {
} }
const motor_data = await motorData.save(); const motor_data = await motorData.save();
reply.send({ status_code: 200, data: motor_data }); // reply.send({ status_code: 200, data: motor_data });
return motor_data
reply.send({ status_code: 200, "start time": start_time, data: motor_data});
console.log(start_time)
return motor_data
// reply.send({ status_code: 200, "start time": start_time});
//console.log(start_time)
} }

Loading…
Cancel
Save