→Home Lab | →Back | →Gateway

5 Network Wide Power Fail Infrastructure W Nut

Smart Home Edge Systems

(smart-home-edge-systems.us)

Configuring a a Network Wide Power Fail Infrastructure using Network UPS Tool.

For a Network UPS Tools (NUT) deployment where the UPS is physically connected via USB, to the main Promox server you have two primary options within your Proxmox VE topology.

Because the UPS is a critical infrastructure component that dictates the shutdown sequence of your entire physical host (including all your VMs and LXCs), the ideal architecture is to install the NUT server directly on the Proxmox Host (PVE Host, 192.168.86.250).

UPS Direct Connection to the PVE Host

In this configuration, the physical USB cable goes from the UPS into the Kamrui Mini PC, and the bare-metal Proxmox Debian layer handles the driver (usbhid-ups).

Why this is better than creating a new LxC:

  • Fail-Safe Shutdowns: If the battery runs critically low, the host has direct control to gracefully stop your LXCs/VMs and then safely power itself down. If the NUT server is inside a virtualized container and that container crashes or hangs, the host won't receive the shutdown signal.

  • Network Independence: If your internal virtual switch (vmbr0) or local routing encounters an issue during a power event, the host can still talk to the UPS locally over the USB bus without needing network layers to stay up just to read its own power status.

  • Server-Client Topology: The PVE host acts as the NUT Master (Server). It can then easily serve data across 192.168.86.0/24 to NUT Slaves (Clients) like your Home Assistant OS instance (VM 101) for dashboards and automations.

Here is the complete textual and structural layout of your dual-UPS infrastructure.

This design separates your core computing layer (Proxmox) from your network and storage dependencies, ensuring your infrastructure stays alive and manageable for as long as possible during a power event.

๐Ÿข UPS 1: The Compute Layer

Dedicated to: Proxmox VE Host (Kamrui Mini PC)

  • Physical Data Link: A USB communication cable connects directly from UPS 1 into a USB port on the Proxmox Host.

  • Role: This UPS only has to power the low-draw Mini PC. Because it isn't burdened by spinning hard drives or power-hungry PoE cameras, it provides a maximum runtime buffer for the Proxmox host to execute its network watchdog scripts and manage the cluster shutdown.

  • Control Signaling:

    • The Proxmox Host runs the NUT Master (Server) daemon. It monitors the battery status of UPS 1 over the USB cable.

    • It shares this power status out over the local network via Ethernet.

๐ŸŒ UPS 2: The Infrastructure, Storage & Network Layer

Dedicated to: All supporting equipment and network appliances.

  • Power Connections:

    1. Internet Modem (Plugged into the SmartThings Z-Wave Smart Plug โ”€โ”€โ–บ UPS 2 Battery Outlets)

    2. Wi-Fi Router / EERO Nest Primary Node

    3. Core Network Switch

    4. PoE Network Switches (Powering your IP surveillance cameras)

    5. Synology NAS 1 (Surveillance Station storage)

    6. Synology NAS 2 (NFS/Data storage)

    7. SmartThings Hub

  • Role: Keeps your entire local network fabric, Wi-Fi mesh, smart home mesh, and data storage fully active.

  • Control Signaling:

    • The Synology NAS units are configured as NUT Slaves (Clients).

    • They continuously poll the Proxmox Host (192.168.86.250) over the local Ethernet network.

    • Even though they are plugged into UPS 2 for power, they listen to the shutdown command broadcast by Proxmox. When Proxmox reports a power failure, the Synologies execute their 2-to-5-minute countdown to enter Safe Mode, saving their disk volumes from corruption before UPS 2 can run out of juice.

๐Ÿ”€ Physical Data & Network Topology Map

text

======================= ELECTRICAL POWER LINES =======================

[Wall Outlet A] โ”€โ”€โ–บ [ UPS 1 (Compute) ] โ”€โ”€โ–บ Kamrui Mini PC (Proxmox Host)

โ”‚

[Wall Outlet B] โ”€โ”€โ–บ [ UPS 2 (Network) ] โ”€โ”€โ–บ Power Strip / PDU

โ”œโ”€โ”€โ–บ SmartThings Z-Wave Plug โ”€โ”€โ–บ Internet Modem

โ”œโ”€โ”€โ–บ Wi-Fi Router / EERO Nodes

โ”œโ”€โ”€โ–บ Core Network Switch

โ”œโ”€โ”€โ–บ PoE Camera Switches

โ”œโ”€โ”€โ–บ Synology NAS (Surveillance)

โ”œโ”€โ”€โ–บ Synology NAS (NFS Data)

โ””โ”€โ”€โ–บ SmartThings Hub

