Working with static IP wireless

Dear friends: I’m working in my project, in which I need to work with a static IP in a wifi connection.
I don’t know how to do this, because when tried to configure Cayenne.begin as it would be done with ManualConnection (for ethernet) example but didn’t work.

error: no matching function for call to ‘CayenneMQTTWiFiClient::begin(char [37], char [41], char [37], char [12], char [12], IPAddress&, IPAddress&, IPAddress&, IPAddress&, byte [6])’

when tried to do
Cayenne.begin(username, password, clientID, ssid, wifiPassword, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac));

Is there any way to work with fixed IPs and wifi connection with cayenne?

Many thanks for your help.
Best regards

Daniel

try this code:-

#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>

#include <ESP8266WiFi.h>
IPAddress ip(192, 168, 1, xxx);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress DNS(192, 168, 1, 1);

const char* ssid     = "xxxxxx";
const char* wifipassword = "xxxxx";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "xxxxx";
char password[] = "xxxxx";
char clientID[] = "xxxx";

void setup() {
  Serial.begin(115200);
  WiFi.config(ip, gateway, subnet, DNS);
  delay(100);
  //WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, wifipassword);
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(200);
  }
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println();
    Serial.println("Fail connecting");
    delay(5000);
    ESP.restart();
  }
  Serial.print("   OK  ");
  Serial.print("Module IP: ");
  Serial.println(WiFi.localIP());
  Cayenne.begin(username, password, clientID);

}

void loop() {
  Cayenne.loop();

}
1 Like

thank you!
best regards
DL