Temp alert <73/>76, CO2 warn >900 crit >1100
This commit is contained in:
parent
c840d6e74d
commit
91cb650bf7
|
|
@ -373,8 +373,10 @@ async function updateSensors() {
|
||||||
const d = await r.json();
|
const d = await r.json();
|
||||||
const tempF = parseFloat(d.temperature);
|
const tempF = parseFloat(d.temperature);
|
||||||
const tempC = ((tempF - 32) * 5/9).toFixed(1);
|
const tempC = ((tempF - 32) * 5/9).toFixed(1);
|
||||||
document.getElementById('s-temp').textContent = Math.round(tempF) + '°';
|
const tempEl = document.getElementById('s-temp');
|
||||||
document.getElementById('s-temp').title = tempC + '°C';
|
tempEl.textContent = Math.round(tempF) + '°';
|
||||||
|
tempEl.title = tempC + '°C';
|
||||||
|
tempEl.className = 'sensor-val' + (tempF < 73 || tempF > 76 ? ' crit' : '');
|
||||||
|
|
||||||
const hum = parseFloat(d.humidity);
|
const hum = parseFloat(d.humidity);
|
||||||
const humEl = document.getElementById('s-hum');
|
const humEl = document.getElementById('s-hum');
|
||||||
|
|
@ -384,7 +386,7 @@ async function updateSensors() {
|
||||||
const co2 = parseInt(d.co2);
|
const co2 = parseInt(d.co2);
|
||||||
const co2El = document.getElementById('s-co2');
|
const co2El = document.getElementById('s-co2');
|
||||||
co2El.textContent = co2;
|
co2El.textContent = co2;
|
||||||
co2El.className = 'sensor-val' + (co2 > 1500 ? ' crit' : co2 > 1000 ? ' warn' : '');
|
co2El.className = 'sensor-val' + (co2 > 1100 ? ' crit' : co2 > 900 ? ' warn' : '');
|
||||||
} catch(e) { console.error('Sensor fetch failed:', e); }
|
} catch(e) { console.error('Sensor fetch failed:', e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue