Ubidots Community

Var subscribe problem

Been working on this for days. Tried many examples to subscribe to change state on an output using a switch on the dash. Everything seems to work except the output doesn’t change. Hardware and wiring is good.
I am obviously missing something simple. Thank You for any ideas!
John

Attempting MQTT connection…connected
Subscribed to:
/v1.6/devices/esp8266/temperature/lv
publishing to TOPIC:
/v1.6/devices/esp8266
JSON dict: {“stuff”: [{“value”: 10.00}]}
publishing to TOPIC:
/v1.6/devices/esp8266
JSON dict: {“stuff”: [{“value”: 10.00}]}
publishing to TOPIC:
/v1.6/devices/esp8266
JSON dict: {“stuff”: [{“value”: 10.00}]}
Attempting MQTT connection…connected
Subscribed to:
/v1.6/devices/esp8266/temperature/lv
publishing to TOPIC:
/v1.6/devices/esp8266
JSON dict: {“stuff”: [{“value”: 10.00}]}
publishing to TOPIC:
/v1.6/devices/esp8266
JSON dict: {“stuff”: [{“value”: 10.00}]}

Blockquote
/****************************************

  • Include Libraries
    ****************************************/
    #include “UbidotsESPMQTT.h”

/****************************************

  • Define Constants
    ****************************************/
    #define TOKEN “xxxx” // Your Ubidots TOKEN
    #define WIFINAME “x” // Your SSID
    #define WIFIPASS “xxx” // Your Wifi Pass

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]);
}
if ((char)payload[0]==‘1’){
digitalWrite(16, HIGH);
}
else{
digitalWrite(16, LOW);
}
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);
pinMode(16, OUTPUT);
client.ubidotsSubscribe(“esp8266”,“temperature”); //Insert the dataSource and Variable’s Labels
}

void loop() {
// put your main code here, to run repeatedly:
if(!client.connected()){
client.reconnect();
client.ubidotsSubscribe(“esp8266”,“temperature”); //Insert the dataSource and Variable’s Labels
}
client.add(“stuff”, 10);
client.ubidotsPublish(“esp8266”); // was “source1” in example???
client.loop();
delay (15000);
}