wait for mqttclient setup
This commit is contained in:
parent
93c04c1498
commit
6072bdaa53
@ -90,12 +90,18 @@ func Disconnect() {
|
||||
}
|
||||
|
||||
func Publish(topic string, value string) {
|
||||
if MQTTclient == nil {
|
||||
return
|
||||
}
|
||||
if MQTTclient.IsConnected() {
|
||||
MQTTclient.Publish(viper.GetString("Mqtt.Prefix")+"/switch/"+topic, 0, false, value)
|
||||
}
|
||||
}
|
||||
|
||||
func PublishRoot(topic string, value string) {
|
||||
if MQTTclient == nil {
|
||||
return
|
||||
}
|
||||
if MQTTclient.IsConnected() {
|
||||
MQTTclient.Publish(topic, 0, false, value)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user