Skip to content
Flyght
Sign in

FlyghtEdge · Flyght Cloud

Documentation

From installing the library to a device you watch and control from anywhere, step by step.

Board pages · 01

Pages of the board

Every FlyghtEdge board serves its own dashboard: what each page shows and where it is explained.

The Control page: switches, a slider, a button, a mode selector and a text box as cards
Control: the cards of your sketch.

There is nothing to install: open the board’s address in a browser (http://<name>.local, or its IP) and its dashboard is there. It is the same on a phone and a laptop, in a light or dark theme, in English or Bahasa Indonesia. Every page below is part of the library; a page shows up in the menu only when the sketch creates the module behind it.

The menu

GroupPageWhat it is forComes fromGuide
RoomsControl, Monitor, and any page you nameThe cards of your sketch: switches, sliders, buttons, readings, chartsdev.page("Control")Control and Monitor
DevicesMotionOrientation: horizon, compass, 3D boxBno055Devices → IMU
DevicesLCDThe real character screen, typed from the phoneLcdI2cDevices → LCD
DevicesFilesFolders and files of the SD cardSdCardDevices → SD card
DevicesScreenThe TFT screen, mirrored, with drawing toolsTftDevices → TFT screen
DevicesMapPosition, track and satellitesGpsDevices → GPS
DevicesSerialA console to another microcontrollerMcuLinkDevices → External microcontroller
DevicesLightsColour, brightness and effects of LEDsLed, RgbLedLights and Flows
DevicesFlowsAutomations from blocks (Pro)the feature “Visual flows”Lights and Flows
DeviceWi-FiThe router, saved networks, the board’s own access point, its nameWifi, Ap, MdnsWi-Fi
DeviceConnectMQTT and Home Assistant, the HTTP API with tokens, the webhookMqtt, WebhookConnect
DeviceSettingsThe device, module health, Flyght Cloud, access, plan and features, users, logsSystem, Cloud, AuthSettings and System; Sign-in, guests and users
Before you sign inSetup wizard, Sign inThe first start, and the loginAp, Captive, AuthFirst start; Sign-in, guests and users

There is one menu on every screen size. On a phone it is a drawer that you open with the menu button, and it holds the rooms, the device pages, Wi-Fi, Connect and Settings (there is no bottom bar and no row of page tabs any more).

Who may do what

RoleCanGets it by
viewerLook at every page and every valueGuest access, or an account with this role
operatorAlso change widgets, lights, the LCD, the screen, send to the serial linkA user or an API token with this role
adminAlso change settings: Wi-Fi, Connect, layout, pins, files, cloud, usersThe owner (the password of the setup wizard) is always admin

Board pages · 02

First start: the setup wizard

A new board opens its own Wi-Fi and a four-step wizard: password, Wi-Fi, key, done.

The first screen of the wizard: “I have a key” or “Set up online”
The first screen: two ways to start.
Step 1: choose a password, and allow guest access or not
1. Password.
Step 2: the Wi-Fi networks the board can see
2. Wi-Fi: nearby networks.
Step 2 after the board joined the network and shows its IP address
Connected, with the IP address.
Step 3: the claim link and the box for the license key
3. Key: the claim link and the key.
Step 4: the addresses of the board, and the button to open the dashboard
4. Done: save these addresses.

How to get there

  1. Power the board. It starts its own Wi-Fi, named like smart-lamp-C2D3 (the sketch name and four characters of the MAC), open by default.
  2. Join that Wi-Fi with your phone. The wizard opens by itself (the captive portal). If it does not, open http://192.168.4.1.
  3. Go through the four steps below. Your session is saved, so you do not log in again.

The steps

StepWhat you doGood to know
StartChoose I have a key (paste a license key, then connect to Wi-Fi) or Set up online (connect to Wi-Fi first, then create a key on the Flyght website).I have a key goes password, key, Wi-Fi; Set up online goes password, Wi-Fi, key. You can skip the key and add it later in Settings.
1. PasswordChoose a password and repeat it. Decide whether Allow guest access is on: others may then open the dashboard without a password.At least 6 characters. Only the owner can change settings.
2. Wi-FiPick a nearby network from the scan (or type its name), enter its password and press Connect. It is optional.Your phone may drop the board’s Wi-Fi for a moment: rejoin it. The network is saved with priority and the board reconnects by itself.
3. KeyOpen the Claim this device link on a device with internet, sign in to Flyght, create a key for this board, and paste it into License key (it starts with fnk_live_). Leave Connect to Flyght Cloud on to link it at once.Your phone is still on the board’s Wi-Fi and has no internet: switch to your usual Wi-Fi to open the link, then come back.
4. DoneSave the three addresses, then Open dashboard.Via the device Wi-Fi http://192.168.4.1; on the same network http://<name>.local and the IP.

Skip the wizard from code

C++
fn::Device dev("smart-lamp");

void setup() {
  dev.auth().defaultPassword("rahasia123");                    // no password step
  dev.auth().allowAnonymous(true, fn::Role::Viewer);           // guests may look
  dev.wifi().add("Home", "home-password", 50);                 // up to 8 networks, higher priority first
  dev.ap().ssid("{name}-{mac4}").mode(fn::ApMode::Fallback);   // the setup Wi-Fi only while the router is down
  dev.license(FN_LICENSE_KEY);                                 // the key of step 3
  dev.begin();
}

FieldWhat it doesDefault / range
auth().defaultPassword(pw)Skips the password step (first boot only).none: the wizard asks
auth().allowAnonymous(on, role)Guest access on, with a role.off
wifi().add(ssid, pass, priority)A saved network without the wizard.priority 50; 8 networks at most
ap().ssid(tpl), .password(p), .mode(m)Name, password and mode of the setup access point. A password of 8 characters or more, else it stays open.{name}-{mac4}, open, Always
license(key)The license key (it is also the claim key for the cloud).none: evaluation mode

Board pages · 03

Control and Monitor

The cards of your sketch, live, and how to rearrange them.

The Control page on a laptop
Control on a laptop.
The Monitor page: two gauges, a chart and two values
Monitor: gauges, a chart and values.
The Control page on a laptop in the dark theme
The dark theme.

These are the pages you declare in the sketch with dev.page("Name", "icon"), the first two in the screenshots being “Control” and “Monitor”. Each widget is a card. The greeting says how many switches are on, the green Live dot says the page is connected to the board, and the pills under the greeting jump to every other page.

CardHow you use itCode
ToggleTap the card or the switch. “On / Tap to turn off”.toggle(id, label, cb(bool))
SliderDrag, or use the − and + buttons for one step.slider(id, label, min, max, step = 1, cb(float))
ButtonPress: runs the callback once.button(id, label, cb())
SelectPick one option (Auto, Manual, Away).select(id, label, options, cb)
TextType and send with the arrow.text(id, label, cb)
Gauge, value, chartRead only: pushed from loop() with dev.ui().set(id, value).gauge, value, chart

Edit layout

Edit layout: a bar with Reset, Cancel and Save, and a frame with handles on every card
Edit layout: resize, hide or drag.
A card being dragged to a new place
Dragging a card.
The new order after saving, with a “Saved” message
Saved: the board keeps the layout.
  1. Press Edit layout (an administrator can). A bar says “Drag cards to reorder. Resize or hide them.”
  2. Drag a card by its handle (the six dots) to move it. Use the arrows to make it wider or narrower (1 to 3 columns), and the eye to hide it.
  3. Save keeps it on the board, for everyone. Cancel drops the changes. Reset puts the order of the sketch back.
RouteRoleMeaning
GET /uiviewerThe pages and every widget with its type, label, unit and layout.
GET /state, POST /stateviewer; the widget’s own roleEvery value; set several at once with {"id": value}.
PUT /ui/layout, DELETE /ui/layoutadminSave or reset the layout of a page.

All routes are under /fn/api/v1 (see Local API). Theme and language are chosen with the moon and the globe in the top bar and are remembered by the browser.

Board pages · 04

Wi-Fi

The router the board joins, the networks it remembers, its own access point and its name.

The Wi-Fi page: status, saved networks, the access point and the device name
Wi-Fi: status, saved networks and the access point.
The “Add network” dialog
Add network.
Saved networks in a new order, with a message that the order was saved
Drag to change the order.
The board has moved to the next saved network after the first one failed
The first network failed: the next one is used.
CardWhat it shows and does
Wi-Fi statusStatus, SSID, IP, signal in dBm and gateway of the connection. Reconnect tries again now.
Saved networksUp to 8 (home, office, a hotspot). The board tries them from the top; if one fails it uses the next. Drag to change the order, the key icon changes its password (empty means an open network), the bin removes it. Add network asks for the name, the password and Connect now.
Access pointThe board’s own Wi-Fi for setup and direct access: its name (SSID), IP, who is connected and the security. Change the SSID and the password, and the Mode: Always, Fallback (only while the home Wi-Fi is down) or Off; and the Channel. Saving disconnects phones that use this access point.
Device name & mDNSThe name for http://<name>.local, up to 63 characters.
  • The board connects directly with no background scanning, and waits longer between failed tries (15 seconds growing to 15 minutes), so it stays quiet when the router is gone and comes back by itself.
  • While a phone is on the board’s own Wi-Fi, automatic tries wait (joining a router can move the radio channel and drop the phone). Pressing Connect starts a 90 second window.
  • An access point password needs 8 characters or more, otherwise the access point stays open.
C++
dev.wifi().add("Home", "home-password", 90)   // tried first
         .add("Office", "office-password", 50)
         .backoff(15, 900);                    // wait 15 s after a failure, growing to 15 min
dev.ap().mode(fn::ApMode::Fallback).channel(6);
dev.mdns().service("_modbus", "_tcp", 502);    // an extra service on the network

RouteRoleMeaning
GET /wifiviewerStatus, and the saved networks without their passwords.
PUT /wifi/networksadminReplace the saved list (up to 8, priority 0 to 100).
POST /wifi/connect, POST /wifi/scanadminJoin a network now; scan.
GET /ap, PUT /apviewer, admin{ssid, password, mode, channel}.
GET /mdns, PUT /mdns, POST /mdns/restartviewer, admin{"hostname": "x"}, 63 characters at most.

Board pages · 05

Connect: MQTT, HTTP API and webhook

Three ways to link the board to Home Assistant, Node-RED, n8n or your own backend.

The Connect page on the MQTT tab: the broker settings and the list of topics
MQTT: the broker and the topics.
The HTTP API tab: the base address, the main routes with their roles, the tokens and examples
HTTP API: routes, tokens and examples.
The Webhook tab: the target URL, the secret, the interval, an example payload and the status
Webhook: a POST on every change.

MQTT and Home Assistant

The board is an MQTT client (there is no broker inside it). Every widget is published and can be commanded without any code. With Home Assistant discovery on, every widget also shows up in Home Assistant as an entity.

FieldWhat it doesDefault / range
EnabledConnects to the broker.off until a broker is set
Broker URImqtt://host:1883, or mqtts:// for TLS. The page also shows a WebSocket form, ws://host:8083/mqtt.empty
Username, PasswordCredentials of the broker, if it asks.empty
Base topicThe start of every topic. {id} is the 12 digit device id, {name} the name, {mac4} four characters of the MAC.flyght/{id}
Retain stateValues are published retained, so a new subscriber gets the last one.on
Home Assistant discoveryPublishes a discovery message for every widget.off (homeAssistant(true) turns it on)
C++
dev.mqtt().broker("mqtt://192.168.1.10:1883")      // sets the broker and turns MQTT on
         .credentials("flyght", "secret")
         .baseTopic("home/{name}")
         .homeAssistant(true);

// Your own topics, next to the widgets:
dev.mqtt().publish("home/garage/door", "open", /*retain*/ true, /*qos*/ 1);
dev.mqtt().subscribe("home/garage/cmd", [](const String& topic, const String& payload) {
  Serial.println(payload);
});

TopicDirectionPayload
<base>/statusboard →online or offline (retained, last will)
<base>/infoboard →Device JSON (retained)
<base>/state/<widget>board →ON/OFF, a number or text
<base>/set/<widget>→ boardThe same formats; toggle and PRESS too

HTTP API and tokens

  1. The page shows the base address, http://<ip>/fn/api/v1, with a copy button, and the main routes with their roles.
  2. Press New token, give it a name and a role (viewer, operator or admin). The token, which starts with fn_, is shown once: copy it now.
  3. Send it as Authorization: Bearer <token>. The list keeps the name, the start of the token, the role and the date; the bin deletes it.
  4. The Examples tabs show the same call in cURL, JavaScript and Python.
A new token shown once in a dialog, with a copy button
A new token is shown once.
Terminal
curl -H "Authorization: Bearer $TOKEN" http://192.168.4.1/fn/api/v1/state
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
     -d '{"value": true}' http://192.168.4.1/fn/api/v1/ui/w/light

Tokens are a feature of every edition (“API tokens”, on by default) and there are at most 8. The full list of routes is in Local API.

Webhook

The board POSTs JSON to your URL when widget values change (debounced) and/or on a timer. The request runs on its own task, so a slow server never blocks the board.

FieldWhat it doesDefault / range
EnabledSends the webhook.off until a URL is set
Target URLWhere it POSTs. For https:// give the root certificate with caCert(pem); without it the traffic is encrypted but the server is not verified (the page warns).empty
Secret (optional)Signs every request in the header X-Flyght-Signature: sha256=<hex>, an HMAC-SHA256 of the body.empty: not signed
Send when values changeSends the changed values.on
Interval (seconds, 0 = off)Also sends every value on this timer.0
C++
dev.webhook().url("https://hooks.example.com/flyght")
            .secret("a-long-random-secret")
            .interval(60)           // plus a full report every minute
            .caCert(ROOT_CA_PEM);   // verify the server

What it sendsJSON
{"event":"change","device":"A4CF12B1C2D3","name":"Smart Lamp","ts":1791747120,"uptime":1234,
 "values":{"light":true,"brightness":35,"temp":28.4},"changed":["light"]}

RouteRoleMeaning
GET /mqtt, PUT /mqtt, POST /mqtt/testadmin{enabled, uri, user, password, baseTemplate, retain, ha}; test connects once.
GET /webhook, PUT /webhook, POST /webhook/testadmin{url, enabled, onChange, interval, secret}; test sends a test event.
GET /auth/tokens, POST /auth/tokens, DELETE /auth/tokens/<id>adminList, create (name and role) and delete tokens.

Board pages · 06

Settings and System

The device, the health of every module, Flyght Cloud, access, plan and features, and the logs.

The Settings page: the device, memory, flash, Flyght Cloud and the module health list
Settings: the device and the health of every module.

New in 2.2.0. Settings is in groups: Device & health, Cloud & license, Accounts & security and Maintenance & factory reset. A row at the top jumps to a group, and the groups fold. Users & roles is always there for the admin, with a switch to turn it on (or a note when the edition does not include it).

CardWhat it shows and does
DeviceDisplay name, model, firmware (your version and the FlyghtEdge version), chip, the 12 character id, hostname, uptime, why it last restarted, and bars for free memory and flash in use.
Module healthEvery module reports its own status with one line: web server, authentication, system, access point, captive portal, Wi-Fi, mDNS, dashboard, MQTT, webhook and every device module you created (IMU, LCD, SD, TFT, GPS, MCU link, lights). ok is green; a problem says why.
Flyght CloudSee below.
AppearanceTheme (Light, Dark, System) and language (Bahasa Indonesia, English), remembered by the browser.
AccessGuest access (view only or can control), the session length in days, change password, sign out everywhere. See Sign-in, guests and users.
Plan & featuresThe edition and a switch for every feature. See below.
LogsThe latest log lines of the board, live, with Pause.

Flyght Cloud

The Flyght Cloud card: switch on, status Online, the server, the license key field and the remove button
Flyght Cloud: Online.
A dialog that asks to type the device name before the saved license key is removed
Removing the saved key asks for the device name.
FieldWhat it doesDefault / range
Connect to Flyght CloudOff by default: the device works the same without the cloud. On, it claims itself with the license key and mirrors the dashboard over MQTT.off
StatusOff, No network, Needs a license key, Claiming, Fetching, Connecting, Online, Retry, Stopped.read only
Server, RegisteredThe site in use and whether this board is claimed.the address in the firmware
License keyType a key to replace it; it is never shown again. Remove the saved key deletes it (you type the device name to confirm); the board then uses the key of the sketch, if there is one.the key of license()
ServerShown, but not a setting: the server names the address in its claim and config answers, and the board follows it. It goes back to the address built into the firmware when that one stops answering. A build of your own points elsewhere with dev.cloud().site(...) or -DFN_CLOUD_SITE=....named by the server
C++
dev.license(FN_LICENSE_KEY);     // the key is also the claim key
dev.cloud().enable();            // on at the first start; the switch can change it later
                                 // .site("https://flyght.example") to point to another server

The evaluation banner

In evaluation mode the banner has Enter license key, and a board whose evaluation ran out shows the same button, so the key no longer needs dev.license() and an upload. The board checks the key, saves it and applies it after a restart (PUT /license, admin); a key set in the sketch with dev.license() takes precedence. Next to it, Setup erases the settings after you type RESET and starts the setup wizard again. While the evaluation is over, sign-in and the key route still answer; every other route answers 402.

Plan & features

Plan and features: a switch per feature, and a line that says the edition comes from the license key
A switch per feature; the edition comes from the key.
FeatureFrom editionWhat it doesOn at first start
Guest access (guest)FreePeople can open the dashboard without a password.off
API tokens (apiTokens)FreeOther systems use the HTTP API with a token.on
Visual flows (flows)ProAutomations from blocks.off
Users & roles (rbac)ProSeparate accounts with viewer, operator or admin rights.off
White label (whitelabel)ProHides the FlyghtEdge branding.off
Flows on RTOS threads (flowsRtos)EnterpriseA flow on its own FreeRTOS task.off

A feature is on only when the edition allows it and it is switched on. The edition comes from the license key only; in evaluation mode (no key) every edition is allowed for 30 minutes after each start. Put a default in the sketch with dev.features().defaultOn("flows").

System calls

C++
dev.system().ntp("pool.ntp.org", "time.google.com")   // the clock
           .timezone("WIB-7");                          // a POSIX time zone, default UTC0

RouteRoleMeaning
GET /sys, GET /sys/healthviewerName, model, versions, chip, memory, uptime, IP, MAC; the health of every module.
GET /sys/logs?since=<seq>adminThe log lines after a sequence number.
POST /sys/restartadminRestarts the board.
POST /sys/otaadminA .bin as the body (1024 bytes or more): updates the firmware over the air, then restarts.
POST /sys/factory-resetadminBody {"confirm": "RESET"}: forgets every setting.
GET /features, PUT /featuresviewer, adminThe features of the editions and whether each is on.
GET /cloud, PUT /cloudadmin{enabled, site, apiKey, confirm}; the answer never holds the key.

Board pages · 07

Sign-in, guests and users

The login page, guest access, sessions, and separate accounts with roles.

The sign-in page with a password field
Sign in with the owner’s password.
The sign-in page after a wrong password: “Oops, wrong password”
A wrong password.
The sign-in page with a username field, “Keep me signed in” and “Continue as guest”
With users and roles on: a username too.
  • Owner: the password made in the setup wizard. The owner is always admin. On the sign-in page leave the username empty.
  • Keep me signed in keeps the session: it stays valid for the number of days in Settings (30 by default), even if the Wi-Fi drops or the board restarts.
  • Continue as guest appears when guest access is on. A guest can look at everything allowed by the role you chose (view only, or can control).
  • A wrong password is answered with a friendly message, and repeated failures are slowed down by a rate limiter.

Access in Settings

FieldWhat it doesDefault / range
Allow guest accessAnyone on the network may open the dashboard without a password. Choose View only or Can control.off
Session length (days)How long a signed-in session stays valid.30
Change passwordThe current password and a new one (at least 6 characters).—
Sign out everywhereEnds every session at once, on every device.—

Users and roles (Pro)

The Users and roles card with one user, a form to add another, and the feature switches
Users & roles: a user with the Operator role, and the form for another.
  1. Switch Users & roles on in Plan & features (it needs a Pro license key).
  2. In Users & roles type a Username and a Password (at least 6 characters), choose the Role (Viewer, Operator or Admin) and save.
  3. Change a role with the drop-down on the user, the key icon sets a new password, the bin deletes the account. Changes apply at once.
C++
dev.auth().defaultPassword("rahasia123");                 // the owner, without the wizard
dev.auth().allowAnonymous(true, fn::Role::Viewer);        // guests may look
dev.auth().sessionDays(30);                               // how long a session lasts

RouteRoleMeaning
GET /auth/stateanyoneWho you are, whether setup is needed, whether guests are allowed. Works even in evaluation timeout.
POST /auth/login, POST /auth/anonymous, POST /auth/logoutanyoneSign in ({password, username?, remember?}), continue as guest, sign out.
POST /auth/logout-all, PUT /auth/passwordadminSign out everywhere; change the owner’s password.
GET /auth/config, PUT /auth/configadminGuest access and its role, the session length.
GET /auth/users, POST /auth/users, PUT /auth/users/<id>, DELETE /auth/users/<id>adminThe accounts of Users & roles.

Board pages · 08

Lights and Flows

Colour and effects for LEDs, and automations built from blocks.

The Lights page: the on switch, brightness, a colour picker and the gallery of effects
Lights: colour, brightness and effects.

Lights

Every light you create gets a card: an on switch, brightness, a colour picker with a hex box, the colour order of an addressable LED (a WS2812 is GRB; pick RGB if red and green look swapped), and the effects. The effect runs in the background and does not block loop().

C++
fn::Led status(2);                       // a plain LED on GPIO 2 (PWM dimming)
fn::RgbLed pixel(RGB_BUILTIN);           // the onboard addressable LED
fn::RgbLed strip(5, 6, 7, "desk");       // three PWM pins: R, G, B (common cathode)

void setup() {
  dev.use(status).use(pixel);
  pixel.color(0x2563eb);                   // from code, any time
  pixel.effect(fn::Fx::Breathe, 3000);     // runs in the background, 3 s per breath
  dev.begin();
}

ConstructorMeaning
Led(int pin, const char* id = "led", bool activeHigh = true, bool pwm = true)A plain LED: digital, or PWM brightness when pwm is true.
RgbLed(int dataPin, const char* id = "rgb")One addressable LED (WS2812), also the onboard one.
RgbLed(int r, int g, int b, const char* id = "rgb", bool commonAnode = false)Three PWM pins.

The effects are Solid, Blink, Breathe, Heartbeat, Strobe, Rainbow, Cycle (two colours), Candle, Police, SOS, Sunrise and Alarm; the speed slider sets the period in milliseconds. A light is also on the HTTP API (GET /lights, POST /lights/<id> with {"on", "color", "color2", "brightness", "effect", "period"}), on MQTT (<base>/light/<id>/state and /set) and a block in Flows.

Calibrate colours (2.2.0). If the colours of an addressable LED look wrong, Calibrate colours on its card shows the LED’s colours one at a time. You pick the one you see, and after a last “is this red?” check the colour order is saved.

Flows (Pro)

The Flows page with no flow yet and a list of examples to start from
No flow yet: start from an example.
The list of flows with their state and number of blocks
The list of flows.
The flow editor: a palette of blocks, a canvas with connected blocks and an inspector
The editor: blocks on the left, the canvas in the middle.
A block selected in the editor, with its settings in the inspector
Select a block to set it.
  1. Switch Visual flows on in Settings → Plan & features (a Pro key). The Flows page appears.
  2. Press New flow, or start from an example: Blink every second, Button plays an effect, Traffic light (serial), Webhook alert, Blink a GPIO pin.
  3. Add blocks from the palette: Triggers (a Run button, on startup, every N seconds, a widget changes, an MQTT message, an HTTP hook, the board’s button), Logic (wait, if, repeat, split, set a value) and Actions (log, a light, a GPIO pin, and the blocks that modules add). Connect them by dragging from one block to the next.
  4. Select a block to set it in the inspector. Switch Active on, press Run to try it, and Save.