Home

Awesome

multiple-entity-row

Show multiple entity states, attributes and icons on entity rows in Home Assistant's Lovelace UI

GH-release GH-downloads GH-last-commit GH-code-size hacs_badge <a href="https://www.buymeacoffee.com/benct"><img src="https://cdn.buymeacoffee.com/buttons/default-yellow.png" height="20"></a>

NOTE: This is not a standalone lovelace card, but a row element for the entities card.

Installation

Manually add multiple-entity-row.js to your <config>/www/ folder and add the following to the configuration.yaml file:

lovelace:
  resources:
    - url: /local/multiple-entity-row.js?v=4.5.1
      type: module

OR install using HACS and add this (if in YAML mode):

lovelace:
  resources:
    - url: /hacsfiles/lovelace-multiple-entity-row/multiple-entity-row.js
      type: module

The above configuration can be managed in the Configuration -> Dashboards -> Resources panel when not using YAML.

Configuration

This card produces an entity-row and must therefore be configured as an entity in an entities card.

NameTypeDefaultDescription
typestringRequiredcustom:multiple-entity-row
entitystringRequiredEntity ID (domain.my_entity_id)
attributestringShow an attribute instead of the state value
namestring/boolfriendly_nameOverride entity friendly name
unitstring/boolunit_of_measurementOverride entity unit of measurement
iconstringiconOverride entity icon or image
imagestringShow an image instead of icon
toggleboolfalseDisplay a toggle (if supported) instead of state
show_statebooltrueSet to false to hide the main entity
state_headerstringShow header text above the main entity state
state_colorboolfalseEnable colored icon when entity is active
columnboolfalseShow entities in a column instead of a row
stylesobjectAdd custom CSS styles to the state element
formatstringFormattingFormat main state/attribute value
entitieslistEntity ObjectsAdditional entity IDs or entity object(s)
secondary_infostring/objectSecondary InfoCustom secondary_info entity
tap_actionobjectActionsCustom tap action on entity row and state value
hold_actionobjectCustom hold action on entity row
double_tap_actionobjectCustom double tap action on entity row

Entity Objects

Similarly as the default HA entities card, each entity can be specified by an entity ID string, or by an object which allows more customization and configuration.

If you define entities as objects, either entity, attribute or icon needs to be specified. entity is only required if you want to display data from another entity than the main entity specified above. attribute is necessary if you want to display an entity attribute value instead of the state value. icon lets you display an icon instead of a state or attribute value (works well together with a custom tap_action).

NameTypeDefaultDescription
entitystringA valid entity_id (or skip to use main entity)
attributestringA valid attribute key for the entity
namestring/boolfriendly_nameOverride entity friendly name (or false to hide)
unitstring/boolunit_of_measurementOverride entity unit of measurement (or false to hide)
toggleboolfalseDisplay a toggle if supported by domain
iconstring/boolfalseDisplay default or custom icon instead of state or attribute value
state_colorboolfalseEnable colored icon when entity is active
defaultstringDisplay this value if the entity does not exist or should not be shown
hide_unavailableboolfalseHide entity if unavailable or not found
hide_ifobject/anyHidingHide entity if its value matches specified value or criteria
stylesobjectAdd custom CSS styles to the entity element
formatstringFormattingFormat entity value
tap_actionobjectActionsCustom entity tap action

Note that hold_action and double_tap_action are currently not supported on additional entities.

Special attributes

Some special data fields from HA can be displayed by setting the attribute field to the following values:

ValueDescription
last-changedRenders the last_changed state of the entity if available
last-updatedRenders the last_updated state of the entity if available

Secondary Info

The secondary_info field can either be any string if you just want to display some text, an object containing configuration options listed below, or any of the default string values from HA (entity-id, last-changed, last-updated, last-triggered, position, tilt-position, brightness).

NameTypeDefaultDescription
entitystringA valid entity_id (or skip to use main entity)
attributestringA valid attribute key for the entity
namestring/boolfriendly_nameOverride entity friendly name (or false to hide)
unitstring/boolunit_of_measurementOverride entity unit of measurement (or false to hide)
hide_unavailableboolfalseHide secondary info if unavailable or not found
hide_ifobject/anyHidingHide secondary info if value matches specified criteria
formatstringFormattingFormat secondary info value

Actions

This card supports all the default HA actions. See Lovelace Actions for more detailed descriptions and examples.

NameTypeDefaultDescription
actionstringRequiredmore-info, toggle, call-service, url, navigate, fire-dom-event, none
entitystringOverride entity-id when action is more-info
servicestringService to call when action is call-service
service_dataobjectOptional data to include when action is call-service
url_pathstringURL to open when action is url
navigation_pathstringPath to navigate to when action is navigate
confirmationbool/objectfalseEnable confirmation dialog
hapticstringnoneHaptic feedback (success, warning, failure, light, medium, heavy, selection)

Formatting

The format option supports the following values:

