Hello Gui-O - I'm alive
-
@Sato Hi.
For starters, you could simply use the same topic with /alive appended.
You have a ESP32 device publishing to uuid/alive at some interval. The redundant ESP32 is subscribing to this topic and handling the alive packets. If the packet is not received within the desired time interval, it can react accordingly (send push notification).
Regards,
Klemen -
-
Hello @kl3m3n,
I haven't done any tests yet because I'm waiting for the ESP32 to be delivered.
But could you please take a look to see if the way I describe it below is the right way?
Esp_a
In, uuid_a, alive //publish periodically that it is alive (for Esp redundant)Esp_b
In, uuid_b, alive //publish periodically that it is alive (for Esp redundant)Esp_c
In, uuid_c, alive /publish periodically that it is alive for (Esp redundant)Redundant ESP (must subscribe to all ESPs that are connected, which can be many, right?
mqttClient.subscribe(&Out_a[0]); // subscribe to esp_a alive
mqttClient.subscribe(&Out_b[0]); // subscribe to esp_b alive
mqttClient.subscribe(&Out_c[0]); // subscribe to esp_c alive
"" "" "" "" ""
"" "" "" "" ""
// redundant ESP sends push message to 2 cell phones
// don´t worry, changed some Chars
static const char Push1 = "d4f1c682-16b8-3958-5734-51dc22471e0c/alive"; // publish push to mobile1
mqttClient.publish(&Push1[0], (const char) pushNotification.c_str());static const char Push2 = "e4f1c792-26d8-4958-5764-16dc22471f0c/alive"; // publish push to mobile2
mqttClient.publish(&Push2[0], (const char) pushNotification.c_str());Thank you
Best regards -
When pushing to the phone using MQTT channel...
@Sato said in Hello Gui-O - I'm alive:
"d4f1c682-16b8-3958-5734-51dc22471e0c/alive"
This should not be "/alive" but "/notifications". I think other stuff looks ok!
Regards,
Klemen -
-
Hello @kl3m3n and community,
This is how i try use the Alive function I wanted to implement, but can it make it work.
What i need ist that one Device Esp32 publish a message and a second Device Esp32 receive it.
I know it don't be so, but I'm trying with both tokens to see it anything arrive. I'm a bit confused with this subject.
I have an Esp32 Device named "Test1" registed in the Gui-O App
with these tokens to which I just added /alive
static const char *In2 = "15cab81e-e558-4498-8994-0733c30662f4/alive";
static const char *Out2 = "da853476-386a-8b48-9778-047bd6acf266/alive";This Device named "Test1" publish each minute with these tokens!
aliveNotification = "Hello";
mqttClient.publish(&In2[0], (const char*) aliveNotification.c_str());
mqttClient.publish(&Out2[0], (const char*) aliveNotification.c_str());The other Device Esp32 named "It is Alive" registed in the Gui-O App
which is only used to receive the message published from the Esp32 Device named "Test1"
static const char *In2 = "15cab81e-e558-4498-8994-0733c30662f4/alive"; // Want to subscribe Device "Test1"
static const char *Out2 = "da853476-386a-8b48-9778-047bd6acf266/alive"; //Want to subscribe Device "Test1"mqttClient.subscribe(&In2[0]); //subscribe topic alive - from Device name "Test1"
mqttClient.subscribe(&Out2[0]); //subscribe topic alive - from Device name "Test1"The question is where in the code of the Device name "It is Alive" do I get the message "Hello"?
In the void parseGuioMsg(const String &msg) ???""You have a ESP32 device publishing to uuid/alive""
Must it be used uuid of the App?
I need to use Esp32 to Esp32Can someone help and clarify what I'm doing wrong and indicate how I should do it?
Thanks
Regards -
Hello,
Now I've experimented with using the app's uuid and it works but not always, most of the time the message doesn't arrive. I'm going to keep testing and I'll give feedback.
Is it possible that it's not through the uuid but through the In and Out tokens of the Esp32 devices?
Regards
-
Hello kl3m3n,
Now it's working, I'm not sure why.
I publishing every 30 seconds.
To control failures I send a counter with the message, so far it's 97 and there have been no failures.
I've also tried closing the Gui-O App, forced it to stop and finally disconnected the phone from that uuid, but it's still working.
As I mentioned earlier, I don't know if it's possible to send and receive between esp32Regards
-
@Sato Using MQTT, it is possible to send messages from any device to any device that is connected to the same broker.
Best regards,
Klemen -