1# ESP Provisioning Tool
2
3# NAME
4`esp_prov` - A python based utility for testing the provisioning examples over a host
5
6# SYNOPSIS
7
8```
9python esp_prov.py --transport < mode of provisioning : softap \ ble \ console > [ Optional parameters... ]
10```
11
12# DESCRIPTION
13
14Usage of `esp-prov` assumes that the provisioning app has specific protocomm endpoints active. These endpoints are active in the provisioning examples and accept specific protobuf data structures:
15
16| Endpoint Name | URI (HTTP server on ip:port) | Description                                               |
17|---------------|------------------------------|-----------------------------------------------------------|
18| prov-session  | http://ip:port/prov-session  | Security endpoint used for session establishment          |
19| prov-config   | http://ip:port/prov-config   | Endpoint used for configuring Wi-Fi credentials on device |
20| proto-ver     | http://ip:port/proto-ver     | Version endpoint for checking protocol compatibility      |
21| prov-scan     | http://ip:port/prov-scan     | Endpoint used for scanning Wi-Fi APs                      |
22| custom-config | http://ip:port/custom-config | Optional endpoint for configuring custom credentials      |
23
24
25# PARAMETERS
26
27* `--help`
28    Print the list of options along with brief descriptions
29
30* `--verbose`, `-v`
31    Sets the verbosity level of output log
32
33* `--transport <mode>`
34    Three options are available:
35    * `softap`
36        For SoftAP + HTTPD based provisioning. This assumes that the device is running in Wi-Fi SoftAP mode and hosts an HTTP server supporting specific endpoint URIs. Also client needs to connect to the device softAP network before running `esp_prov`
37    * `ble`
38        For BLE based provisioning (Linux support only. In Windows/macOS it redirects to console). This assumes that the provisioning endpoints are active on the device with specific BLE service UUIDs
39    * `console`
40        For debugging via console based provisioning. The client->device commands are printed to STDOUT and device->client messages are accepted via STDIN. This is to be used when device is accepting provisioning commands on UART console.
41
42* `--ssid <AP SSID>` (Optional)
43    For specifying the SSID of the Wi-Fi AP to which the device is to connect after provisioning. If not provided, scanning is initiated and scan results, as seen by the device, are displayed, of which an SSID can be picked and the corresponding password specified.
44
45* `--passphrase <AP Password>` (Optional)
46    For specifying the password of the Wi-Fi AP to which the device is to connect after provisioning. Only used when corresponding SSID is provided using `--ssid`
47
48* `--sec_ver <Security version number>`
49    For specifying version of protocomm endpoint security to use. For now two versions are supported:
50    * `0` for `protocomm_security0`
51    * `1` for `protocomm_security1`
52
53* `--pop <Proof of possession string>` (Optional)
54    For specifying optional Proof of Possession string to use for protocomm endpoint security version 1. This option is ignored when security version 0 is in use
55
56* `--service_name <name> (Optional)
57    When transport mode is ble, this specifies the BLE device name to which connection is to be established for provisioned.
58    When transport mode is softap, this specifies the HTTP server hostname / IP which is running the provisioning service, on the SoftAP network of the device which is to be provisioned. This defaults to `192.168.4.1:80` if not specified
59
60* `--custom_config` (Optional)
61    This flag assumes the provisioning app has an endpoint called `custom-config`. Use `--custom_info` and `--custom_ver` options to specify the fields accepted by this endpoint
62
63* `--custom_info <some string>` (Optional) (Only use along with `--custom_config`)
64    For specifying an information string to be sent to the `custom-config` endpoint during provisioning
65
66* `--custom_ver <some integer>` (Optional) (Only use along with `--custom_config`)
67    For specifying a version number (int) to be sent to the `custom-config` endpoint during provisioning
68
69# AVAILABILITY
70
71`esp_prov` is intended as a cross-platform tool, but currently BLE communication functionality is only available on Linux (via BlueZ and DBus)
72
73For android, a provisioning tool along with source code is available [here](https://github.com/espressif/esp-idf-provisioning-android)
74
75On macOS and Windows, running with `--transport ble` option falls back to console mode, ie. write data and target UUID are printed to STDOUT and read data is input through STDIN. Users are free to use their app of choice to connect to the BLE device, send the write data to the target characteristic and read from it.
76
77## Dependencies
78
79This requires the following python libraries to run (included in requirements.txt):
80* `future`
81* `protobuf`
82* `cryptography`
83
84Run `pip install -r $IDF_PATH/tools/esp_prov/requirements.txt`
85
86Note :
87* The packages listed in requirements.txt are limited only to the ones needed AFTER fully satisfying the requirements of ESP-IDF
88* BLE communication is only supported on Linux (via Bluez and DBus), therefore, the dependencies for this have been made optional
89
90## Optional Dependencies (Linux Only)
91
92These dependencies are for enabling communication with BLE devices using Bluez and DBus on Linux:
93* `dbus-python`
94
95Run `pip install -r $IDF_PATH/tools/esp_prov/requirements_linux_extra.txt`
96
97# EXAMPLE USAGE
98
99Please refer to the README.md files with the examples present under `$IDF_PATH/examples/provisioning/`, namely:
100
101* `ble_prov`
102* `softap_prov`
103* `custom_config`
104* `console_prov`
105
106Each of these examples use specific options of the `esp_prov` tool and give an overview to simple as well as advanced usage scenarios.
107