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.Progress Bar Card
Show a value within a fixed integer or float range as a horizontal progress bar on the ESP-DASH v4 dashboard.
The progress bar card renders a horizontal bar that represents a value within a fixed range. Use it to show completion, levels or utilization.

Constructor
Pass the min and max of the range to display.
Card progress(&dashboard, PROGRESS_CARD, "Progress", "", 0, 255);For a fractional range, use the float overload. This overload has no default arguments: pass symbol explicitly, and pass min, max and step as float values.
Card progress(&dashboard, PROGRESS_CARD, "Progress", "", 0.0f, 1.0f, 0.01f);Prop
Type
Methods
update()
Sets the current value. Call dashboard.sendUpdates() afterwards to push the change to connected clients.
progress.update(int value);
progress.update(float value);Pass a second const char* symbol argument to change the symbol at the same time:
progress.update(244, "%");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 progress(&dashboard, PROGRESS_CARD, "Progress", "", 0, 255);
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();
progress.update((int)random(0, 255));
dashboard.sendUpdates();
}
}