Hi, thanks for your prompt reply.
Here is the data you asked for:
Code of my mit app screen:
It needs a login system, therefore, it has a join block to provide the page with a secret key...
async function doDo() {
var a = await fetch("<MY LINK HERE>" + localStorage.getItem('sec'))
.then((response) => response.json())
.then((data) => {
document.getElementById("lpg").innerHTML = data.lpg;
document.getElementById("co2").innerHTML = data.co2;
document.getElementById("co").innerHTML = data.co;
document.getElementById("smoke").innerHTML = data.smoke;
if (parseFloat(data.co2) < 500) {
document.getElementById("co2box").style.backgroundColor = "#00e400";
}
else if (parseFloat(data.co2) < 700) {
document.getElementById("co2box").style.backgroundColor = "#ffff00";
}
else {
document.getElementById("co2box").style.backgroundColor = "#ff0000";
}
if (parseFloat(data.co) < 2) {
document.getElementById("coBox").style.backgroundColor = "#00e400";
}
else if (parseFloat(data.co) < 4) {
document.getElementById("coBox").style.backgroundColor = "#ffff00";
}
else {
document.getElementById("coBox").style.backgroundColor = "#ff0000";
}
if (parseFloat(data.lpg) < 0.2) {
document.getElementById("lpgBox").style.backgroundColor = "#00e400";
document.getElementById("smokeBox").style.backgroundColor = "#00e400";
}
else if (parseFloat(data.lpg) < 0.4) {
document.getElementById("lpgBox").style.backgroundColor = "#ffff00";
document.getElementById("smokeBox").style.backgroundColor = "#ffff00";
}
else {
document.getElementById("lpgBox").style.backgroundColor = "#ff0000";
document.getElementById("smokeBox").style.backgroundColor = "#ff0000";
}
return data;
});
if (a.status == "online") {
document.getElementById("d1").innerHTML = "online";
document.getElementById("d1").style.color = "#00e400";
document.getElementById("d2").innerHTML = "online";
document.getElementById("d2").style.color = "#00e400";
}
else {
document.getElementById("d2").innerHTML = "offline";
document.getElementById("d2").style.color = "#ff0000";
document.getElementById("d1").innerHTML = "offline";
document.getElementById("d1").style.color = "#ff0000";
}
//setDial(a.aqi);
}
setInterval(doDo, 5000);
localstorage.getItem is the secret key which it uses to fetch from the api.