Skip to content

State

The State tool shows the current value of a Home Assistant entity or attribute.

By default, the Flexible Horseshoe Card follows Home Assistant formatting for the value and unit, including locale, number formatting, and display precision.

Basic configuration

Add states under layout.states:

entities:
  - entity: sensor.living_room_temperature

layout:
  states:
    - id: temperature
      entity_index: 0
      xpos: 50
      ypos: 50
      styles:
        font-size: 2em

entity_index selects the entity whose state is displayed.

xpos and ypos position the state on the card.

See Positioning and sizing for the card coordinate system.

Configuration options

Field Required Default Description
entity_index Yes Entity whose state is displayed
xpos Yes Horizontal position
ypos Yes Vertical position
show.uom No end Places the unit at end, top, or bottom
uom.styles No Unit styling
ellipsis No Maximum number of displayed state characters
styles No Default state style SVG and CSS styling
color_stops No Not set Colors the state from the entity value

State and unit appearance

Use styles to change the appearance and alignment of the state.

layout:
  states:
    - entity_index: 0
      xpos: 50
      ypos: 50
      styles:
        font-size: 2.5em
        font-weight: bold
        text-anchor: middle
        fill: var(--primary-text-color)
        opacity: 1

The unit can be styled separately with uom.styles:

layout:
  states:
    - entity_index: 0
      xpos: 50
      ypos: 50
      styles:
        font-size: 2em
      uom:
        styles:
          font-size: 0.7em
          opacity: 0.6

Common styles include:

Property Use
font-size Text size
font-weight Text weight
text-anchor Horizontal alignment using start, middle, or end
fill Text color
opacity Text opacity

See Styling for the complete styling guide.

Keep long values readable

Use ellipsis to limit the number of displayed characters:

1
2
3
4
5
6
layout:
  states:
    - entity_index: 0
      xpos: 50
      ypos: 50
      ellipsis: 12

The value is shortened after the configured number of characters. Its unit remains visible.

Formatting values

State values follow Home Assistant localization and formatting by default.

Configure decimals, units, locale, and other formatting options on the entity in the card's entities list. The same formatting is then used wherever that entity is shown in the card.

1
2
3
entities:
  - entity: sensor.living_room_temperature
    decimals: 1

See Entities for entity configuration and Localization and formatting for formatting options.

Show values in color

Use color stops when the state should change color based on its value:

layout:
  states:
    - entity_index: 0
      xpos: 50
      ypos: 50
      show:
        item_style: colorstop
      color_stops:
        colors:
          0: green
          50: orange
          100: red

The State tool applies the matching color to the displayed value.

See Color stops for ranges, gradients, palettes, and interpolation.