Entity definitions¶
Entities are configured in the entities section of the Flexible Horseshoe Card.
In most cases, the only required field is the Home Assistant entity ID. The card can then use metadata already available in Home Assistant, including the entity name, area, icon, unit, precision, state formatting, and localization.
A minimal entity definition can therefore remain very small:
Where available, the card uses Home Assistant metadata automatically. Names, areas, states, numbers, and units follow the language and locale configured in Home Assistant.
You can override these defaults when needed. For example, you can provide a custom name or icon, change the number of decimals, display an attribute instead of the main state, or use a JavaScript template to calculate a dynamic value.
Basic usage¶
A basic definition points to a single entity:
You can also define multiple entities. Layout sections such as states, names, areas, and icons refer to them by entity_index.
The first entry has index 0, the second has index 1, and so on.
Sparkline values as entities¶
A sparkline can make its statistics and active history settings available as regular card entities. Add only the values you want to use to entities, then refer to them by entity: or by their normal entity_index from states, names, icons, texts, or other layout items.
The entity ID starts with fhs_sparkline, followed by the sparkline id and the requested value:
The available values are:
| Suffix | Value |
|---|---|
min | Minimum value in the displayed period |
avg | Average value in the displayed period |
max | Maximum value in the displayed period |
min_time | Time at which the minimum occurred |
max_time | Time at which the maximum occurred |
duration | Active history duration, shown in minutes, hours, or days |
bin_duration | Actual duration of each bin, shown in minutes, hours, or days |
aggregate_func | Function used for each bin, such as avg, min, max, or median |
When a sparkline declares explicit series, insert the series ID before the value suffix. The default single-series names above remain unchanged:
The resulting names are fhs_sparkline.<sparkline_id>_<series_id>_<value>. The series ID is matched against the declared configuration, so underscores in that ID remain unambiguous. Each derived value uses the source entity and the statistics of its own series.
A direct entity: reference is independent of list order. Card templates can place these entries in default_entities so every template instance receives the local values without changing the indices of entities supplied by the card.
Flexible Horseshoe Card automatically connects these values to the source entity used by the matching sparkline. Units, number formatting, and More info actions therefore continue to use that source sensor. You do not configure a separate source index.
Duration and bin size use Home Assistant duration formatting. For example, a bin duration of 0.5 hours is displayed as a localized duration with zero hours and thirty minutes. A setting that does not apply to the active graph type is shown using Home Assistant's translated Unavailable state.
Entity metadata from Home Assistant¶
The card uses Home Assistant metadata wherever possible. This keeps the YAML concise and helps the card remain consistent with the rest of your dashboard.
The following values can usually be obtained automatically:
| Value | Description |
|---|---|
| Name | Friendly name assigned to the entity |
| Area | Home Assistant area assigned to the entity |
| State | Current entity state |
| Unit | Unit of measurement, such as kWh, W, %, or °C |
| Precision | Number formatting or precision defined for the entity |
| Icon | Entity icon, including state-based icons where supported |
| Icon color | State-based icon color when Home Assistant provides one |
| Localization | Translated names and states, plus locale-aware number formatting |
You usually do not need to repeat the name, unit, icon, or precision unless this card should display the entity differently.
Displaying an entity¶
You can override Home Assistant metadata directly in the entity definition:
| Displaying an entity | |
|---|---|
This example uses a custom name, icon, area, and precision instead of relying entirely on the Home Assistant defaults.
Displaying an attribute¶
An entity definition can display an attribute instead of the main state. This is useful for entities that expose several related values, such as weather entities.
| Displaying an attribute | |
|---|---|
You can also define multiple attributes from the same entity as separate entries:
| Entities with attributes | |
|---|---|
Each entry receives its own entity_index, even when several entries refer to the same Home Assistant entity.
Overriding entity values¶
The card can use Home Assistant defaults automatically, but you can override them in the entities section:
| Entities with overrides | |
|---|---|
Common reasons to override values include:
- using a shorter name on a compact card;
- displaying fewer or more decimals;
- choosing a card-specific icon;
- placing an entity under a different area label;
- giving an attribute its own name and unit.
Shared color stops¶
Define color_stops on an entity when several layout items should use the same thresholds and colors:
A layout item uses these colors after selecting show.item_style: colorstop or show.item_style: colorstopgradient. Entity-level color stops remain inactive for items that do not select either mode. A color_stops definition on the layout item overrides the entity definition for that item.
Overriding entity formatting¶
The format option overrides the default Home Assistant formatting for an entity.
| Remove separator and limit decimals | |
|---|---|
| Display raw entity state as received from integration | |
|---|---|
Dynamic entity values¶
Some entity fields can use JavaScript templates. This allows parts of the entity definition to change in response to current entity states.
Use this when a name, icon, area, unit, or another supported value should be calculated dynamically instead of remaining fixed.
For example, the name can depend on the state of another entity:
Here, the first entity changes its displayed name according to whether the second entity is on.
Supported icon fields can also use templates:
| Dynamic entity icon | |
|---|---|
Templates in the entities section use the same [[[ ... ]]] syntax as other JavaScript templates in the card.
Dynamic values are evaluated during updates
JavaScript templates are dynamic. They can react to entity states and may be evaluated again whenever the card updates.
This differs from static reuse features such as same_as, calc(), constants, and ref(), which are resolved during card setup.
For details about JavaScript templates, available variables, and reusable template variables, see the templating documentation.
Available entity options¶
| Name | Type | Required | Description |
|---|---|---|---|
entity | string | Home Assistant entity ID or a local fhs_input_number, fhs_input_select, or fhs_input_boolean ID | |
attribute | string | Attribute to display instead of the main entity state | |
unit | string | Unit displayed for the entity or attribute; can use a JavaScript template where supported | |
decimals | number | Number of decimals used to format the value | |
name | string | Custom name that overrides the Home Assistant friendly name; can use a JavaScript template where supported | |
area | string | Custom area that overrides the Home Assistant area for this card; can use a JavaScript template where supported | |
icon | string | Custom icon, image, SVG, or JavaScript template | |
format | object | Custom formatting options for the entity state | |
tap_action | object | Action performed when the entity is clicked or tapped | |
hold_action | object | Action performed when the entity is held | |
double_tap_action | object | Action performed when the entity is double tapped | |
initial | number/string/boolean | Initial value for a local Flexible Horseshoe Card input; a select defaults to its first option and a boolean defaults to off | |
options | list | select only | Non-empty list of unique strings available to an fhs_input_select |
min | number | Lowest value accepted by a local fhs_input_number | |
max | number | Highest value accepted by a local fhs_input_number | |
step | number | Increment/decrement amount for a local fhs_input_number; default: 1 | |
scope | string | Keeps a local input in one card or shares it with all Flexible Horseshoe Card cards in the current browser tab; default: card | |
persist | boolean | Restores a global local input after a page reload; default: false |
Available entity format options¶
| Name | Type | Required | Description |
|---|---|---|---|
separator | boolean | Enables or disables the separator in a numeric state | |
decimals_min | number | Minimum number of decimals used to format the value | |
decimals_max | number | Maximum number of decimals used to format the value | |
raw_state_keep | boolean | Keeps the raw entity state and prevents normal formatting or translation | |
raw_state_clean | boolean | Removes underscores from the raw entity state | |
locale | string | Locale used to display and format the entity |
Icon options¶
When no icon is specified, the card uses the Home Assistant entity icon where possible.
You can override it with an MDI icon, external image, external SVG, or JavaScript template.
| Icon type | Example | Description |
|---|---|---|
| MDI icon | icon: mdi:lightbulb | Uses a Material Design icon |
| External image | icon: url(/local/icons/icon-image.png) | Uses an image file as the icon |
| External SVG | icon: url(/local/icons/icon-svg.svg) | Uses an SVG file as the icon |
| JavaScript template | icon: \| with [[[ ... ]]] | Returns the icon dynamically |
Actions and local controls¶
Entities support tap_action, hold_action, and double_tap_action using the current Home Assistant dashboard action format. An individual layout item can override the action configured on its entity. Flexible Horseshoe Card also supports ordered action lists, Companion-app haptic feedback, and browser-local number, select, and boolean inputs.
See Actions and Local Controls for the available actions and complete examples.
Entity layout elements¶
Defining an entity does not automatically display every part of it. The entities section defines the data source, while the layout sections determine what appears and where it is positioned.
| Entity part | Layout section | Description |
|---|---|---|
| Area | areas | Displays the Home Assistant area or a custom area |
| Name | names | Displays the entity name or a custom name |
| State | states | Displays the entity state, including its unit and decimals |
| Icon | icons | Displays the entity icon or a standalone icon |
For detailed configuration of areas, names, states, and icons, see Tools.
For translated names and states, localized units, state colors, and number formatting, see Localization.