Repository navigation
Style State Duration
How long each entity spent in each state, per hour, day, week or month, as stacked columns: hours of heating a day, time the dishwasher ran, days someone was away. It reads states the way the state timeline does and groups them the way the column chart does.
A thermostat's hvac_action (heating, idle, off), a switch or a plug, a person's home and away, a washing machine's programme: anything whose states are words.
type: custom:chartdeck-card
style: state_duration
title: Heating per day
entities:
- entity: climate.hall
attribute: hvac_actionTo use this style, set style: state_duration (or pick Time in each state under History charts in the editor's Style section). The chart options are in the editor's Chart section.
-
Period: the last 7 days when
periodisn't set, as on the column chart. -
Grouping (
group_by: auto) picks a size for the span, as the column chart does: hours up to two days, days up to two months, then weeks, then months. Today is grouped by hour, a week or a month by day, and a year by month. - The value axis runs to the longest group: 24 hours a day (25 on the day the clocks go back), or 60 minutes an hour, with a line every 6 hours or 15 minutes.
- Colours are the state timeline's: the theme's colour for the state where it has one, else a built-in one. Quiet states (off, idle, away and the like) are grey, each a little fainter than the one under it, with a thin line between slices so they stay apart.
- Stack order: the busiest active state at the bottom, quiet states on top.
- Unavailable and unknown are gaps, not slices. Today counts up to now.
group_by: day # auto (default), hour, day, week or month
stack: normal # normal (default): hours, or minutes by hour; percent: share of the time recorded
states: [heating, idle] # optional: which states to show, bottom first
labels: true # the time on each slice with room for it (default false)
state_colors: # your own colour for any state: palette name or CSS colour
idle: green-
stack: percentscales each column to 100 % of the time that was recorded, so a part-day today still reaches the top. -
statesshows only those states, in that order from the bottom. Other states are left out. -
labels: truewrites the time on each slice tall and wide enough for it. -
state_colorswins over every other colour, as on the state timeline. - With several entities, each has its own column in every group.
- Per entity,
attributereads one of its attributes instead of the state, such as a thermostat'shvac_action. - A sensor whose states are numbers is a measurement rather than states, and the chart says "Readings, not states: a line chart suits this one". With nothing recorded it says "No states recorded in this period."
- States are only in the recorder's history, which long-term statistics don't keep, so
sourcemust behistory. - A per-entity
whenhides the time its condition didn't hold.
Hovering or touching a column shows each entity's time in each state for that group. Tapping a column opens the entity's more-info dialog.
In the editor: the period options, Group readings by (with Automatic) and Stack, States to show, bottom first (empty: every state), Show values on the columns, the axes and layout options, and a State colours list where you add a state and its colour.
The period, calendar spans and previous and next buttons are the same as on the line chart. See Line.
Layout: one chart for the whole card. Every shared option is described on the Options page.
Previous: Duration curve · All styles
Start
Using it
-
Styles
- Bar
- Thin
- Segmented
- Tank
- Ring
- Needle
- Arc
- Line
- Area
- Column
- Combined
- Pie and donut
- Rings
- Pictograph
- Waffle
- Histogram
- Scatter
- Bubble
- Heatmap
- Box plot
- Funnel
- Waterfall
- Treemap
- Sunburst and icicle
- Radar
- Polar area
- Grouped and stacked bars
- Bullet
- Lollipop
- Slope
- Dumbbell
- Range area
- Sparkline
- Streamgraph
- Candlestick
- Violin and raincloud
- Beeswarm
- State timeline
- Climate
- Sankey
- Wind rose
- 24-hour clock
- Trend
- Marimekko
- Chord
- Battery grid
- Spiral
- Strip plot
- Cycle plot
- Duration curve
- Time in each state
- Badge
- Tile feature
- Options
- Visual editor
- Colour bands
Help