Cards
You are reading the documentation for ESP-DASH v4.x.x, which is no longer the latest release. View the v5.x.x documentation.Temperature Card
Display temperature readings with a temperature icon and an optional unit symbol on the ESP-DASH v4 dashboard.
The temperature card displays a value next to a temperature icon, with an optional unit symbol such as °C or °F.

Constructor
Card temperature(&dashboard, TEMPERATURE_CARD, "Temperature", "°C");Prop
Type
Methods
update()
Sets the displayed value. Call dashboard.sendUpdates() afterwards to push the change to connected clients.
temperature.update(int value);
temperature.update(float value);
temperature.update(const char* value);
temperature.update(const String &value);Each overload also accepts a second const char* symbol argument that replaces the card's symbol:
temperature.update(value, "°F");Example
#include <Arduino.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#elif defined(ESP32)
#include <WiFi.h>
#include <AsyncTCP.h>
#endif
#include <ESPAsyncWebServer.h>
#include <ESPDash.h>
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
AsyncWebServer server(80);
ESPDash dashboard(&server);
Card temperature(&dashboard, TEMPERATURE_CARD, "Temperature", "°C");
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi connection failed");
return;
}
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop() {
static unsigned long lastUpdate = 0;
if (millis() - lastUpdate > 3000) {
lastUpdate = millis();
temperature.update(22.5f + random(0, 50) / 10.0f);
dashboard.sendUpdates();
}
}