Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Projects
B.I.T.S. 4.0
bits-screen
Commits
e4fa2469
Commit
e4fa2469
authored
May 11, 2018
by
JackV
Browse files
Improve temperature and humidity displaying
parent
3a8e78fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
e4fa2469
...
...
@@ -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
...
...
js/bits.js
View file @
e4fa2469
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment