Refactor
This commit is contained in:
@@ -54,7 +54,6 @@ async function hasStatusChanged(newData, oldData) {
|
||||
|
||||
if (vehicle.fmsstatus_id != oldVehicle.fmsstatus_id || !oldVehicle) {
|
||||
// Divera Nachricht
|
||||
console.log("[INFO] Statusabfrage!");
|
||||
if (
|
||||
vehicle.fmsstatus_id == 6 ||
|
||||
vehicle.fmsstatus_id == 2 ||
|
||||
@@ -73,14 +72,17 @@ async function hasStatusChanged(newData, oldData) {
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("Divera News sent successfully:", res.data);
|
||||
console.log(
|
||||
`[INFO] Divera News sent successfully: FL. AUR ${vehicle.name} Status ${oldVehicle.fmsstatus_id}->${vehicle.fmsstatus_id}`,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async function main() {
|
||||
console.log("Ausführung Status");
|
||||
console.log("[INFO] Statusabfrage - " + new Date().toLocaleString("de-DE"));
|
||||
|
||||
const newData = await getData();
|
||||
|
||||
hasStatusChanged(newData, JSON.parse(fs.readFileSync(CACHE_FILE, "utf8")));
|
||||
@@ -88,5 +90,5 @@ async function main() {
|
||||
fs.writeFileSync(CACHE_FILE, JSON.stringify(newData));
|
||||
}
|
||||
|
||||
console.log("[INFO] Start Intervall!");
|
||||
console.log("[INFO] Starte Intervall!");
|
||||
setInterval(main, 1000 * process.env.intervall);
|
||||
|
||||
Reference in New Issue
Block a user