Library / ESP32

libscadable is the native C library you link into your ESP32 firmware. You ship your own code in your own repo. The library handles the cloud plumbing.

#include "scadable.h"

void app_main(void) {
    wifi_up();                // your WiFi setup
    scadable_init(NULL);      // reads cert + namespace from NVS
    scadable_connect();       // non-blocking; auto-reconnects
    scadable_publish(SCADABLE_CH_HELLO, "world", 5, 1);
}

Provisioning happened at flash time (the SCADABLE web flasher wrote the cert into NVS). On boot, your firmware calls scadable_init and scadable_connect, and the device shows up in the dashboard. First message lands in the dashboard within roughly 30 seconds of the device powering on with WiFi reachable.

What you get

Linking libscadable and pushing a git tag is enough to get all of this:

  • Managed MQTT broker. mTLS with per-device certs, auto-rotation at 18h of a 24h cert lifetime, exponential-backoff reconnect.
  • Structured log streaming. SCADABLE_LOG_INFO("...") shows up in the dashboard's live log view, with file and line, batched on a configurable cadence.
  • Typed telemetry. Metrics declared in .scadable/digital-twin/*.toml become SCADABLE_METRIC_* enums. Typo'd names are a compile error, not a silent runtime drop.
  • Signed OTA updates. git tag v1.0.1 && git push --tags triggers a build. Device receives SCADABLE_EVT_OTA_AVAILABLE. Library applies the update, validates boot, rolls back on failure.
  • Remote diagnostics. Declare a YAML test, write a SCADABLE_TEST(name, ctx) function. Operators run it from the dashboard. Three-state result (pass / pass-with-warn / fail), fingerprinted for fleet-wide grouping.
  • Env vars and secrets. Set values in the dashboard. Read them in firmware via scadable_env_get / scadable_secret_get. Updates flow live, no re-deploy.

Pages in this section

Compatibility

  • ESP-IDF >= 5.1. Pulled automatically via the IDF Component Registry.
  • Targets in production today: esp32 and esp32-s3 (both with the gateway-provisioning v0.1.1 captive-portal bootstrap firmware).
  • Targets the library compiles for but onboarding isn't ready: esp32-c3, esp32-c6. You can flash these via Direct mode with hand-entered WiFi creds, but no captive portal yet. Roadmap.
  • License: Apache 2.0. Source: scadable/libscadable.

Full hardware support matrix on Supported devices. Linux gateways (Pi, x86, ARM) ship via the older gateway-linux binary — same broker, different code path. Other MCU platforms (STM32, nRF, RP2040) port as customers ask.