History graph card


The history graph card allows you to display a graph for each of up to eight entities.

Screenshot of the history graph card for entities without a unit_of_measurement Screenshot of the history graph card, when the sensor has no `unit_of_measurement` defined.

Screenshot of the history graph card for entities with a unit_of_measurement Screenshot of the history graph card, when the sensor has a `unit_of_measurement` defined.

To add the history 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

history-graph

entities list Required

A list of entity IDs or entity objects, see below.

hours_to_show integer (Optional, default: 24)

Hours to show in graph. Minimum is 1 hour. Big values can result in delayed rendering, especially if the selected entities have a lot of state changes.

title string (Optional)

The card title.

show_names boolean (Optional, default: true)

If false, no entity names are shown in the card.

logarithmic_scale boolean (Optional, default: false)

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

min_y_axis float (Optional)

Lower bound for the Y-axis range.

max_y_axis float (Optional)

Upper bound for the Y-axis range.

fit_y_data boolean (Optional, default: false)

If true, configured Y-axis bounds would automatically extend (but not shrink) to fit the data.

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.

Examples

type: history-graph
title: 'My Graph'
entities:
  - sensor.outside_temperature
  - entity: media_player.lounge_room
    name: Main player

Or with longer time frame, and multiple entities (as long as they share the same unit_of_measurement) in one graph:

type: history-graph
title: "Temperatures in the last 48 hours"
hours_to_show: 48
entities:
  - sensor.outside_temperature
  - entity: sensor.lounge_temperature
    name: "Lounge"
  - entity: sensor.attic_temperature
    name: "Attic"

Related topics