rpi-power-hat(1)

NAME
rpi-power-hat - control power HAT ports, flash images, monitor power/current, and SSH

SYNOPSIS
rpi-power-hat COMMAND [ARGS]
rpi-power-hat help
rpi-power-hat list

DESCRIPTION
rpi-power-hat is a wrapper around utility scripts for the Raspberry Pi Power Control HAT. It manages per-port power, mass-storage gadget boot, image flashing, logging of current/power and SSH access based on per-port configuration.

COMMANDS

get PORT|all
    Show power status for a port or all ports.

set PORT|all 0|1
    Turn power OFF(0)/ON(1) for a port or all ports.

mass-storage PORT [MODEL]
    Boot the connected device as a mass-storage gadget. MODEL: 5 (default), 4, 0. When MODEL is specified, it will be written to the configuration file for the port.

flash-image PORT
    Flash an OS image to the device mapped to PORT, generating a firstrun script, keys and hostname per the configuration. Generates unique hostname and SSH keys, updates config file, and creates SSH client configuration snippets. Keys are stored under /var/lib/rpi-power-hat/keys/

log-current PORT [DURATION] [-s]
    Log current in mA at 100 Hz to console or CSV (with -s).

log-power PORT [DURATION] [-s]
    Log power in mW at 100 Hz to console or CSV (with -s).

ssh PORT
    SSH into the device mapped to PORT using generated keys.

get-hostname PORT [-h]
    Print the current hostname for PORT; with -h, show hostname history entries.

set-hostname PORT NEW_HOSTNAME
    SSH to the device on PORT, set the hostname, and update local configuration. Updates both hostname and ssh_host in config file upon success.

OPTIONS
Most subcommands support -h, --help or -help.

FILES

/etc/rpi-power-hat/ports.conf
    Per-port settings: hostname, username, ssh_host, model, image_path, etc.

/etc/rpi-power-hat/network.conf
    Per-port Wi-Fi settings: wlan_ssid, wlan_password.

/etc/rpi-power-hat/hardware.conf
    Hardware mappings for hwmon and GPIO per port.

/var/lib/rpi-power-hat/
    Data directory for images, keys, history, and working files.

EXAMPLES

Turn on port B1:
    rpi-power-hat set B1 1

Gadget boot Pi 5 on B2:
    rpi-power-hat mass-storage B2 5

Flash latest image to T1:
    rpi-power-hat flash-image T1

Stream current for 30s and save CSV:
    rpi-power-hat log-current B1 30 -s

SEE ALSO
gpiod(1), i2c-tools(8), rpi-imager(1)

AUTHOR
Raspberry Pi Power HAT contributors