Automation to check how often MQTT messages are sent

Hi everyone,
I’ve about 10 arduinos scattered all over the home with many sensors connected.
They communicate through MQTT with Home assistant.
It sometimes happens that some sensors or arduinos stop working/communicating.
Now every arduino has a buzzer that sounds when there’s a problem. Unfortunately, it’s quite annoying when it happens in the middle of the night…
Consequently, I want to check that everything is ok from HA.
How can I create an automation that checks the time spent between 2 messages?
For example: every arduino should send a MQTT message every 60 seconds, I’d like to create an automation that triggers when the time spent is more than 180 seconds.

Thanks in advance!

Have a look at implementing last will and testament (LWT) mqtt messaging on your arduinos.

You can then automate sending messages if one of them goes off line unexpectedly.

https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament/

It might be a good alternative so than I can create simple automation on a flag status.
What does it happen when a sensor connect and disconnect multiple times (wifi connection not good)?
Is the LWT message sent anytime or if the sensor connects within the keep-alive period nothing will be sent?

Thanks!