ValueTypeDescription
relativetimestampConvert value to relative time (5 minutes ago)
totaltimestampConvert value to relative time (5 minutes)
datetimestampConvert timestamp value to date
timetimestampConvert timestamp value to time
datetimetimestampConvert timestamp value to date and time
brightnessnumberConvert brightness value to percentage
durationnumberConvert number of seconds to duration (5:38:50)
duration-mnumberConvert number of milliseconds to duration (5:38:50)
duration-hnumberConvert number of hours to duration (5:38:50)
invertnumberConvert number from positive to negative or vice versa
kilonumberDivide number value by 1000 (ex. 1500 W -> 1.5 kW)
positionnumberReverses a position percentage (ex. 70% open -> 30% closed)
precision<0-9>numberSet decimal precision of number value (precision3 -> 18.123)
celsius_to_fahrenheitnumberConverts a Celsius temperature to its Fahrenheit equivalent
fahrenheit_to_celsiusnumberConverts a Fahrenheit temperature to its Celsius equivalent

Hiding

The hide_if option can be used to hide an entity if its state or attribute value matches the specified criteria. It can be used directly with a string, number or boolean value (i.e. hide_if: 'off'), as a list with several values, or as an object with one or more of the options listed below.

NameTypeDescription
abovenumberHidden if entity number value is above the specified value
belownumberHidden if entity number value is below the specified value
valuelist/anyHidden if value matches specified value or any value in a list

Examples

multiple-entity-row

type: entities
entities:
  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: One entity
    secondary_info: last-changed
    entities:
      - sensor.bedroom_max_temp

  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Two entities
    secondary_info: last-changed
    entities:
      - sensor.bedroom_min_temp
      - sensor.bedroom_max_temp

  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Three entities
    secondary_info: last-changed
    entities:
      - entity: sensor.bedroom_humidity
        name: humidity
      - sensor.bedroom_min_temp
      - sensor.bedroom_max_temp

  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Custom secondary_info
    secondary_info:
      attribute: battery_level
      name: Battery
      unit: '%'

  - type: section
  - entity: vacuum.xiaomi_vacuum_cleaner
    type: custom:multiple-entity-row
    name: Attributes
    entities:
      - attribute: battery_level
        name: Battery
        unit: '%'
      - attribute: status
        name: Status

  - entity:  sensor.lovelace_multiple_entity_row
    type: custom:multiple-entity-row
    name: Attributes (show_state=false)
    show_state: false
    entities:
      - attribute: stargazers
        name: Stars
      - attribute: open_issues
        name: Issues
      - attribute: open_pull_requests
        name: PRs

  - type: section
  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Hide headers (name)
    entities:
      - entity: sensor.bedroom_min_temp
        name: false
      - entity: sensor.bedroom_max_temp
        name: false

  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Main state header
    state_header: current
    entities:
      - sensor.bedroom_min_temp
      - sensor.bedroom_max_temp

  - type: section
  - entity: switch.livingroom_tv
    type: custom:multiple-entity-row
    name: Toggle
    toggle: true
    state_color: true
    entities:
      - entity: sensor.livingroom_tv_power
        name: Power
      - entity: sensor.livingroom_tv_power_total
        name: Total

  - entity: switch.livingroom_tv
    type: custom:multiple-entity-row
    name: Multiple toggles
    state_header: main
    toggle: true
    state_color: true
    entities:
      - entity: switch.livingroom_light
        name: toggle1
        toggle: true
      - entity: switch.livingroom_light_2
        name: toggle2
        toggle: true

  - type: section
  - entity: light.living_room
    type: custom:multiple-entity-row
    name: Toggle with hold_action
    state_header: Livingroom
    toggle: false
    hold_action:
      action: toggle
    entities:
      - entity: light.nightstand
        name: Bedroom
        tap_action:
          action: toggle

  - entity: light.living_room
    type: custom:multiple-entity-row
    name: Icons with tap_action
    secondary_info: last-changed
    entities:
      - entity: light.living_room
        icon: mdi:palette
      - icon: mdi:lightbulb-off-outline
        state_color: true
        tap_action:
          action: call-service
          service: light.turn_off
          service_data:
            entity_id: light.living_room
      - icon: mdi:lightbulb-outline
        state_color: true
        tap_action:
          action: call-service
          service: light.turn_on
          service_data:
            entity_id: light.living_room
          confirmation:
            text: 'Are you sure?'

  - type: section
  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Customization
    icon: mdi:fire
    unit: °F
    secondary_info: last-changed
    entities:
      - entity: sensor.bedroom_max_temp
        name: custom name
        unit: temp

  - type: section
  - entity: sensor.bedroom_temperature
    type: custom:multiple-entity-row
    name: Styles
    styles:
      width: 80px
      text-align: right
    secondary_info:
      attribute: battery_level
      styles:
        font-weight: bold
    entities:
      - entity: sensor.bedroom_max_temp
        styles:
          width: 80px
          text-align: left

My cards

xiaomi-vacuum-card | multiple-entity-row | github-entity-row | battery-entity-row | attribute-entity-row

BMC