One of the more satisfying homelab projects has been the UPS shutdown controller.
The setup monitors a CyberPower UPS over SNMP and drives a controlled shutdown sequence when the power situation stops looking recoverable. Rather than treating the environment as a single block, the automation steps through the dependencies in order.
The rough shape is:
- monitor UPS state and battery condition
- notify early through
ntfy - shut down Talos workloads cleanly
- shut down Proxmox nodes in the right order
- avoid turning a temporary outage into unnecessary disruption
This ended up as a Python state machine running in an LXC container, which was a much better fit than trying to cram all of the logic into ad hoc shell scripts.
The value in writing this down properly will be less about the code and more about the design constraints: sequencing, timeouts, failure handling, and what should happen when the UPS telemetry itself becomes uncertain.