Detect a Power Outage

You can try this driver. Although it was written to handle Tuya 'specifics', it works also with generic Zigbee outlets - I have tested it with OSRAM and IKEA outlets.
It has a 'presence' capability that you can use to trigger your automations from RM rules.