I guess I need a bit of help. If anyone can help me kick the can down the road that would be awesome.
I got my ESP32 to connect to the Wi-Fi network but Im not able to connect to MyDevices or more to the point Connecting to mqtt.mydevices.com:1883
I used the code pasted below, but Im missing something.
What is the SSIDc and PasswordC
Also should I be using the ESP8266 selection from ADD NEW or do I use BRING MY OWN DEVICE. I choose Bring My Own and populated the code with those credentials.
12:56:42.352 -> ets Jun 8 2016 00:22:57
12:56:42.352 ->
12:56:42.352 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:56:42.760 -> ets Jun 8 2016 00:22:57
12:56:42.760 ->
12:56:42.760 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:56:42.760 -> configsip: 0, SPIWP:0xee
12:56:42.760 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:56:42.760 -> mode:DIO, clock div:1
12:56:42.760 -> load:0x3fff0018,len:4
12:56:42.760 -> load:0x3fff001c,len:1100
12:56:42.760 -> load:0x40078000,len:10088
12:56:42.760 -> load:0x40080400,len:6380
12:56:42.760 -> entry 0x400806a4
12:56:43.514 -> Connecting to WiFi…
12:56:44.030 -> Connecting to WiFi…
12:56:44.030 -> Connected to the WiFi network
12:56:44.508 -> [1669] Connecting to Linksys
12:56:44.541 -> [1686] Connected to WiFi
12:56:44.541 -> [1686] IP: 192.168.1.147
12:56:44.541 -> [1686] Connecting to mqtt.mydevices.com:1883
12:56:48.528 -> [5687] Network connect failed
12:56:49.525 -> [6687] Network connect failed
12:56:50.525 -> [7687] Network connect failed
12:56:51.552 -> [8686] Network connect failed
12:56:52.545 -> [9686] Network connect failed
12:56:53.534 -> [10686] Network connect failed
12:56:54.529 -> [11687] Network connect failed
12:56:55.532 -> [12687] Network connect failed
12:56:56.527 -> [13686] Network connect failed
This was the code I used:
/*
This example shows how to connect to Cayenne using an ESP32 and send/receive sample data.
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.
Steps:
1. If you have not already installed the ESP32 Board Package install it using the instructions here: https://github.com/espressif/arduino-esp32/blob/master/README.md#installation-instructions.
2. Select your ESP32 board from the Tools menu.
3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
4. Set the network name and password.
5. Compile and upload the sketch.
6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.
7./
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#define EspSerial Serial
#include <CayenneMQTTESP32.h>
#include <WiFi.h>
// WiFi network info.
const char* ssid = “LinksysXXXXX”;
const char* password = “XXXXX”;
char ssidc = “xxxxxxxxx”;
char passwordc = “xxxxxxxxx”;
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “81fb6f60-aea3-11e6-9ce1-xxxx”;
char wifipassword = “3aa367aea0eb680fd4b444573f67cad7c060xxxx”;
char clientID = “2e444380-2d75-11e9-8cb9-732fc93xxxxxx”;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println(“Connecting to WiFi…”);
}
Serial.println(“Connected to the WiFi network”);
Cayenne.begin(username, wifipassword, clientID, ssidc, passwordc);
}
void loop() {
Cayenne.loop();
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
// Some examples of other functions you can use to send data.
Cayenne.celsiusWrite(1, 22.0);
Cayenne.luxWrite(2, 700);
Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}
// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g
//CAYENNE_IN(1)
//for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“Channel %u, value %s”, request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
getValue.setError(“Error message”);
[//getValue.setError](https://getvalue.seterror/)();
}