Skip to content

Home Assistant Lovelace card for sensors to be used as a footer

License

Notifications You must be signed in to change notification settings

mook/lovelace-custom-sensors

Repository files navigation

lovelace-custom-sensors

This is a custom element for Lovelace (Home Assistant frontend) to display sensors in a row. It is designed to be used in a footer of another card.

Installation

  1. Install HACS.
  2. In HACS, select Frontend.
  3. Click on the menu () then select Custom repositories.
  4. In the repository field, type this repository (mook/lovelace-custom-sensors) and select Lovelace as the Category in the dropdown, then click Add.
  5. Click on the newly added repository, and the download button at the bottom right corner.
  6. Click on Download at the bottom right of the new page.

Example

# A normal entities card
type: entities
title: Living Room
entities:
  - light.living_room
footer:
  # ... With a custom footer
  type: custom:sensors-header-footer
  entities:
    - sensor.living_room_temperature
    - entity: sensor.living_room_humidity
      tap_action:
        type: more-info

Screenshot of the component in use

Configuration

Key Type Description
type string Must be custom:sensors-header-footer to be used.
entities list A list of entity IDs or entity objects.
tap_action object Action on tap; see Actions.
hold_action object Action on hold.
double_tap_action object Action on double tap.

Note

To use the visual editor, entities must be a list of objects instead of strings.

Entities

Each entities object can have the following:

Key Type Description
entity string The entity ID.
tap_action object Action on tap; see Actions.
hold_action object Action on hold.
double_tap_action object Action on double tap.

If the various _action keys are not set, the element-level configuration is used. If it's not set at the element level, it defaults to more-info.

Actions

It is possible to trigger actions on tap/hold/double-tap. Please see the Home Assistant Actions documentation for the available configuration; note that the toggle action is not available.

Development

  1. This depends on NodeJS & yarn:

    1. This was developed on NodeJS 20.
    2. Run corepack enable to have yarn.
  2. Run yarn dev for a development server.

  3. Add as an extra Lovelace module:

    # configuration.yaml
    frontend:
      extra_module_url:
        - http://127.0.0.1:4173/custom-sensors.js

Thanks

Lots of code is copied from Lovelace directly.