Statistics graph card


The statistics graph card allows you to display a graph of statistics data for each of the entities listed.

Screenshot of the statistics graph card for power entities Screenshot of the statistics graph card with none metered entities and `chart_type` `line`.

Screenshot of the statistics graph card for energy entities Screenshot of the statistics graph card with a metered entity and `chart_type` `bar`.

Statistics are gathered every 5 minutes and also hourly for sensors that support it. The 5-minute statistics will be retained for the duration set in the recorder configuration, and hourly statistics will be retained indefinitely. It will either keep the min, max, and mean of a sensor’s value for a specific hour or the sum for a metered entity.

If your sensor doesn’t work with statistics, check this.

To add the statistics graph card to your user interface:

  1. In the top right of the screen, select the pencil icon.
    • If this is your first time editing a dashboard, the Edit dashboard dialog appears.
      • By editing the dashboard, you are taking over control of this dashboard.
      • This means that it is no longer automatically updated when new dashboard elements become available.
      • To continue, in the dialog, select the three dots menu, then select Take control.
  2. Add a card to your dashboard.

All options for this card can be configured via the user interface.

YAML configuration

The following YAML options are available when you use YAML mode or just prefer to use YAML in the code editor in the UI.

Configuration Variables

type string Required

statistics-graph

entities list Required

A list of entity IDs or entity objects (see below), or an external statistic id

days_to_show integer (Optional, default: 30)

Days to show in graph. Minimum is 1 day.

chart_type string (Optional)

If the graph should be rendered as a bar or a line chart.

stat_types list (Optional)

The statistics types to render. min, max, mean, sum, state, change

title string (Optional)

The card title.

period string (Optional)

The period of the rendered graph. 5minute, hour, day, week or month

hide_legend boolean (Optional, default: false)

If true, the legend will be hidden.

logarithmic_scale boolean (Optional, default: false)

If true, numerical values on the Y-axis will be displayed with a logarithmic scale.

Options for entities

If you define entities as objects instead of strings, you can add more customization and configuration:

Configuration Variables

entity string Required

Entity ID.

name string (Optional)

Overwrites friendly name.

Example

type: statistics-graph
title: 'My Graph'
entities:
  - sensor.outside_temperature
  - entity: sensor.inside_temperature
    name: Inside

Related topics