wait for mqttclient setup

This commit is contained in:
Paolo Asperti 2021-09-30 23:07:44 +02:00
parent 93c04c1498
commit 6072bdaa53
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -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)
}