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.
- Install HACS.
- In HACS, select Frontend.
- Click on the menu (
⁝
) then select Custom repositories. - In the repository field, type this repository (
mook/lovelace-custom-sensors
) and select Lovelace as the Category in the dropdown, then click Add. - Click on the newly added repository, and the download button at the bottom right corner.
- Click on Download at the bottom right of the new page.
# 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
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.
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
.
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.
-
This depends on NodeJS & yarn:
- This was developed on NodeJS 20.
- Run
corepack enable
to haveyarn
.
-
Run
yarn dev
for a development server. -
Add as an extra Lovelace module:
# configuration.yaml frontend: extra_module_url: - http://127.0.0.1:4173/custom-sensors.js
Lots of code is copied from Lovelace directly.