NodeMcu to send mqtt message

Hi

Can anyone point me in the right direction. We are having frequent power cuts and I would like to monitor it. My router and server has battery backup. What I want to do is plug in a node mcu to a wall socket which should send an mqtt message every 5 minutes to HA. If the power cuts then HA wont receive the message then I would know that there is no power. Does Tasmota, Esphome or Espeasy have that type of feature?

It should be possible using Tasmota rules.

For ESPHome:

Power your NodeMCU from a 5V plug pack not on the UPS. When the power goes out the status of the NodeMCU becomes unavailable. You can trigger alerts with that.

Espeasy can send MQTT messages as well.