Home

Awesome

battery-entity-row

Show battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI

GH-release GH-downloads GH-last-commit GH-code-size hacs_badge

Rewritten and improved version of cbulock's battery-entity card (deprecated/unmaintained).

NOTE: This is not a standalone lovelace card, but a row element for the entities card. If you need a standalone card or want a lot more customizability, check out maxwroc's battery-state-card.

Installation

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

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

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

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

The above configuration can be managed directly in the Configuration -> Lovelace Dashboards -> Resources panel when not using YAML mode, or added by clicking the "Add to lovelace" button on the HACS dashboard after installing the plugin.

Configuration

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

The battery level value is fetched from the entity state, from the attribute battery or battery_level, or from a custom attribute defined with the attribute option. Numeric values (0-100) and some predefined string values (high, normal, low, etc..) are supported as a battery level value.

NameTypeDefaultDescription
typestringRequiredcustom:battery-entity-row
entitystringRequireddomain.my_entity_id
attributestringbattery_levelOverride battery level attribute
namestringfriendly_nameOverride entity friendly_name
secondary_infostringlast-changed, last-updated or an attribute of the entity.
unitstring/bool%Override default unit, or hide with false
iconstringOverride dynamic battery icon
warningnumber35Level at which the icon will appear yellow
criticalnumber15Level at which the icon will appear red
chargingbool/objectfalseIndicate charging based on entity state. See charging object for more options.

Currently limited support for secondary_info option with value last-changed.

Charging object

NameTypeDefaultDescription
entitystringmain entityGet charging state from another entity
attributestringGet charging state from an attribute
statestring/list"on", "charging"Add values that indicate charging (case insensitive)

Examples

battery-entity-row

type: entities
entities:
  - type: custom:battery-entity-row
    entity: sensor.bedroom_temperature

  - type: custom:battery-entity-row
    entity: sensor.bedroom_temperature
    attribute: battery_percent
    name: Some battery
    unit: percent
    icon: mdi:battery-alert
    secondary_info: last-changed
    warning: 50
    critical: 25
    charging: true

  - type: custom:battery-entity-row
    entity: sensor.bedroom_temperature
    name: Charging battery
    charging:
      entity: binary_sensor.bedroom_temperature_charger
      attribute: charging
      state:
        - Enabled
        - is_charging

Usage in auto-entities card:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: sensor.battery*   # or use other matchers
      options:
        type: custom:battery-entity-row
        <battery-entity-row options>

My cards

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

BMC