[SOLVED] Subcribe switch issue esp8266 mqtt

Hello,

I find an issue regarding switch widget I setup from dashboard that doesn’t given any response to my serial monitor nodemcu esp8266. Previously I don’t find any problem using ubidots education profile but when I use ubidots STEM profile this issue happen. The code that I use is the same how I use in ubidots education profile as the example given:

/****************************************
 * Include Libraries
 ****************************************/
#include "UbidotsESPMQTT.h"

/****************************************
 * Define Constants
 ****************************************/
#define TOKEN "" // Your Ubidots TOKEN
#define WIFINAME "" //Your SSID
#define WIFIPASS "" // Your Wifi Pass

#define DEVICE_LABEL "switch" //assig device variable  
#define VARIABLE_LABEL "button" //assign variable

Ubidots client(TOKEN);

/****************************************
 * Auxiliar Functions
 ****************************************/

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();
}

/****************************************
 * Main Functions
 ****************************************/

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  client.ubidotsSetBroker("industrial.api.ubidots.com");
  client.setDebug(true); // Pass a true or false bool value to activate debug messages
  client.wifiConnection(WIFINAME, WIFIPASS);
  client.begin(callback);
  client.ubidotsSubscribe(DEVICE_LABEL,VARIABLE_LABEL); //Insert the dataSource and Variable's Labels
  }

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

Hi there, may you please share with me your Ubidots username so I can make some tests at my side?

All the best

My username is SyamimMustaqim. I also want to mention that I can receive response when I use slider widget using STEM profile. The problem only happen when I use switch

Hi there, it makes no sense for me that it works for a slider and not for a switch as in the backend both widgets just send data to an Ubidots variable, so I decided to run a small test and at my side using your account I am able to subscribe to switch values updates:

please make sure that you are subscribing to the topic /v1.6/devices/switch/buton1.

All the best

Ok, I somehow solve the problem by deleting the old device and make a new one. Not sure what the real problem is. Thank you for replies. Keep up a good work