Install the ctrlPi API on a device
pi_ctrlpi_installInstalls or updates the ctrlPi API agent on a Raspberry Pi, configures its service, preserves existing config, and returns sudo commands if passwordless sudo is unavailable.
Instructions
Install or update pi-gpio-api (the ctrlPi API agent) in ~/pi-gpio-api with its install.sh. On a first install, name and api_key are written to ~/pi-gpio-api/config.json (defaults: the device hostname and your-secret-key, the installer's own); an existing config.json is kept and they are ignored. A result with the default key carries a warning. On a Raspberry Pi with passwordless sudo the pi-gpio-api service is then created and started, or restarted; otherwise service is needs_sudo and output holds the sudo commands to run. Can take several minutes (the full package installs FastAPI). Ask the user first and pass confirmed: true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Agent name for a first install. Default: the device hostname. | |
| api_key | No | Agent API key for a first install. Default: your-secret-key (public, so change it). | |
| package | No | lite: the dependency-free server (recommended). full: FastAPI with /docs pages. | lite |
| confirmed | Yes | Must be true after the user explicitly confirms the install. | |
| device_id | Yes | IP address, hostname, MAC address, or device identifier of the target Raspberry Pi / SSH device. |