Previous
Reuse configuration
Set up zero-touch provisioning so machines you ship or deploy automatically configure themselves on first boot. You install viam-agent on the device during manufacturing, define a configuration in a defaults file, and when someone powers on the device and provides network credentials, the machine downloads and applies its configuration from a fragment.
Use provisioning when you are manufacturing or deploying multiple devices that need to come online with a predefined configuration without manual setup per device. Provisioning is designed for:
If you are setting up a small number of machines manually, you can skip provisioning and configure each machine directly in the Viam app.
viam-agent pre-installed and a defaults file (viam-defaults.json) that specifies a fragment and provisioning options.viam-agent checks for network connectivity. If no known network is available, it enters provisioning mode.viam-agent creates a WiFi hotspot (or advertises a Bluetooth service) so the end user can provide network credentials.viam-agent connects to the provided network, registers the machine with Viam (using the fragment from the defaults file), and downloads viam-server and the configured software.Create a file called viam-defaults.json that defines the provisioning behavior. At minimum, specify a fragment_id.
{
"network_configuration": {
"manufacturer": "your-company",
"model": "your-product",
"fragment_id": "your-fragment-id",
"hotspot_prefix": "your-product-setup",
"hotspot_password": "viamsetup"
}
}
All fields are optional except where noted.
| Field | Type | Default | Description |
|---|---|---|---|
manufacturer | string | "viam" | Displayed on the captive portal or mobile app during setup. |
model | string | "custom" | Displayed on the captive portal or mobile app during setup. |
fragment_id | string | — | The fragment to apply to machines provisioned with this defaults file. Required when using the mobile app for provisioning. |
hotspot_interface | string | First 802.11 device | The network interface to use for the provisioning hotspot. |
hotspot_prefix | string | "viam-setup" | Prepended to the device hostname to create the hotspot SSID: {prefix}-{hostname}. |
hotspot_password | string | "viamsetup" | Password for the WiFi hotspot or Bluetooth connection. When using the mobile app, must be "viamsetup". |
disable_captive_portal_redirect | boolean | false | When true, only *.setup domains redirect to the portal, preventing mobile devices from auto-opening it. Set to true when using a mobile app for provisioning. |
disable_bt_provisioning | boolean | false | When true, disables Bluetooth provisioning. The machine will not advertise Bluetooth services. |
disable_wifi_provisioning | boolean | false | When true, disables WiFi hotspot provisioning. |
bluetooth_trust_all | boolean | false | When true, accepts all Bluetooth pairing requests without requiring an unlock from a mobile app. Only needed for Bluetooth tethering. |
turn_on_hotspot_if_wifi_has_no_internet | boolean | false | When true, the device re-enters provisioning mode if the connected WiFi network has no internet access. |
offline_before_starting_hotspot_minutes | integer | 2 | Minutes to wait for a known network before entering provisioning mode. Increase for environments where the WiFi router boots slowly. |
user_idle_minutes | integer | 5 | Minutes before considering a provisioning user idle and resuming normal connection attempts. |
retry_connection_timeout_minutes | integer | 10 | Minutes before exiting provisioning mode to try other connection methods. Provisioning mode restarts if connectivity does not improve. |
wifi_power_save | boolean | — | When set, explicitly enables or disables WiFi power save for all connections managed by NetworkManager. If not set, the system default applies. |
device_reboot_after_offline_minutes | integer | 0 | When set to a positive number, reboots the device after this many minutes offline in hotspot mode. 0 disables. |
Download and run the preinstall script to install viam-agent and the defaults file onto your device or OS image.
wget https://storage.googleapis.com/packages.viam.com/apps/viam-agent/preinstall.sh
chmod 755 preinstall.sh
curl -O https://storage.googleapis.com/packages.viam.com/apps/viam-agent/preinstall.sh
chmod 755 preinstall.sh
Run the script from the same directory that contains your viam-defaults.json file:
sudo ./preinstall.sh
The script picks up viam-defaults.json from the current directory and copies it along with viam-agent to the appropriate locations on the device. For Raspberry Pi, it modifies the first-run script to start viam-agent on boot.
To install onto an external rootfs (for example, a mounted SD card image):
sudo ./preinstall.sh /path/to/rootfs
Power on the device. viam-agent starts automatically and:
offline_before_starting_hotspot_minutes (default: 2 minutes), creates a WiFi hotspot named {hotspot_prefix}-{hostname}.The end user completes setup by following the end-user device setup instructions.
After the end user provides network credentials:
viam-agent registers the machine with Viam and applies the fragment.viam-server is downloaded and started.Check the fleet dashboard at app.viam.com/fleet/machines to confirm the machine is online.
To configure fallback WiFi networks that the device can connect to without going through provisioning mode, add an additional_networks section to the defaults file:
{
"network_configuration": {
"fragment_id": "your-fragment-id",
"hotspot_prefix": "your-product-setup"
},
"additional_networks": {
"office-wifi": {
"type": "wifi",
"ssid": "OfficeNetwork",
"psk": "office-password",
"priority": 30
},
"factory-wifi": {
"type": "wifi",
"ssid": "FactoryNetwork",
"psk": "factory-password",
"priority": 20
}
}
}
Networks with higher priority values are preferred. See system settings for the full network configuration reference.
/etc/viam.json and reboot.viam-agent, which runs on Linux systems with NetworkManager. It is not available for microcontrollers.hotspot_password must be "viamsetup".Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!