Automatic refresh on index page

This commit is contained in:
Chteufleur 2015-10-07 21:55:55 +02:00
parent f28209fa79
commit 9e60500551
2 changed files with 9 additions and 2 deletions

View File

@ -18,6 +18,7 @@ var (
type SensorPrint struct {
Name string
Mac string
Value string
Unit string
Horodate string
@ -47,8 +48,8 @@ func getLastTemps() ([]SensorPrint) {
if sens.Name == "" {
sens.Name = s.SensorMAC
}
sens.Mac = s.SensorMAC
// t := temperature.GetLastTempForSensor(s.Id)
t := temperatureTmp.GetTemp(s.Id)
sens.Value = strconv.FormatInt(t.Value, 10)
sens.Unit = "°C"

View File

@ -4,7 +4,7 @@
{{define "body"}}
<br/>
{{range $key, $val := .sensors}}
<div class="panel panel-info">
<div class="panel panel-info" id="{{$val.Mac}}">
<div class="panel-heading">
<h3 class="panel-title">{{$val.Name}}</h3>
</div>
@ -15,4 +15,10 @@
</div>
</div>
{{end}}
<script type="text/javascript">
setTimeout(function() {
location.reload();
}, 5*60*1000);
</script>
{{end}}