Very slow and inconsistent response


I am using an Arduino uno with a 5100 shield. I am just trying to get a button to turn on an led.

it works but very slowly and quite inconsistently. here is my sketch. I would appreciate any suggestions. sincere thanks,


Cayenne Light Switch Example

This sketch shows how to set up a Light Switch with Cayenne.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.


  1. In the Cayenne Dashboard add a new Light Switch Widget.
  2. Select a virtual channel number for the widget.
  3. Set the VIRTUAL_CHANNEL value below to virtual channel you selected.
  4. Attach the negative leg of an LED to ground and the other leg to the selected digital pin.
    [Ground] – [LED] – [Resistor] – [Digital Pin]
  5. Set the ACTUATOR_PIN value below to the pin number you used when connecting your LED.
  6. Set the Cayenne authentication info to match the authentication info from the Dashboard.
  7. Compile and upload this sketch.
  8. Once the Arduino connects to the Dashboard you can use the widget button to turn the LED on and off.

#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTEthernet.h>

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = “d8887b60-3aa8-11e8-9f38-9fae3d42ebf0”;
char password[] = “7aef2e8fb1382216d5b33ef6ac160191bfa17eca”;
char clientID[] = “e00cf280-40c5-11e8-9beb-4d400e603e7e”;

#define ACTUATOR_PIN 4 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.

void setup()
Cayenne.begin(username, password, clientID);

void loop()

// This function is called when data is sent from Cayenne.
int value = getValue.asInt();
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL, ACTUATOR_PIN, value);
// Write the value received to the digital pin.
digitalWrite(ACTUATOR_PIN, value);


It takes to 10 seconds to 15 minutes to get a response from the server. This problem occurs about two days now. It was a known issue, and I believe they are working on it.


Thank you,


Hi. I have to join this topic. I am using NodeMCU LUA - ESP8266 connection. For the last approximately 14 days, the response of all commands has taken a very long time. For example, relay switching is done after 30 seconds to 10 minutes. This is really a problem. Can you advise on how to improve this? Or, when will the problem be removed? Thanks you. Martin




@hans.mock @Jstenerson @sengulumur @martin.kadlec there is bug with cayenne arduino MQTT and will be fixed soon.


Thank you very much for the quick reaction. Can I request a message when the issue is resolved? I will run the test. Thank you. Martin


me too,
is it possible because of my network ?
international connection give more delay
or server trouble ?
help haha


Working great this morning! Thanks.