[SOLVED] No response from Switch


#1

I setup a switch in the dashboard. When I turn the switch on and off I am not getting a response on the serial monitor

IP address:
192.168.2.81
entra
Attempting MQTT connection…connected
Subscribed to:
/v1.6/devices/roof-switch/switch/lv

As you can see I have a MQTT connection

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);
pinMode(4,OUTPUT);
client.ubidotsSubscribe(“roof-switch”,“switch”); //Insert the dataSource and Variable’s Labels
}

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


#2

Greetings @flightman49 , I see an error inside your loop function, in this line:

client.ubidotsSubscribe("roof=switch","switch"); //Insert the dataSource and Variable's Labels

you have as device label “roof=switch”, you cannot use special characters, your device label should be something like “roof-switch”. Keep in mind that your device and variable to subscribe must have been created previously at Ubidots.

Regards


#3

I have to be more careful. The switch works now

Thank You