TrueNAS shutdown by UPS via ethernet

This is what Kris had to say about shutdown on truenas.

Below is an example of the call and can be done over ssh, from a script, or probably from cron on a schedule. I think you can also use the TrueNAS API directly over WebSocket if desired. If you wish to go that route then the API documentation is available within your TrueNAS GUI under Credentials > Users > API Keys > API Docs button

Using the Command Line (`midclt`) to shutdown
The simplest method is to SSH into the TrueNAS system and execute the `midclt` command with the `system.shutdown` argument. This can be automated.

* **Command:** `/usr/bin/midclt call system.shutdown [reason]`
* **Example:** `/usr/bin/midclt call system.shutdown "scheduled_nightly_shutdown"`

Recent versions of TrueNAS (e.g., TrueNAS Scale 25.04 and later) require a `reason` argument for the command to work.