Automating UPS Shutdown / Restart with NUT on Raspberry Pi


I have a Raspberry Pi 3B+ with Home Assistant installed on it. I’ve connected my UPS (Eaton Ellipse ECO 1600) to the Raspberry via USB and am monitoring it through the NUT integration/addon. What I’d like to do is properly shut down Home Assistant and the UPS output, and then restart everything as soon as the power comes back.

I’ve thought of an example of automation (I don’t know if it’s possible):

1 - When there is a power outage and the UPS battery reaches 10%, send a notification to signal the shutdown of Home Assistant (this part is OK, I can send a message via Telegram).

This is where I don’t know what to do:

2 - After sending the message, send a signal to the UPS to cut the power output (load) after, for example, 120 seconds. During this time (the 120 seconds) Home Assistant would be shutting down.

3 - Once Home Assistant is shut down, and the 120 seconds are ended, the UPS stops its output (which cuts off the Raspberry).

4 - When the power comes back, the UPS output comes back on and the Raspberry restarts.

Is this possible?

Thank you :smiley: