Value
A Value widget shows a reading from your device as a number: temperature, voltage, tank level. Pick how it looks from nine display modes.
Try it
Turn the sensor knob on the NuttyFi board. The board writes the reading and the dashboard shows it. Try the Value Display Mode, UNITS and DECIMALS settings.
How to add and set up
- Open the dashboard in edit modeOpen the device and turn on editing.
- Add a ValuePress + on the right edge of the canvas and pick Value. Drag it into place.
- Open its settingsClick the gear icon on the widget. The window title shows the widget's name.
- Link a Telemetry PointUnder Linked Telemetry Points, pick the point your device writes, and set its UNITS, MIN, MAX and DECIMALS.
- Pick a display modeChoose a Value Display Mode and a colour. Save, then press DONE.
Settings
| Setting | What it does |
|---|---|
| Widget Name | The title shown on the widget. |
| Label Color | Colour of the title. |
| Linked Telemetry Points | The Telemetry Point (TP0, TP1…) the widget uses. Your device code uses the same point. |
| Value Display Mode | Pie Ring · Value Card (big value, change, last update) · Needle · Trend Card (value + sparkline) · Target Meter (now vs max) · Recent Bars (avg / min / max) · Digital · Compact Pill · Status Badge (Low / Normal / High). Try all nine in the simulation above. Trend Card, Target Meter, Recent Bars, Digital, Compact Pill and Status Badge need Starter or above. |
| Telemetry Point settings | The linked point carries the DATA TYPE (integer or double), UNITS, MIN, MAX, DECIMALS and DEFAULT the widget uses. |
| Widget Color | Accent colour of the ring, bars or badge. |
| Hide widget Name / Telemetry Point / Widget Border | Hide the title, the TP badge or the outline around the tile. |
What it reads
The widget shows the latest number written to the Telemetry Point, rounded to its DECIMALS and followed by its UNITS. Ring and meter modes use MIN and MAX to work out how full to draw. Status Badge says Low below 25 % of the range, High above 75 % and Normal in between.
Send data from your device
A Value widget shows the number your board writes with SME.publish(). The examples use TP0.
SME.publish(TP0, reading);
unsigned long lastSend = 0;
void loop()
{
SME.run();
if (millis() - lastSend >= 2000) { // every 2 seconds
lastSend = millis();
SME.publish(TP0, analogRead(A0));
}
}int percent = map(analogRead(A0), 0, 1023, 0, 100); SME.publish(TP0, percent); // shown as 0 to 100 %
#define DASHBOARD_ID "PROJ-XXXXXXXX"
#define DEVICE_TOKEN "SME-XXXX-XXXX-XXXX"
#define FIRMWARE_VERSION "1.0.0"
#define WIFI_SSID "your_wifi"
#define WIFI_PASS "your_pass"
#include <SMEIoT.h>
unsigned long lastSend = 0;
void setup()
{
Serial.begin(115200);
SME.begin(DASHBOARD_ID, DEVICE_TOKEN, FIRMWARE_VERSION,
WIFI_SSID, WIFI_PASS);
}
void loop()
{
SME.run(); // keeps the link alive
if (millis() - lastSend >= 2000) { // every 2 seconds
lastSend = millis();
float temperature = analogRead(A0) * 100.0 / 1023; // your sensor
SME.publish(TP0, temperature); // Value widget on TP0
}
}loop(). Send when the value changes, or on a timer, for example every one or two seconds.These are snippets. Your sketch also needs #include <SMEIoT.h>, SME.begin(...) in setup() and SME.run() in loop(). The full sketch tab shows a complete example; see the SDK quick start for more.
Docs