Automatic refresh on index page
This commit is contained in:
parent
f28209fa79
commit
9e60500551
|
|
@ -18,6 +18,7 @@ var (
|
||||||
|
|
||||||
type SensorPrint struct {
|
type SensorPrint struct {
|
||||||
Name string
|
Name string
|
||||||
|
Mac string
|
||||||
Value string
|
Value string
|
||||||
Unit string
|
Unit string
|
||||||
Horodate string
|
Horodate string
|
||||||
|
|
@ -47,8 +48,8 @@ func getLastTemps() ([]SensorPrint) {
|
||||||
if sens.Name == "" {
|
if sens.Name == "" {
|
||||||
sens.Name = s.SensorMAC
|
sens.Name = s.SensorMAC
|
||||||
}
|
}
|
||||||
|
sens.Mac = s.SensorMAC
|
||||||
|
|
||||||
// t := temperature.GetLastTempForSensor(s.Id)
|
|
||||||
t := temperatureTmp.GetTemp(s.Id)
|
t := temperatureTmp.GetTemp(s.Id)
|
||||||
sens.Value = strconv.FormatInt(t.Value, 10)
|
sens.Value = strconv.FormatInt(t.Value, 10)
|
||||||
sens.Unit = "°C"
|
sens.Unit = "°C"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
{{define "body"}}
|
{{define "body"}}
|
||||||
<br/>
|
<br/>
|
||||||
{{range $key, $val := .sensors}}
|
{{range $key, $val := .sensors}}
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info" id="{{$val.Mac}}">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">{{$val.Name}}</h3>
|
<h3 class="panel-title">{{$val.Name}}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -15,4 +15,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
setTimeout(function() {
|
||||||
|
location.reload();
|
||||||
|
}, 5*60*1000);
|
||||||
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue