Statistic Card
The Statistic card allows you to display a statistical value for an entity.
Statistics are gathered every 5 minutes for sensors that support it. It will either keep the min
, max
and mean
of a sensors value for a specific period, or the sum
for a metered entity.
If your sensor doesn’t work with statistics, check this.
Screenshot of the statistic card for a temperature sensor.
To add the Statistic card to your user interface, click the menu (three dots at the top right of the screen) and then Edit Dashboard. Click the “Add Card” button in the bottom right corner and select Statistic from the card picker. All options for this card can be configured via the user interface, but if you want more options for the period, you will have to define them in yaml
.
Configuration Variables
Unit of measurement given to data.
Unit of measurement given by entity.
The period to use for the calculation. See below.
Override the used theme for this card with any loaded theme. For more information about themes, see the frontend documentation.
Footer widget to render. See footer documentation.
Example
Alternatively, the card can be configured using YAML:
type: statistic
entity: sensor.energy_consumption
period:
calendar:
period: month
stat_type: change
Options For Period
Periods can be configured in 3 different ways:
Calendar
Use a fixed period with an offset from the current period.
Example, the change of the energy consumption during last month:
type: statistic
entity: sensor.energy_consumption
period:
calendar:
period: month
offset: -1
stat_type: change
Fixed period
Specify a fixed period, the start and end are optional.
Example, the change in 2022:
type: statistic
entity: sensor.energy_consumption
period:
fixed_period:
start: 2022-01-01
end: 2022-12-31
stat_type: change
Example, all time change, without a start or end:
type: statistic
entity: sensor.energy_consumption
period:
fixed_period:
stat_type: change
Rolling Window
Example, a period of 1 hour, 10 minutes and 5 seconds ending 2 hours, 20 minutes and 10 seconds before now:
type: statistic
entity: sensor.energy_consumption
period:
rolling_window:
duration:
hours: 1
minutes: 10
seconds: 5
offset:
hours: -2
minutes: -20
seconds: -10
stat_type: change