Skip to main content

esp-protocomm

A Python client for protocomm, Espressif's transport for ESP-IDF unified provisioning: the security1 handshake, the BLE transport, and Wi-Fi provisioning. It talks to any ESP32 device running protocomm, over Bluetooth Low Energy, from a laptop or a server.

Unofficial. Not affiliated with, endorsed by, or supported by Espressif Systems. Portions are adapted from ESP-IDF under the Apache License 2.0; see NOTICE for per-file attribution and a list of the changes made.

Install

pip install esp-protocomm          # the session: handshake, Wi-Fi provisioning
pip install "esp-protocomm[ble]"   # adds the radio (bleak)

The base install needs no Bluetooth stack, so the handshake and the protobuf schemas can be exercised in CI. Only BleTransport requires the extra.

Use

import asyncio
from esp_protocomm import Security1, establish_session, provision_wifi
from esp_protocomm.ble import BleTransport

async def main():
    async with BleTransport("XX:XX:XX:XX:XX:XX") as transport:
        security = await establish_session(transport, Security1(pop="abcd1234"))
        status = await provision_wifi(transport, security, ssid="my-network", passphrase="...")
        print(status)

asyncio.run(main())

The endpoint name-to-UUID map is read from the device's 0x2901 descriptors rather than hardcoded, so a product that registers its own endpoint alongside the standard ones works without changes here.

Scope

What this is: the protocomm session and the standard prov-session / prov-config endpoints.

What it is not: a device's own application commands. Those ride over the session this library establishes, on their own endpoint, and belong in that product's code. Keeping that boundary is why this is a separate library.

Security scheme support is security1 (X25519 key exchange, AES-CTR, proof-of-possession). The protobuf definitions for security0 and security2 are present because they ship together upstream, but only security1 has a client here.

Development

pip install -e ".[dev]"
pytest tests/ -v
ruff check . && ruff format --check .

Tests run against an in-process fake device that implements the device side of the handshake with the same primitives as the client, so they exercise the real key exchange, the real AES-CTR keystream, and the real framing. No radio, no hardware.

Releasing

Publishing uses PyPI Trusted Publishing (OIDC), so there is no API token in this repository and there should not be one. Tag a version and the Release workflow builds, checks that the wheel carries LICENSE and NOTICE, and publishes.

Before the first release, PyPI needs to be told which workflow is allowed to publish. Because the project does not exist there yet, this is a pending publisher at pypi.org/manage/account/publishing:

Field Value
PyPI Project Name esp-protocomm
Owner electrification-bus
Repository name esp-protocomm
Workflow name release.yml
Environment name pypi

Workflow name is the filename, not the name: inside it, and the environment must match the job's environment: key. The pending publisher converts to a normal one on the first successful publish.

git tag v0.1.0 && git push origin v0.1.0

License

Apache-2.0. See LICENSE and NOTICE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esp_protocomm-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

esp_protocomm-0.1.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file esp_protocomm-0.1.0.tar.gz.

File metadata

  • Download URL: esp_protocomm-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for esp_protocomm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 92b36f9f970a93f7f432bb971c00cf5ee0e682e57ee8e4f440097f6dfe00c213
MD5 1da1f69eb879ce416ccd2b4b04a0e681
BLAKE2b-256 3ac9d065fcbd7c25a3d7e294a02c32e5b60a89e004166e73da1fe3e1b2d782ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for esp_protocomm-0.1.0.tar.gz:

Publisher: release.yml on electrification-bus/esp-protocomm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file esp_protocomm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: esp_protocomm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for esp_protocomm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69c2800d904134aff6e36c33cfb746c686c5ca17683804718f572aea727711b2
MD5 216f396dfe78982b931ac6b035a1e176
BLAKE2b-256 3bf70db4202ec44e131765894f33bd05b43270b0ef6274b44589e8ee3f0f7c70

See more details on using hashes here.

Provenance

The following attestation bundles were made for esp_protocomm-0.1.0-py3-none-any.whl:

Publisher: release.yml on electrification-bus/esp-protocomm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page