Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Go Report Card

Call firmware functions from the cloud.

smart-lights uses conduit v1 to switch room lights from the cloud Remote by Ouwen uses conduit to easily control a Legget & Pratt remote from the cloud

Conduit is an entirely open-source web service that allows you to securely control and interface with fleets of ESP8266-based IoT devices from anywhere in the world (even if those devices themselves don't have public or static IP addresses). Conduit offers a centralized RESTful API to do things like eaisly execute arbitrary firmware functions on your device or receive data from your device(s). You can use the already deployed service or spin up your own instance (useful if you want to ensure all of your infrastructure stays behind a private network--say a hospital network).

You can do all this simply by dropping in a few lines of code into your firmware and then issuing RESTful API requests to the conduit web service to call your firmware functions. Skip ahead to a full minimal example if you're ready to get started right away!

Conduit Components

Conduit API

A central conduit API server is already deployed at (should be used for all API routes) with a user-friendly front-end deployed at

Method Route Sample Request Notes
POST /api/login { "email": "", "password": "test" } Authenticate with Conduit, get issued a JWT
POST /api/call {"token": "JWT token from login", "device_name": "myDeviceName", "function_name": "ledToggle", "wait_for_device_response": "true"} Call a function (ledToggle) on one of your ESP8266 devices (named "myDeviceName" here)!
POST /api/user_info {"token": "JWT token from login"} This returns information about your user account, including your account secret which you must include in your firmware.

Minimal Example

Below is a minimal example of firmware code needed to get started with Conduit to blink an LED. See the next section for a complete example.

#include <Arduino.h>
#include <Conduit.h> // get from suyashkumar/conduit-firmware-library or platformio

#define LED D0

const char* ssid = ""; // wifi ssid
const char* password = ""; // wifi password
const char* device_name = ""; // you pick this! IDentifier for your device
const char* server_url = ""; // location of the API server
const char* account_secret = ""; // register and call /api/user_info to get this

Conduit conduit(device_name, server_url, account_secret);
int ledStatus = 0;

int ledToggle(RequestParams *rq){
  digitalWrite(LED, (ledStatus) ? HIGH : LOW); // LED is on when LOW
  ledStatus = (ledStatus) ? 0 : 1;
  conduit.sendResponse(rq, (ledStatus) ? "ON":"OFF");

void setup(void){
  Serial.begin(115200); // Start serial
  digitalWrite(LED, HIGH);

  conduit.startWIFI(ssid, password); // Config/start wifi
  conduit.addHandler("ledToggle", &ledToggle);


void loop(void){

and now you can call ledToggle on that device from anywhere in the world by using the following APIs:

Call RESTful APIs to trigger ESP8266 Functions:

  1. Get your login token by authenticating POST

    curl '' \
    -H 'content-type: application/json;charset=UTF-8'  \
    --data-binary '{"email":"YOUR_EMAIL", "password":"YOUR_PASSWORD"}' --compressed
  2. POST

    curl '' \
    -H 'content-type: application/json;charset=UTF-8'  \
    --data-binary '{"token":"YOUR_LOGIN_TOKEN","device_name":"YOUR_DEVICE_NAME","function_name":"ledToggle","wait_for_device_response":true}' --compressed

Conduit is currently in active development, so please feel free to contact me with comments/questions and submit pull requests!

Bink an LED from the Cloud (full example).

Controlling an LED on the ESP8266 from the Cloud takes less than 5 minutes with Conduit. Example firmware code to go along with this tutorial can be found here

Please make sure you've installed the relevant drivers (here if you're using the nodemcu ESP8266 chip linked above) and installed the platformio build system (simply brew install platformio if you're on a mac).

  1. Create a conduit account at
  2. Retreive your account secret from the Account view at
  3. Clone the conduit firmware repo and change into the examples/basic_functionality directory.
git clone
cd examples/basic_functionality
  1. Open src/main.ino. Fill in the following lines (account secret comes from step 2):
const char* ssid = ""; // wifi ssid
const char* password = ""; // wifi password
const char* device_name = ""; // you pick this! IDentifier for your device
const char* server_url = ""; // location of the API server
const char* account_secret = ""; // register and call /api/user_info to get this
  1. Build the project using platformio. You should install platformio (if you haven't already) to build this properly. Ensure you're in the root directory of the example (not src) and run:
platformio run

If your ESP8266 chip is connected via usb already, to build and upload the program run:

platformio run --target upload

NOTE: to properly upload to an ESP8266 chip, you must have installed the ESP8266 drivers on your system already.

  1. You should be set! You can now go to the conduit interact view ( and type in your device name (that you chose in step 4) and ledToggle as the function and hit "Execute!" to see your LED on your device toggle! You can also issue RESTful API requests to conduit to trigger functions on your device from any app that you build as mentioned here


Copyright (c) 2018 Suyash Kumar

See conduit/LICENSE for license text (MIT).

You can’t perform that action at this time.