Automatic refresh on index page
This commit is contained in:
parent
f28209fa79
commit
9e60500551
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue