Commit e4fa2469 authored by JackV's avatar JackV
Browse files

Improve temperature and humidity displaying

parent 3a8e78fa
......@@ -15,8 +15,8 @@
<span>N/A</span>
</div>
<div id="reading">
<span id="temp"><img src="svg/thermometer.svg"><span>N/A</span> °C</span>
<span id="hum"><img src="svg/drops.svg"><span>N/A</span>%</span>
<span id="temp"><img src="svg/thermometer.svg"><span>N/A °C</span></span>
<span id="hum"><img src="svg/drops.svg"><span>N/A%</span></span>
</div>
<footer>
Iniziativa realizzata con il contributo del Politecnico di Milano
......
......@@ -19,10 +19,10 @@ mqtt_client = new Paho.MQTT.Client(window.location.hostname, Number(1884),
mqtt_client.onMessageArrived = function (message) {
if (message.destinationName === "sede/sensors/si7020/temperature") {
change_temp(parseFloat(message.payloadString).toFixed(2));
change_temp(parseFloat(message.payloadString).toFixed(2) + ' °C');
}
if (message.destinationName === "sede/sensors/si7020/humidity") {
change_hum(parseFloat(message.payloadString).toFixed(2));
change_hum(parseFloat(message.payloadString).toFixed(2) + '%');
}
if (message.destinationName === "sede/status") {
status_msg = JSON.parse(message.payloadString);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment