K KME Docs
Open platform →
KME Documentation

The operating gateway for the KME Smart platform.

KME Smart is a unified IoT operations platform for devices, automation, monitoring and industrial connectivity. This documentation is everything you need to get started, connect devices, build integrations, and scale projects into production.

Real-time platform MQTT based ESP ecosystem Industrial ready No-code automation

What is KME Smart?

KME Smart connects, monitors and manages devices and operations — from a single curtain motor in a home to a 10,000-node factory floor. It is one vertically-integrated stack: firmware, a real-time MQTT message bus, a no-code automation engine, branded dashboards, and an open REST API — so a project that starts on one device scales to an entire site without re-architecting.

Real-time monitoring
Sub-second telemetry, live charts, alerts and event streams from every device.
No-code automation
When → then rules with schedules, sensor triggers, geofences and webhooks.
Device management
Provision, tag, group and OTA-update fleets from one pane — built for ESP32.

Platform architecture

Every device speaks to the platform over MQTT. KME Smart ingests that traffic, keeps live device state, runs the automation engine, and exposes everything through dashboards, a REST/streaming API, and third-party integrations.

ESP32 / ESP8266 Sensors · Relays GPS · LoRa MQTT Broker TLS · 8883 KME Core STATE · RULES Dashboards REST / Stream API Integrations
Devices → MQTT broker → KME Core → dashboards, API & integrations

Who this is for

You do not need to be a programmer to run KME Smart. Operators build dashboards and automations with no code. Developers get a clean MQTT + REST surface and SDKs to embed KME into their own products. This documentation serves both — start with Getting Started, then branch into whichever path fits you.

New to KME? The fastest path to a live device is the 6-step Getting Started guide — account, device, Wi-Fi, dashboard, first automation. About 10 minutes.
02 · Get started

Getting Started

From zero to a live device on a dashboard in about ten minutes. This is the most important section — keep it open in one tab while you work.

6
Steps
~10m
Time
0
Cost to start
1
Device needed

Before you begin

You will need an ESP32 or ESP8266 board, a USB cable, and a 2.4 GHz Wi-Fi network. That is it — no toolchain, no SDK install for the quick path.

The six steps

  1. Create an account

    Open the platform and sign up with your email. Your account is a workspace — every device, dashboard and automation lives inside it, isolated from other workspaces.

  2. Add your first device

    In Devices → Add device, give it a name and pick the board type. KME issues a one-time device token — this is the device's password to the MQTT broker. Copy it now; you will not see it again.

  3. Flash & connect to Wi-Fi

    Use the in-browser KME Configurator to flash firmware over USB (no IDE). On first boot the device opens a setup access point; choose your Wi-Fi and enter the password. See Device Provisioning for every method.

  4. Watch it come online

    Within seconds the device turns green in the device list. Telemetry — switch states, sensor values — starts streaming live.

  5. Open the dashboard

    Drop widgets onto a canvas: a switch for a relay, a gauge for temperature, a chart for history. Bind each widget to a device channel. Changes are live both ways.

  6. Create your first automation

    Add a rule: when a sensor crosses a threshold, then toggle an output and notify you. No code — see Automations.

2.4 GHz only Most ESP boards do not support 5 GHz Wi-Fi. If the device never comes online, check that you joined it to a 2.4 GHz SSID.

Connect with raw MQTT instead

Already have a device with its own firmware? Skip flashing and point any MQTT client at the broker using the device token from step 2:

connect.shbash
# Publish a temperature reading to your device's channel
mosquitto_pub --cafile ca.pem \
  -h mqtt.kmesmart.com -p 8883 \
  -u "<workspace>:<device_id>" -P "<device_token>" \
  -t "kme/<workspace>/<device_id>/state" \
  -m '{"V":{"temperature":24.6}}'

That value appears on the dashboard instantly. The full topic and payload model is in MQTT Documentation.

03 · Hardware

Supported Hardware

KME Smart is built around the ESP ecosystem and speaks every common IoT transport. If your device can reach an MQTT broker, it can join the platform.

ESP ecosystem

These chips are first-class: official firmware builds, in-browser flashing, and firmware-aware defaults for the status LED and pairing button.

ESP32
Dual-core, Wi-Fi + BLE. The workhorse for relays, dimmers and multi-sensor nodes.
ESP32-S3
More RAM and AI acceleration. Status LED GPIO2, pairing GPIO0.
ESP32-C3
RIS-V, low cost, BLE 5. Pairing button defaults to GPIO9.
ESP8266
The classic budget node. Status LED GPIO2, pairing GPIO0.
ESP32-H2
802.15.4 / Thread + Zigbee radio for low-power mesh endpoints.
Bring your own
Any board with an MQTT client and the device token works — see SDKs.
Firmware-fixed pins The status LED and pairing button GPIOs above are reserved by the device firmware at boot. The KME Configurator already defaults to the correct pin per chip — do not override them unless your hardware genuinely differs.

