diff --git a/GPIO/GPIO b/GPIO/GPIO index 8ab9e8d..2827c98 100644 Binary files a/GPIO/GPIO and b/GPIO/GPIO differ diff --git a/GPIO/GPIO.go b/GPIO/GPIO.go index e0eef85..b1023db 100644 --- a/GPIO/GPIO.go +++ b/GPIO/GPIO.go @@ -215,10 +215,10 @@ func mqtt_begin() { opts_cms_bi.SetUsername(CMS_ACCESS_TOKEN_BI) opts_cms_bi.SetPassword(CMS_PASS_BI) opts_cms_bi.SetCleanSession(true) - mqtt_cms_bi = mqtt.NewClient(opts_cms_bi) opts_cms_bi.SetConnectionLostHandler(MQTTLostConnectHandler) opts_cms_bi.SetOnConnectHandler(MQTTOnConnectHandler) + mqtt_cms_bi = mqtt.NewClient(opts_cms_bi) if token_1 := mqtt_cms_bi.Connect(); token_1.Wait() && token_1.Error() == nil { //file.Write_log("MQTT CMS Beetsoft Connected\n", path_log) if Debug == 1 { @@ -232,6 +232,11 @@ func mqtt_begin() { fmt.Printf("-------------------\n") } } + if token := mqtt_cms_bi.Subscribe(CMS_TOPIC_IN, 0, mqtt_messageHandler); token.Wait() && token.Error() != nil { + fmt.Println(token.Error()) + } else { + fmt.Println("Subcriber is MQTTOnConnectHandler () OKIE ") + } // opts_cms_bi.OnConnect = func(c mqtt.Client) { // fmt.Printf("Client connected, subscribing to: " + CMS_TOPIC_IN)