server bug fixed
This commit is contained in:
parent
114463618e
commit
2924473ec0
5
index.js
5
index.js
@ -20,11 +20,10 @@ const save_data = async time => {
|
||||
try {
|
||||
const devices = await deviceSchema.find({});
|
||||
//console.log("DEVICES => " + devices);
|
||||
for (const { _id } of devices) {
|
||||
for (const { _id, ip } of devices) {
|
||||
const value_data = await getScript(ip);
|
||||
const data = JSON.parse(value_data);
|
||||
const { ip, lastStatus } = await deviceSchema.findById(_id);
|
||||
//console.log(lastStatus, data.Sensors[0].Switch);
|
||||
const { lastStatus } = await deviceSchema.findById(_id);
|
||||
|
||||
if (lastStatus != data.Sensors[0].Switch) {
|
||||
await statusSchema.findOneAndUpdate(
|
||||
|
Loading…
Reference in New Issue
Block a user