======================= LOGICAL AND DATA PATHS =======================

[ UPS 1 ] โšกโ”€โ”€โ”€(USB Monitoring Cable)โ”€โ”€โ”€โ–บ [ Proxmox Host (192.168.86.250) ]

(NUT Master Service / Runs Script)

โ”‚

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”

โ–ผ (Ethernet Path - local) โ–ผ (Wi-Fi Path - internet)

[ Core Network Switch ] [ Wi-Fi Router / EERO Mesh ]

โ”‚ โ”‚

โ”œโ”€โ”€โ–บ [ Synology NAS Units ] (NUT Slaves) โ””โ”€โ”€โ–บ [ Internet / Cloud ]

โ”‚ โ””โ”€โ–บ Listens for ONBATT signal โ–ฒ

โ”‚ โ””โ”€โ–บ Enters Safe Mode in 2-5 mins โ”‚ (API Commands)

โ”‚ โ”‚

โ””โ”€โ”€โ–บ [ SmartThings Hub ] โ”€โ”€โ”€(Z-Wave Mesh)โ”€โ”€โ”€โ–บ [ SmartThings Z-Wave Plug ] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ””โ”€โ–บ Unaffected by local Wi-Fi drop โ””โ”€โ–บ Cuts power to Modem for 60s

Use code with caution.

๐Ÿ’ก Why This Dual Layout Works Best For Your Script

  1. Isolated Troubleshooting: When your script detects a dropped internet connection on the wlan0 interface, it cycles the SmartThings Z-Wave plug. Because the SmartThings Hub and Core Switch are on UPS 2, they remain completely powered up and operational. The Z-Wave command moves locally from the hub to the plug seamlessly.

  2. Proxmox Safety: If the modem power-cycle script runs while a true utility power outage is occurring, your Proxmox server won't abruptly lose power when the modem reboots, because Proxmox's power supply is completely isolated on UPS 1.

How to structure it in your Network Map

If you go with the recommended Host-as-Master approach, your configuration won't require spinning up a new container ID, keeping your 32GB RAM footprint exactly where it is.

Here is how the data and shutdown signaling will flow through your existing layout:

[ Physical UPS ] โ”€โ”€(USB Cable)โ”€โ”€โ–บ [ PROXMOX VE HOST (192.168.86.250) ]

โ”‚ (Runs NUT Server / Master)

โ”‚

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”

โ–ผ (LAN Broadcast) โ–ผ (LAN Broadcast)

โ”œโ”€โ”€โ–บ [ VM 101 ] HOME ASSISTANT [ Other Network Hosts ]

โ”‚ (Runs NUT Client / Integration) (NAS, Desktops, etc.)

โ”‚ - Triggers Smart Home Alerts - Graceful automated shutdowns

โ”‚ - Logs Battery Runtime Metrics

Resource Impact:

  • CPU/RAM: Negligible. The nut-server daemon uses less than 10โ€“20 MB of RAM and essentially 0% CPU overhead, fitting perfectly within the 2GB RAM / 2 Threads overhead you already wisely reserved for your Proxmox host.

Promox NUT Server will tell synology to sleep, I want it to shutdown on LL. i want it to poll wifi. *(Promox has ethernet and wifi). Promox NUT will run a restart script that cycles internet ( wifi ) and then wait 1 minute. Then it will cycle smartthings

This advanced, multi-network automation is completely possible using your Linux machine as the central coordinator. Since your Linux box has both Ethernet and Wi-Fi, we can isolate the networks: Ethernet handles your local infrastructure (Synology and SmartThings), while Wi-Fi tests and handles the internet recovery.

Here is the complete blueprint to orchestrate this logic flow.


To make this reliable, you must ensure your Linux routing table doesn't get confused by having two active network interfaces.

  • Ethernet (eth0): Hardwired to your local network switch. This interface must be configured without a default gateway so it only handles local IP traffic (talking to Synology, SmartThings, and your UPS).

  • Wi-Fi (wlan0): Connected to your main Wi-Fi network. This interface must hold the default gateway, forcing all external internet traffic (pings to the outside world) to go through the Wi-Fi chip.


As configured earlier, your Linux server runs the NUT master service.

  1. Synology Standby: In your Synology DSM interface (Control Panel > Hardware & Power > UPS), set the time-based countdown to a short window (e.g., 2 to 5 minutes).

    • When power drops, the Linux NUT server broadcasts the power failure. The Synology countdown triggers, safely unmounting its drives and slipping into its low-power standby "Safe Mode."
  2. Linux Low Battery Shutdown: Your Linux server ignores the short timer and remains fully operational on battery. It will continue running the internet monitoring script below until the UPS battery drops to its physical low-voltage threshold, at which point the NUT daemon executes its native SHUTDOWNCMD.


