Hello Gui-O - I'm alive
-
Hello Kl3m3n and community,
Hello Gui-O - I'm alive
I can't remember if I've already asked this question on the forum.
For certain emergency devices and others that monitor specific crucial functions in equipments, it is necessary for these devices to send information that identifies them to the platform they are running on, at set intervals, such as every 48 or 72 hours, as a sign that they are "alive".
This information can be their In or Out Token or another unique identifier for each device that adapts to this functionality.The platform continuously checks these "I'm alive" signals from the devices and, if it detects any failure in the delivery of the signal as it has exceeded the established period, it notifies the application which device has failed to deliver.
This function is valuable for identifying IoT devices that have been installed but are not working, whether due to malfunctions or other factors, allowing for on-site analysis.
There's no point in having equipment monitoring failures if there's a problem with the equipment itself and it goes unnoticed in terms of operation.
I'd like to bring up this topic to see if anyone has any ideas about whether it's possible and the best way to implement it.
Regards
-
Hello kl3m3n and community,
I've been thinking about the question I asked about Alive and I've designed something for you to see if it might work. I think kl3m3n will be the one who can best answer this and maybe even help.
Regards
-
@Sato Hi!
I think the best way to achieve this is to use a redundant ESP32 just for "alive" functionality. Push notifications can than be used to deliver the failure messages to the Android device even if GUI-O app is not running (as they run on top of Google messaging service).
But, GUI-O app cannot monitor this, because:
-
It can only connect to a single device at a time. It does not make sense that multiple devices control a single GUI. Major changes to logic and app functionality would be needed.
-
It cannot run reliably in the background due to Android process handling. App can be killed anytime if the Android OS deems it necessary.
Best regards,
Klemen -
-
Hello @kl3m3n,
I also think that the solution is a redundant ESP32 that will only serve to receive and process the periodic Alive signals, and if one fails, it will send an IoT notification with the ID of the failed device.
As such, it seems possible. What I still don't know how to do is create this subscription token of Alive channel to the redundant ESP32. Could you help with a example?Thank you
Best regards
-
@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 -