Widgets

Docs/Widgets
SME AIoT · Widgets

Widgets: the control room for every device

Widgets are the building blocks of a device dashboard. Each one is linked to a Telemetry Point (TP0, TP1 … TP127) — the same point your NuttyFi code reads with SME_LISTEN or writes with SME.publish. How many points a device can use depends on your plan.

Control · dashboard → device Display · device → dashboard Two-way · both directions Layout
Pump station 01OnlineThese are the real dashboard widgets · tap the switch, hold the button, drag the slider
NuttyFiidle
Widget library

Pick a widget

Three controls, five displays, a two-way Messenger and one layout widget. Every guide includes a live simulator and the device code.

No widget matches that — try “switch”, “gauge” or “graph”.
Choosing

Which widget do I need?

Start from what you want to do on site, then pick the widget.

I want to…UseData flowDevice code
Turn a pump, relay or light on and offSwitchdashboard → deviceSME_LISTEN(TPn)
Trigger a short action, like a buzzerPush Buttondashboard → deviceSME_LISTEN(TPn)
Set motor speed or brightnessSliderdashboard → devicedata.toInt()
See whether something is runningLEDdevice → dashboardSME.publish(TPn, 0 / 1)
Read a sensor value with its unitValuedevice → dashboardSME.publish(TPn, value)
Watch a level against safe and danger zonesGaugedevice → dashboardSME.publish(TPn, value)
Follow a trend over minutes, days or monthsGraphdevice → dashboardSME.publish(TPn, value)
Show several readings together on one screenTFT Displaydevice → dashboardSME.publish(TPn, value)
Chat with the device: commands, replies, alertsMessengerdashboard ↔ deviceSME_LISTEN + SME.publish
Keep a busy dashboard tidyContainerlayout only—
Device side

Two directions, two lines of code

Controls are listened to, displays are published to, and Messenger does both. Container needs no code. That is all the device needs to know.

Publish as often as every second on any plan. Plans limit data points per month, not speed, so send at a steady interval rather than on every loop.

Controls → SME_LISTENSwitch, Push Button and Slider send a value to the device. The code inside SME_LISTEN(TPn) runs each time it changes; read it with data.toInt().
Displays ← SME.publishLED, Value, Gauge, Graph and TFT Display show what the device sends with SME.publish(TPn, value). Send at a steady interval, not on every loop.
Two-way → bothMessenger receives your text with SME_LISTEN(TPn), read with data.toString(), and replies with SME.publish(TPn, "text") on the same point.
Layout → no codeContainer only arranges the dashboard; the widgets inside keep their own Telemetry Points.
// Switch on TP0 drives the pump relay
#define RELAY_PIN 5

SME_LISTEN(TP0) {
  int on = data.toInt();      // 1 = on, 0 = off
  digitalWrite(RELAY_PIN, on);
  SME.publish(TP3, on);       // LED widget shows the real state
}

// Slider on TP1 sets the speed (0 - 100)
SME_LISTEN(TP1) {
  int speed = data.toInt();
  analogWrite(4, map(speed, 0, 100, 0, 1023));
}
How to

Adding any widget

On Freeware a dashboard holds up to 8 widgets and 2 graphs. See pricing for other plans.

STEP 01Edit the dashboardOpen the device and turn on editing. Press + on the right edge of the canvas and pick a widget.
STEP 02Link a Telemetry PointClick the gear icon and choose the point under Linked Telemetry Points.
STEP 03Style and saveSet the name and colour, save, then press DONE.
New to SME AIoT?Get your first NuttyFi board online, then come back and build its dashboard. No account yet? Freeware is by invite from an existing user, or start with Starter or the Student Pass.
Docs home Talk to our team →