This script runs on your Linux box. It forces all ping tests to route through your Wi-Fi interface. If the internet fails, it drops your Wi-Fi connection to attempt a local software reset, waits, and then instructs your SmartThings Z-Wave plug to cycle.

  1. Create the script file on your Linux machine:

bash

sudo nano /usr/local/bin/network_watchdog.sh

Use code with caution.

  1. Paste the following automated script. Note: Ensure you update your SmartThings API Token, Z-Wave Plug Device ID, and your local Wi-Fi interface name (usually wlan0).

bash

#!/bin/bash

# Configuration Parameters

TARGET_IP="8.8.8.8"

WIFI_INTERFACE="wlan0" # Change to your actual Linux Wi-Fi interface name

ST_TOKEN="YOUR_SMARTTHINGS_BEARER_TOKEN"

ST_DEVICE_ID="YOUR_Z_WAVE_PLUG_DEVICE_ID"

echo "Executing Network Watchdog..."

# 1. Force the ping to route EXCLUSIVELY through the Wi-Fi interface

if ! ping -I "$WIFI_INTERFACE" -c 3 -W 5 "$TARGET_IP" > /dev/null 2>&1; then

echo "Internet failure detected on Wi-Fi interface!"

# 2. Cycle local Linux Wi-Fi interface first to clear local software locks

echo "Restarting Linux Wi-Fi interface..."

sudo ip link set "$WIFI_INTERFACE" down

sleep 10

sudo ip link set "$WIFI_INTERFACE" up

# Wait 45 seconds for Linux to reconnect to the Wi-Fi access point

echo "Waiting for Wi-Fi reconnection..."

sleep 45

# 3. Re-test internet after local Wi-Fi reset. If still dead, proceed to hardware cycle.

if ! ping -I "$WIFI_INTERFACE" -c 3 -W 5 "$TARGET_IP" > /dev/null 2>&1; then

echo "Internet still dead. Initiating SmartThings Z-Wave power cycle..."

# 4. Turn off the SmartThings Z-Wave plug powering your router/modem

curl -X POST -s -H "Authorization: Bearer $ST_TOKEN" -H "Content-Type: application/json" \

-d '{"commands": [{"component": "main", "capability": "switch", "command": "off"}]}' \

https://smartthings.com > /dev/null

# 5. Wait exactly 1 minute (60 seconds) as requested

echo "Modem/Router powered off. Waiting 60 seconds..."

sleep 60

# 6. Turn the SmartThings Z-Wave plug back ON

echo "Powering Modem/Router back on via SmartThings..."

curl -X POST -s -H "Authorization: Bearer $ST_TOKEN" -H "Content-Type: application/json" \

-d '{"commands": [{"component": "main", "capability": "switch", "command": "on"}]}' \

https://smartthings.com > /dev/null

echo "Power cycle complete. Allowing network time to boot..."

else

echo "Local Linux Wi-Fi cycle resolved the issue. Internet restored."

fi

else

echo "Internet connection on Wi-Fi is perfectly healthy."

fi

Use code with caution.

  1. Save and close the file (Ctrl+O, Enter, Ctrl+X), then make it executable:

bash

sudo chmod +x /usr/local/bin/network_watchdog.sh

Use code with caution.


To give your modem and router plenty of time to finish booting up after a hard reset, configure this script to run every 15 minutes.

  1. Open your system's automation scheduler:

bash

crontab -e

Use code with caution.

  1. Add this execution rule to the very bottom of the file:

text

*/15 * * * * /usr/local/bin/network_watchdog.sh

Use code with caution.


Because the SmartThings command travels over the internet, a critical safety issue arises: If your modem is completely locked up, the internet is down, meaning the Linux box cannot send the "Turn ON" command to SmartThings via the cloud API.

To prevent your network from being permanently stuck in an "OFF" state, you must change a hardware parameter on your Z-Wave plug.

  1. Open your SmartThings app and locate your Z-Wave plug.

  2. Go to its Settings / Device Options.

  3. Look for a setting called "Auto Turn-On Timer" or "Auto-Off Disabled / Auto-On Enabled" (varies by brand like Zooz or Aeotec).

  4. Set the plug to automatically turn itself back ON after 60 seconds if it ever receives an OFF command.

By enabling this hardware-level feature on the plug itself, the Linux box only needs to successfully transmit the initial "OFF" command while the internet is failing. Even if the internet cuts out immediately after, the Z-Wave plug's internal firmware countdown will guarantee your router turns back on 60 seconds later.