mqtt status
This commit is contained in:
parent
d37b7d08e7
commit
5c8960d8d2
@ -3,6 +3,7 @@ package webui
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git.openpdu.org/OpenPDU/openpdu/mqtt"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"gopkg.in/macaron.v1"
|
"gopkg.in/macaron.v1"
|
||||||
)
|
)
|
||||||
@ -25,6 +26,12 @@ func mqttPage(ctx *macaron.Context) {
|
|||||||
ctx.Data["password"] = viper.GetString("Mqtt.Password")
|
ctx.Data["password"] = viper.GetString("Mqtt.Password")
|
||||||
ctx.Data["homeassistant"] = viper.GetString("Mqtt.homeassistant")
|
ctx.Data["homeassistant"] = viper.GetString("Mqtt.homeassistant")
|
||||||
|
|
||||||
|
if mqtt.Connected() {
|
||||||
|
ctx.Data["mqttstatus"] = "Connected"
|
||||||
|
} else {
|
||||||
|
ctx.Data["mqttstatus"] = "Disconnected"
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["schemas"] = []string{"tcp", "ssl", "ws"}
|
ctx.Data["schemas"] = []string{"tcp", "ssl", "ws"}
|
||||||
ctx.HTML(200, "mqtt")
|
ctx.HTML(200, "mqtt")
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,13 @@
|
|||||||
<form class="form-horizontal" method="post">
|
<form class="form-horizontal" method="post">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="mqttstatus" class="col-sm-2 control-label">Status</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="text" class="form-control" id="mqttstatus" disabled="" value="{{ mqttstatus }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="schema" class="col-sm-2 control-label">Schema</label>
|
<label for="schema" class="col-sm-2 control-label">Schema</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
Loading…
Reference in New Issue
Block a user