Skip to main content

Reference examples

Firmware under examples/ in this repository.

01_provisioning — factory

HTTPS provision + NVS + optional OTA.

  • Set IOTMER_PROVISION_AUTH_CODE and IOTMER_WORKSPACE_ID in menuconfig
  • OTA may run after each successful provision
  • Example defaults enable IOTMER_OTA_APPLY_EVEN_IF_SAME_SHA for forced re-flash workflows

02_telemetry — field

MQTT telemetry using stored NVS session.

  • Leave auth code empty after first provision
  • Log: provision skipped (no auth code; using stored session)
  • Flow: iotmer_connect() → subscribe → publish

Ship this binary without embedding the factory API key.

03_lwt_presence — presence

MQTT retained presence + LWT on {workspace_slug}/{device_key}/presence:

{"status":"online","ts":1748000000}
{"status":"offline","ts":0}

04_config — config protocol

Pull config over MQTT:

config/metaconfig/getconfig/respconfig/status

See MQTT Config Protocol.

05_ble_json — BLE JSON

NimBLE GATT transport for UTF-8 JSON. Demo implements ping, wifi.set, wifi.clear.

  • Enable CONFIG_IOTMER_BLE=y (see example sdkconfig.defaults)
  • PC client: examples/05_ble_json/pc_ble_client (Python + Bleak)
  • Wire format: BLE JSON channel, BLE provisioning

Build any example

cd examples/02_telemetry
idf.py set-target esp32c3
idf.py menuconfig # Component config → IOTMER
idf.py build flash monitor

Use sdkconfig.defaults in CI. Never commit production secrets to a public repo.