Energy Card
This feature is only available in ESP-DASH Pro
A card that displays energy usage with a distinctive energy/power icon. Supports numeric and string values with optional units/symbols, perfect for showing power consumption, usage, or similar measurements.
Initializer
/*
Energy Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name, const char* symbol (optional) )
*/
Card card1(&dashboard, ENERGY_CARD, "Power Consumption", "kWh");
Callback
💡
Energy card doesn’t require any callback.
Updater
card1.update(int value);
card1.update(float value);
card1.update(String value);
Or you can also update the symbol along with the value like this:
card1.update(value, "kWh");
Reference
This is a reference sketch showing positions for intializer and updater.
...
/* Energy card initializer */
Card energy(&dashboard, ENERGY_CARD, "Power Consumption", "kWh");
void setup() {
...
/* Energy card updater - can be used anywhere (apart from global scope) */
energy.update(100);
}
void loop() {
...
}