save only 1 status
This commit is contained in:
parent
bb8319acf4
commit
114463618e
4
index.js
4
index.js
@ -20,10 +20,10 @@ const save_data = async time => {
|
||||
try {
|
||||
const devices = await deviceSchema.find({});
|
||||
//console.log("DEVICES => " + devices);
|
||||
for (const { ip, _id, lastStatus } of devices) {
|
||||
for (const { _id } 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);
|
||||
|
||||
if (lastStatus != data.Sensors[0].Switch) {
|
||||
|
Loading…
Reference in New Issue
Block a user