Cayenne.begin initialization

Hello!

I would like to use a Cayenne in my existing project, but the problem that there already exists connection to the Internet. so is the way to use the existing connection to the Internet instead of initialization of own connection in string Cayenne.begin (имя пользователя, пароль, clientID, ssid, wifiPassword);?

  WiFi.begin(ssid, wifiPassword);  
  int conncnt = 0;
  String s = "Connect ";
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    s = s + ".";
    display.print(const_cast<char*>((s).c_str()), 2);
    Serial.println("Connect " + String(conncnt));
    if (conncnt == 10) break;
    conncnt += 1;  }
Cayenne.begin(username, password, clientID, ssid, wifiPassword);

moreover, if wifi couldn’t be found, we have to skip connection and run Loop.

Thanks!

temporary solution - comment part of the code in the CayenneArduinoMQTTClient.h

void connect() {
CAYENNE_LOG(“Connecting to %s:%d”, CAYENNE_DOMAIN, CAYENNE_PORT);
int error = MQTT_FAILURE;//igorlab
/*do {
if (!NetworkConnect(&_network, CAYENNE_DOMAIN, CAYENNE_PORT)) {
CAYENNE_LOG(“Network connect failed”);
delay(1000);
}
else if ((error = CayenneMQTTConnect(&_mqttClient)) != MQTT_SUCCESS) {
CAYENNE_LOG(“MQTT connect failed, error %d”, error);
NetworkDisconnect(&_network);
delay(1000);
}
}
while (error != MQTT_SUCCESS);
*/
CAYENNE_LOG(“Connected”);
CayenneConnected();
CayenneMQTTSubscribe(&_mqttClient, NULL, COMMAND_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
#ifdef DIGITAL_AND_ANALOG_SUPPORT
CayenneMQTTSubscribe(&_mqttClient, NULL, DIGITAL_COMMAND_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
CayenneMQTTSubscribe(&_mqttClient, NULL, DIGITAL_CONFIG_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
CayenneMQTTSubscribe(&_mqttClient, NULL, ANALOG_COMMAND_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
CayenneMQTTSubscribe(&_mqttClient, NULL, ANALOG_CONFIG_TOPIC, CAYENNE_ALL_CHANNELS, NULL);
#endif
publishDeviceInfo();
}

now if wifi not available, it skips trying to connect and run Loop.

Hi @tigorlab,

So were you able to get it working?

Are you using an Ethernet adapter? There are different files for the different connection types, sounds like you need to use the Arduino Ethernet connection instead of wifi. Cayenne Features - Developer | myDevices.com

try with

Cayenne.begin(username, password, clientID);

no, it wasn’t working :frowning:
my account was blocked, so I couldn’t answer