Reference examples
Firmware under examples/ in this repository.
01_provisioning — factory
HTTPS provision + NVS + optional OTA.
- Set
IOTMER_PROVISION_AUTH_CODEandIOTMER_WORKSPACE_IDin menuconfig - OTA may run after each successful provision
- Example defaults enable
IOTMER_OTA_APPLY_EVEN_IF_SAME_SHAfor 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/meta → config/get → config/resp → config/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 examplesdkconfig.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.