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.
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.
Switch
Turn a relay, pump or light on and off. Stays where you leave it.
SME_LISTEN(TP0) { … }Open guide →Push Button
Push for momentary actions like a buzzer, or latch like a switch.
SME_LISTEN(TP2) { … }Open guide →Slider
Send a number in a range, like motor speed or brightness.
SME_LISTEN(TP1) { … }Open guide →Gauge
Show a reading on a dial, with eight styles and colour zones.
SME.publish(TP5, level)Open guide →Graph
Plot readings over time, from live up to one year, depending on your plan's data history.
SME.publish(TP6, value)Open guide →Value
Show a reading as a number with its unit.
SME.publish(TP4, temp)Open guide →LED
Show a state the device reports. Bulb or dimming Solid Dot.
SME.publish(TP3, 1)Open guide →Messenger
Chat with the device: send commands, get replies and alerts as text.
SME_LISTEN + SME.publishOpen guide →TFT Display
Show up to eight readings together on one screen, like a real TFT panel.
SME.publish(TPn, value)Open guide →Container
Group related widgets into one tile to keep a busy dashboard tidy.
dashboard onlyOpen guide →Which widget do I need?
Start from what you want to do on site, then pick the widget.
| I want to… | Use | Data flow | Device code |
|---|---|---|---|
| Turn a pump, relay or light on and off | Switch | dashboard → device | SME_LISTEN(TPn) |
| Trigger a short action, like a buzzer | Push Button | dashboard → device | SME_LISTEN(TPn) |
| Set motor speed or brightness | Slider | dashboard → device | data.toInt() |
| See whether something is running | LED | device → dashboard | SME.publish(TPn, 0 / 1) |
| Read a sensor value with its unit | Value | device → dashboard | SME.publish(TPn, value) |
| Watch a level against safe and danger zones | Gauge | device → dashboard | SME.publish(TPn, value) |
| Follow a trend over minutes, days or months | Graph | device → dashboard | SME.publish(TPn, value) |
| Show several readings together on one screen | TFT Display | device → dashboard | SME.publish(TPn, value) |
| Chat with the device: commands, replies, alerts | Messenger | dashboard ↔ device | SME_LISTEN + SME.publish |
| Keep a busy dashboard tidy | Container | layout only | — |
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.
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().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.SME_LISTEN(TPn), read with data.toString(), and replies with SME.publish(TPn, "text") on the same point.// 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)); }
// Value, Gauge and Graph read what you publish unsigned long last = 0; void loop() { SME.run(); if (millis() - last > 2000) { // every 2 s last = millis(); float temp = readTemperature(); // your sensor float flow = readFlow(); SME.publish(TP4, temp); // Value SME.publish(TP5, flow); // Gauge SME.publish(TP6, temp); // Graph } }
Adding any widget
On Freeware a dashboard holds up to 8 widgets and 2 graphs. See pricing for other plans.
Docs