Connectivity

One unified message bus, many transports. KME bridges them so a mesh sensor and a cellular tracker show up the same way.

TransportSpecBest forStatus
Wi-Fi802.11 b/g/n, 2.4 GHzMains-powered devices, dashboardsLive
BLEBluetooth LE 5.0Provisioning, low-power sensorsLive
LoRa868 / 915 MHzLong-range fields, remote sitesLive
MQTT3.1.1 over TLSThe core device ↔ platform busLive
Zigbee802.15.4 meshDense low-power building meshPlanned

Device classes

Out of the box KME models switches & relays, dimmers, RGB lighting, shutters & curtain motors, climate sensors (DHT22, BME280), energy meters, GPS trackers, and low-power battery sensors. Each maps to a dashboard widget automatically.

04 · Devices

Device Provisioning

Provisioning is how a device gets its network credentials and joins your workspace. KME supports several methods — from a phone tapping a sensor to flashing a thousand units on a bench.

The provisioning lifecycle

Whatever the method, every device walks the same path: it powers on with no credentials, receives Wi-Fi + a device token, claims itself into a workspace, and comes online.

Power onno creds Setup modeAP · BLE · QR Send credswifi + token Claim→ workspace Onlinestreaming
The provisioning state machine — identical across every method

Methods

AP mode (SoftAP)
Device hosts a temporary Wi-Fi network. Join it, pick your SSID, enter the password. Zero extra hardware — the universal fallback.
BLE onboarding
A phone discovers the device over Bluetooth LE and writes credentials. Smoothest consumer experience; no network hopping.
QR setup
Scan a QR sticker to pre-fill device identity, then push Wi-Fi from the app. Great for retail kits.
SmartConfig
Broadcast credentials over the air to nearby unconfigured ESP devices at once.
Device claiming
A pre-flashed device announces itself; an operator approves it into a workspace from the dashboard.
Bulk provisioning
Flash a batch on the bench with baked-in tokens. Each unit claims itself on first power-up in the field.
Treat the device token like a password The token is shown once at creation. It is the device's credential to the broker. If it leaks, rotate it from Devices → ⋯ → Regenerate token — note this requires re-flashing or re-pushing creds to the device.

Re-provisioning & factory reset

Hold the pairing button (see Supported Hardware for the per-chip GPIO) for ~5 seconds to wipe stored Wi-Fi and return the device to setup mode. The workspace claim is preserved unless you also remove the device from the dashboard.

05 · Connectivity

MQTT Documentation

MQTT is the heart of KME Smart — the low-latency, bidirectional bus every device speaks. This is the contract between your firmware and the platform.

Why MQTT

  • Low latency — typically under 100 ms device-to-dashboard.
  • Bidirectional — state flows up, commands flow down, one connection.
  • NAT-friendly — the device dials out; no inbound ports or static IPs.
  • Resilient — survives flaky links and reconnects with session state.

Broker

SettingValue
Hostmqtt.kmesmart.com
Port (TLS)8883 — required in production
Port (plain)1883 — local / development only
ProtocolMQTT 3.1.1, QoS 0–1
Client IDthe device_id
Username<workspace>:<device_id>
Passwordthe one-time device_token

Topics

Every topic is namespaced to your workspace so a leaked token can never read or write another workspace's data.

topic patterntext
kme/<workspace>/<device_id>/<channel>
ChannelDirectionPurpose
stateDevice → KMETelemetry: switch states, sensor values
cmdKME → DeviceCommands: toggle, set, dim, request state
onlineDevice → KMEBirth / Last-Will presence (1 / 0, retained)
otaKME → DeviceFirmware update instructions & progress
Device ESP32 Broker authz per topic KME Core + dashboard PUB .../state ▸ ◂ SUB .../cmd ▸ state cmd ◂
Device publishes state, subscribes to commands — the broker enforces per-topic authorization

Payload format

State and command payloads are compact JSON. S is the array of switch/output states; V is a map of named sensor values. KME merges incoming values, so a device may report a subset.

device → kme/acme/KME9350008/statejson
{
  "S": [1, 0, 0, 1],
  "V": { "temperature": 24.6, "humidity": 58 }
}
kme → kme/acme/KME9350008/cmdjson
// toggle output channel 2
{ "action": "toggle", "value": 2 }
ActionValueEffect
togglechannel indexFlip a relay / output
set{channel, value}Absolute output state
dim{channel, 0–100}Dimmer level
curtainopen|close|stopShutter / curtain motor
status_request"NOW"Ask device to republish state

Presence & reliability

Devices set a retained Last-Will on .../online with payload 0, and publish 1 on connect. KME also polls stale devices with status_request so a missed message never leaves the dashboard wrong for long. Commands publish at QoS 1; state at QoS 0 (idempotent — the next update corrects any gap).

Firmware authors Always validate the broker's TLS certificate, never hard-code tokens, include a firmware_version in your boot state (enables OTA targeting), and back off exponentially on connect failure (max 60 s).
06 · Developers

REST API

Everything the dashboard does, your code can do. The REST API manages devices, sends commands, reads history, and drives automations — server-to-server.

Base URL & authentication

  • Base URL: https://api.kmesmart.com/v1 (dev: http://localhost:3000)
  • Auth: Authorization: Bearer <api_key> for server-to-server. Browser sessions use a JWT cookie.
  • Bodies are JSON; responses are { "ok": true, … } or { "error": "message" }.

API keys

Create scoped keys under Settings → API keys. Scopes are least-privilege: a key for a Grafana panel needs only devices:read, never devices:write.

authbash
curl https://api.kmesmart.com/v1/devices \
  -H "Authorization: Bearer kme_live_8f3c…"

Endpoints

Devices

MethodPathPurpose
GET/devicesList devices in the workspace
GET/devices/:idOne device + live state
POST/devicesCreate a device (returns token once)
PUT/devices/:idRename, move to project / group
POST/devices/:id/commandSend an MQTT command
DEL/devices/:idRemove a device

Automations & data

MethodPathPurpose
GET/automationsList rules
POST/automationsCreate a when→then rule
GET/devices/:id/historyTime-series readings
GET/events/streamServer-sent events — live updates

Send a command

POST /v1/devices/:id/commandbash
curl -X POST https://api.kmesmart.com/v1/devices/KME9350008/command \
  -H "Authorization: Bearer kme_live_8f3c…" \
  -H "Content-Type: application/json" \
  -d '{"action":"toggle","value":2}'

The platform publishes to .../cmd, the device responds on .../state, and an SSE device_update event fires for any dashboard or subscriber watching.

Live updates without polling Subscribe to /v1/events/stream (SSE) instead of polling /devices. You get device_update, lp_reading and automation_fired events the moment they happen.
07 · Build

Automations

Automations are KME's identity: if-this-then-that, but built for a factory. Compose triggers, conditions and actions visually — no engineer required.

WHEN temperature > 40 AND 06:00 – 23:00 THEN fan ON · notify
Trigger → condition → action — fan-out to thousands of devices

The building blocks

Triggers
A sensor crossing a threshold, a device going offline, an incoming webhook.
Conditions
Time windows, device groups, day-of-week, geofence in/out, value comparisons.
Schedules
Cron-like timing, sunrise/sunset offsets, recurring windows.
Actions
Toggle / set / dim outputs, broadcast to a group, run a scene.
Notifications
Email, Telegram, Slack, webhook — with escalation if unresolved.
Scenes
One-tap presets that set many devices at once (Morning, Movie, Goodnight).

Example: humidity recovery

ruleyaml
when:  bathroom.humidity > 70
and:   time between 06:00 and 23:00
then:  turn on bath_fan for 20m
also:  notify slack "#ops" if not recovered in 30m

Rules run server-side, so they keep working even if every dashboard is closed. Each rule logs every fire for audit and tuning.

08 · Build

Dashboard Widgets

Dashboards are drag-and-drop. Drop a widget, bind it to a device channel, brand it, and share it. The same blocks power a 4-device home and a 4,000-sensor floor.

Widget library

Gauge
Radial value vs. range — temperature, pressure, fill level.
Chart
Time-series line/area with live tail and history.
Switch
Toggle a relay or output, with live confirmation.
RGB
Colour wheel + brightness for LED strips.
Map
Live GPS position and trails for fleets.
KPI card
A single big number with trend vs. yesterday.
Energy graph
Power draw, peak, and cost over time.
Slider
Dimmer / setpoint control 0–100.

Binding a widget

  1. Drop it on the canvas

    Pick a widget from the palette and place it on the grid.

  2. Bind a data source

    Choose a device and a channel — e.g. V.temperature or output S[2].

  3. Style & brand it

    Set ranges, colours, units. Apply your logo and palette for a white-label view.

  4. Share or embed

    Publish a read-only link or embed the dashboard in your own app via an iframe / signed URL.

One layout, many devices Build a dashboard against a device template, then point it at any device of that type. Roll out 500 sites without rebuilding 500 dashboards.
09 · Build

Integrations

KME Smart speaks to the rest of your stack. Mirror devices into your smart-home ecosystem, pipe data into Grafana, or fan events out to chat and webhooks.

Available integrations

Home Assistant
MQTT Discovery — devices appear as entities with zero YAML.
Alexa
Voice control for switches, scenes and dimmers.
Google Assistant
Link a workspace and control devices by voice.
IFTTT
Trigger applets from device events, or act on KME from any service.
Webhooks
Signed outbound POSTs on any event; inbound webhooks as triggers.
Grafana
Read-only API key + data source for long-term analytics.
Node-RED
MQTT in/out nodes for custom flow logic.
Telegram
Push alerts and accept commands from a bot.
Slack
Channel notifications with escalation from automations.

Home Assistant in one step

Enable the integration and KME publishes MQTT Discovery messages — switches, sensors and dimmers register as native entities automatically. State mirrors both ways with command de-duplication so the dashboard and HA never fight.

homeassistant/switch/KME9350008/configjson
{
  "name": "Plant A · Fan",
  "command_topic": "kme/acme/KME9350008/cmd",
  "state_topic":   "kme/acme/KME9350008/state",
  "unique_id":     "kme_KME9350008_ch2"
}
10 · Operate

OTA Updates

Ship firmware to the whole fleet without touching a single device. Staged rollouts, signed images, live progress, and one-click rollback.

How it works

Upload image Pick cohort10% canary Device pullsverify hash Rebootreport version Promoteor rollback
Canary first, watch health, then promote — or roll back instantly

Capabilities

  • Version control — every image is tagged; devices report their running version on boot for targeting.
  • Staged rollouts — 10% canary → 50% → 100%, gated on error rate and reconnect success.
  • Signed updates — images are hash-verified; a device refuses an image that does not match.
  • Rollback — keep the previous slot; one click reverts the cohort to the last good version.
  • Resumable — interrupted downloads resume; a failed flash never bricks (A/B partitions).
Always canary first Never push to 100% on the first wave. Roll to a 5–10% canary, watch the fleet health score and reconnect rate for at least one full reporting cycle, then promote.
11 · Operate

Security

Security is layered from the device to the API. Every connection is encrypted, every credential is scoped, and no workspace can ever see another's data.

TLS — every link encrypted in transit Device authentication — per-device tokens Topic isolation — workspace-scoped authz RBAC + scoped API keys
Defence in depth — each layer holds even if the one outside it is breached

Controls

LayerControl
TransportTLS on MQTT (8883) and HTTPS for all API traffic. Validate the server certificate chain.
Device authOne unique token per device, issued once, rotatable. No shared secrets.
Topic authzThe broker rejects publish/subscribe outside kme/<your-workspace>/… — a stolen token cannot touch another tenant.
RBACRoles (Owner, Engineer, Operator, Viewer) gate every dashboard and action.
API permissionsAPI keys carry least-privilege scopes (devices:read, automations:write, …).
Encrypted commsSecrets encrypted at rest; tokens stored hashed; webhook payloads signed.
Rotate on suspicion If a device token or API key may have leaked, regenerate it immediately. Tokens are scoped, so a single rotation never affects the rest of the fleet.
12 · Operate

Industrial Solutions

The same KME Smart platform — different blueprints. This is what sets KME apart: it is not just smart home, it is built for operations at industrial scale.

Factory monitoring
Line throughput, machine health, air handlers and alerts on one screen.
Energy tracking
Live power draw, peaks, cost and anomaly detection per circuit.
Production monitoring
Units/hour, OEE inputs, downtime causes, shift comparison.
GPS tracking
Live position, trails, geofence rules, ignition cut for vehicles.
Agriculture monitoring
Soil moisture, pump scheduling, LoRa to remote fields.
Fleet management
Cold-chain temperature, door events, route adherence, alerts.

One platform, many sites

Each solution is a blueprint on the same core — devices, MQTT, automations, dashboards and the API are identical. Start with one line or one field, prove it, then template it across every site without re-architecting.

Solutions are configurations, not forks Everything in this section is built from the widgets, automations and APIs already documented here — there is no separate "industrial product" to learn.
13 · Developers

Examples

Copy-paste starting points in every language a KME project touches. Each one connects, authenticates, and exchanges state in the fewest lines possible.

ESP32 — Arduino

The KME Smart Arduino SDK handles reconnection, batching and TLS. Production firmware in six lines:

