Siple Switch no working

Hello, i´m trying to get the subscriptions working. I just created a variable called sw1 in ubidots and add a switch widget in the dashboard and upload a simple example code to the ESP8266 board for MQTT subscription.

I can not get anything on the boar side … here is de serial monitor:

It seems it never callsback … do you have any idea why there is a “/lv” added to the topic at the end ?

I think this could be the problem but I hardcoded de “device label” and de “variable label´” … i dont know why subscribed to that topic.

here is the code also:

#include “UbidotsESPMQTT.h”

#define TOKEN “MY_TOKEN” // Your Ubidots TOKEN
#define WIFINAME “LG_K10” //Your SSID
#define WIFIPASS “MY_PASS” // Your Wifi Pass

Ubidots client(TOKEN);

void callback(char* topic, byte* payload, unsigned int length) {
Serial.print(“Message arrived [”);
Serial.print(topic);
Serial.print("] ");
for (int i=0;i<length;i++) {
Serial.print((char)payload[i]);
}
Serial.println();
}

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
client.setDebug(true); // Pass a true or false bool value to activate debug messages
client.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
client.ubidotsSubscribe(“secadero_1”,“sw1”); //Insert the dataSource and Variable’s Labels
}

void loop() {
// put your main code here, to run repeatedly:
if(!client.connected()){
client.reconnect();
client.ubidotsSubscribe(“secadero_1”,“sw1”); //Insert the dataSource and Variable’s Labels
}
client.loop();
}

Hi @patriciollovera,

I hope all is well,

Regarding your question, lv is added at the end of the topic, to return the last value received by the variable. Additionally, can you please add in the void setup() the following line to make sure you are subscribing using the correct URL

client.ubidotsSetBroker("industrial.api.ubidots.com"); // Sets the broker properly for the Industrial account

At last note, you can refer to our Hardware documentation or Connect a NodeMCU ESP8266 to Ubidots over MQTT guide for further examples.

All the best,
-Isabel