CyrylD
September 7, 2023, 4:02pm
1
Hi,
I have 2 esp32 connected to the IoT Cloud and one of them is connected to an UPS (the second one).
My goal is to find a way to detect (on the second esp32) when the first esp32 (that's not connected to an UPS) is not connected to the IoT Cloud.
I've search on the internet but I can't find something like this.
Does anyone have an idea how to do this (with codes lines ?) ?
Thanks a lot for your answer.
Hey!
I think there might be several ways to implement what you describe (if I understand correctly your use case).
One simple option could be the following
Define an integer variable in Device#1 (UPS) called uptime
(or whatever name you want)
Set the Variable Update Policy to Periodically and define a period o N seconds.
Device an integer variable in Device#2 called dev1_uptime
which is synced with the first one
Use the " Sync with other thing " option
More info in any of these tutorials: tutorial 1 and tutorial 2
In the sketch of Device#1, set uptime
to millis() inside your loop()
--> uptime = millis();
In the sketch of Device#1, you can check the value of dev1_uptime
(as it is synced with uptime
and it will automatically receive its value)
If the value has not changed for Nx2 seconds, it can mean that the device went down or had some connectivity problems
I hope the process is clear and I hope this helps.
1 Like
CyrylD
September 8, 2023, 8:29pm
3
Oh thanks a lot !
I hadn't think about using this Sync option ! It should work perfectly .
Have a good day
system
Closed
March 6, 2024, 8:30pm
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.