esp32 / main.cppcpp
// Publish a temperature reading every 2 s
#include <KMESmart.h>
KMESmart kme("<device_token>");

void setup() {
  kme.begin("wifi-ssid", "pass");
}

void loop() {
  float t = readDHT22();
  kme.publish("temperature", t);
  delay(2000);
}

MQTT — command line

subscribe.shbash
# Watch a device's live state
mosquitto_sub --cafile ca.pem -h mqtt.kmesmart.com -p 8883 \
  -u "acme:KME9350008" -P "<device_token>" \
  -t "kme/acme/KME9350008/state" -v

Node.js

command.jsjavascript
const res = await fetch(
  "https://api.kmesmart.com/v1/devices/KME9350008/command", {
  method: "POST",
  headers: {
    "Authorization": "Bearer kme_live_8f3c…",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ action: "toggle", value: 2 })
});

Python

read_history.pypython
import requests

r = requests.get(
    "https://api.kmesmart.com/v1/devices/KME9350008/history",
    headers={"Authorization": "Bearer kme_live_8f3c…"},
    params={"hours": 24},
)
print(r.json()["readings"])

Flutter

kme_client.dartdart
final kme = KmeClient(apiKey: 'kme_live_8f3c…');
final device = await kme.device('KME9350008');
await device.toggle(channel: 2);
device.stream.listen((s) => print(s.values));
14 · Developers

SDKs

SDKs wrap the raw MQTT + REST surface so you ship faster. Reconnection, auth, batching and OTA are handled for you — speak raw protocol only if you want to.

Arduino / ESP-IDF
For ESP32, S3, C3, ESP8266. Wi-Fi provisioning, TLS, OTA, auto-reconnect.
Stable
Node.js SDK
Promise API over REST + SSE. Ideal for backend integrations and bots.
Stable
Python SDK
Sync + async clients, pandas-friendly history export for analytics.
Beta
Flutter SDK
Cross-platform mobile — live device state streams and command helpers.
Beta
REST (any language)
No SDK? Every endpoint is plain HTTPS + JSON. Generate a client from the spec.
Always
MQTT (any client)
Standard MQTT 3.1.1 — use Paho, mqtt.js, or your platform's library.
Always
No lock-in The SDKs are convenience, not a requirement. Anything that speaks MQTT or HTTPS is a first-class KME client — see Examples.
15 · Resources

Downloads

The tools that pair with the platform — flash firmware, configure devices, and connect from a desktop.

KME Configurator
In-browser flasher & setup over USB (Web Serial) — no toolchain to install.
Open in browser →
KME Bridge
Desktop bridge that links existing devices and local networks to the cloud.
Download →
Windows tools
Standalone Windows configurator for bulk bench provisioning.
Download →
Firmware tools
Reference firmware builds and the CA certificate for TLS validation.
Download →
No install for the common path The KME Configurator runs entirely in Chrome/Edge via Web Serial. Most users never download anything to flash and provision a device.
16 · Resources

Frequently Asked Questions

The questions every KME operator hits in the first week — answered.

Why is my device offline?

Most often: it joined a 5 GHz SSID (ESP boards are 2.4 GHz only), the Wi-Fi password changed, or the device token was regenerated without re-flashing. Check the device's .../online retained message; if it is 0, the broker saw it disconnect. Power-cycle and watch the status LED — see Device Provisioning.

MQTT connection failed — what do I check?

In order: (1) port 8883 reachable and TLS CA bundled on the device; (2) username is exactly <workspace>:<device_id>; (3) password is the current device token; (4) client ID equals the device ID and is unique. A second client with the same ID will kick the first.

How many devices are supported?

A workspace scales from one device to tens of thousands. The embedded broker comfortably handles thousands of devices; beyond that the platform runs against an external broker for horizontal scale. There is no hard cap in the data model.

How does OTA work?

You upload a signed image, target a cohort, and devices pull + hash-verify it on their next check-in, then reboot and report the new version. Roll out as a canary first, watch fleet health, then promote — or roll back in one click. Full detail in OTA Updates.

Do I have to use the SDK?

No. The SDKs are convenience wrappers. Any standard MQTT client or any HTTPS call is a first-class KME client — see Examples.

Can KME integrate with Home Assistant / Alexa / Grafana?

Yes — Home Assistant via MQTT Discovery (zero YAML), Alexa & Google Assistant by linking a workspace, and Grafana with a read-only scoped API key. See Integrations.

What happens to automations if the dashboard is closed?

They keep running. Automations execute server-side, not in the browser, so a rule fires whether or not anyone is watching.

Still stuck? Search the docs with ⌘K, or open the platform and use in-app support.