I'm posting this here because I'm feeling stuck and could really use some guidance. Hopefully, someone has a hint about what's going on...
In this project, I have a mesh network with ESP32 using PainlessMesh. This mesh network connects to another ESP32 that acts as the Root/Gateway, which then connects to the Wi-Fi router for internet access.
The gateway serves as the interface between the mesh and AWS IoT Core Shadow.
So far so good..
I can successfully publish from the AWS console and from the ESP side without any problem.
The issue arises when I attempt to send a 'get' message from the ESP side using:
client.publish(shadow_get_topic, "{}");
I can see on the AWS Console that the message is received in the topic: $aws/things/THING/shadow/get
This should return a message on the topic "get/accepted", but I don't receive any response from AWS.
Here’s my getState function:
void getState() {
Serial.println();
Serial.println("getState()");
if (client.publish(shadow_get_topic, "{}")) {
Serial.println("Getting state from AWS IoT.");
delay(100);
client.loop();
mesh.update();
} else {
Serial.println("Failed to request state.");
}
}
As you can see, right after sending the 'get' message, I include:
delay(100);
client.loop();
mesh.update();
I’ve tried playing around with delays and calling client.loop() and mesh.update(), but so far, nothing has worked.
// both are called in the main loop
void loop()
{
client.loop();
mesh.update();
}
If anyone could shed some light on what might be going wrong, I would greatly appreciate it!