reconfigure mqtt when outlet description changed
This commit is contained in:
parent
32006e6598
commit
9aa5e864c7
@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.openpdu.org/OpenPDU/openpdu/board"
|
||||
"git.openpdu.org/OpenPDU/openpdu/events"
|
||||
"git.openpdu.org/OpenPDU/openpdu/mqtt"
|
||||
"git.openpdu.org/OpenPDU/openpdu/outlet"
|
||||
"git.openpdu.org/OpenPDU/openpdu/syslog"
|
||||
@ -45,6 +46,7 @@ func CreateOutlets() {
|
||||
|
||||
func init() {
|
||||
webui.SetMQTTReconfigFunction(MQTTreconfigure)
|
||||
events.AddListener("outlet_config_changed", MQTTreconfigure)
|
||||
// mqtt.MQTTReconfig = MQTTreconfigure()
|
||||
}
|
||||
|
||||
@ -72,10 +74,6 @@ func MQTTSetup() {
|
||||
"unique_id": viper.GetString("Mqtt.Prefix") + "_" + fmt.Sprint(o),
|
||||
"device": map[string]interface{}{
|
||||
"identifiers": []string{viper.GetString("Mqtt.Prefix")},
|
||||
// "name": viper.GetString("system.hostname"),
|
||||
// "model": "OpenPDU",
|
||||
// "sw_version": version,
|
||||
// "manufacturer": "OpenPDU",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.openpdu.org/OpenPDU/openpdu/events"
|
||||
"git.openpdu.org/OpenPDU/openpdu/outlet"
|
||||
"github.com/spf13/viper"
|
||||
"gopkg.in/macaron.v1"
|
||||
@ -90,5 +91,7 @@ func outletEditPost(ctx *macaron.Context, f OutletPostForm) {
|
||||
|
||||
viper.WriteConfig()
|
||||
|
||||
events.FireEvent("outlet_config_changed")
|
||||
|
||||
ctx.Redirect("/outlets")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user