• Stars
    star
    213
  • Rank 184,756 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔹 Display whatever you want in an entities card row.

template-entity-row

hacs_badge

Display whatever you want in an entities card row.

For installation instructions see this guide.

Install template-entity-row.js as a module.

resources:
  - url: /local/template-entity-row.js
    type: module

Usage example

Note: This is not a card. It's a row for an entities.

Skärminspelning 2020-01-03 kl  23 03 16 mov

type: entities
title: Default
entities:
  - light.bed_light
  - entity: input_boolean.car_home
  - type: custom:template-entity-row
    icon: mdi:lamp
    name: "The light is {{states('light.bed_light')}} but nobody's"
    state: "{% if is_state('input_boolean.car_home', 'on')%} home {% else %} away {% endif %}"
    secondary: "It's {{states('sensor.time')}}"
    active: "{{ is_state('light.bed_light', 'off') }}"
  - type: custom:template-entity-row
    icon: mdi:car
    name: Hi there
    condition: "{{is_state('input_boolean.car_home', 'on')}}"

Options

  • icon, name, state, secondary, image selects what icon, name, state, secondary_info text and entity_picture to display respectively.
  • active if this evaluates to "true" or "false", the icon gets will always look active or inactive respectively.
  • entity if this evaluates to an entity id, icon, name, state and image will be taken from that entity unless manually overridden. Specifying an entity will also let you use action.
  • condition if this is set but does not evaluate to "true", the row is not displayed.
  • toggle if this evaluates to "true" a toggle is shown instead of the state. The toggle is connected to the entity.
  • tap_action, hold_action, double_tap_action: see below.
  • color the CSS color of the icon.

All options accept jinja2 templates.

Jinja templates have access to a few special variables. Those are:

  • config - an object containing the card configuration
  • user - the username of the currently logged in user
  • browser - the deviceID of the current browser (see browser_mod).
  • hash - the hash part of the current URL.

In evaluated templates the function _(<key>) (underscore) will localize the <key> to the current language. E.g. _(state.binary_sensor.motion.off) will be replaced with Clear if your language is set to English.

To find the available keys, open your browsers console, type in the following and press Enter:

document.querySelector("home-assistant").hass.resources;

Actions

tap_action, hold_action and double_tap_action can be templated if the template evaluates to a valid action configuration in python format. Standard YAML without templates works too.

Eg:

type: custom:template-entity-row
entity: light.bed_light
# Standard yaml configuration - No templates allowed
hold_action:
  action: more-info
# JSON return format
tap_action: |
  {
    "action": "toggle",
    "confirmation": {
      "text": "Do you really want to turn {{ state_attr(config.entity, 'friendly_name') }} {% if is_state(config.entity, 'on') %}off{% else %}on{% endif %}?",
    },
  }
double_tap_action:
  action: toggle

FAQ

Why does this look weird?

Because you're not using it correctly. This is not a card. It's an entity row, and is meant to be used inside the entities card


Buy Me A Coffee

More Repositories

1

hass-browser_mod

🔹 A Home Assistant integration to turn your browser into a controllable entity and media player
TypeScript
1,253
star
2

lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
TypeScript
1,190
star
3

lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
TypeScript
1,059
star
4

lovelace-layout-card

🔹 Get more control over the placement of lovelace cards.
TypeScript
1,015
star
5

lovelace-slider-entity-row

🔹 Add sliders to entity cards
TypeScript
801
star
6

lovelace-fold-entity-row

🔹 A foldable row for entities card, containing other rows
TypeScript
563
star
7

lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
TypeScript
386
star
8

hass-fontawesome

🔹 Use icons from fontawesome in home-assistant
JavaScript
272
star
9

lovelace-card-tools

🔹A collection of tools for other lovelace plugins to use
JavaScript
244
star
10

hass-config

My Home Assistant configuration
Python
210
star
11

hass-lovelace_gen

🔹 Improve the lovelace yaml parser for Home Assistant
Python
209
star
12

lovelace-more-info-card

🔹 Display the more-info dialog of any entity as a lovelace card
TypeScript
139
star
13

lovelace-hui-element

🔹 Use built-in elements in the wrong place
TypeScript
105
star
14

hass-favicon

🔹 Change the favicon of your Home Assistant instance
Python
101
star
15

lovelace-card-modder

JavaScript
101
star
16

lovelace-flower-card

JavaScript
99
star
17

lovelace-popup-card

JavaScript
94
star
18

hass-plejd

🔹 Plejd BLE integration for Home Assistant
Python
82
star
19

round-slider

JavaScript
81
star
20

lovelace-badge-card

🔹 Place badges anywhere in the lovelace layout
JavaScript
77
star
21

lovelace-toggle-lock-entity-row

JavaScript
62
star
22

lovelace-fullykiosk

Lovelace plugin for using Fully Kiosk Browser features in home-assistant
JavaScript
61
star
23

homeassistant-lovelace-gen

A lovelace configuration file generator for home assistant
Python
57
star
24

lovelace-player

Lets any browser currently viewing your lovelace interface act as an audio receiver with a media_player interface
JavaScript
50
star
25

mittos64

C
42
star
26

lovelace-theme-maker

JavaScript
42
star
27

lovelace-browser-commander

JavaScript
33
star
28

lovelace-useful-markdown-card

JavaScript
30
star
29

lovelace-gap-card

🔹 A lovelace card that does nothing and looks like nothing. Incredibly useful! No, really.
JavaScript
29
star
30

hass-custom-devcontainer

A devcontainer for developing and testing custom Home Assistant stuff
Shell
28
star
31

homeassistant-2020-presentation

18
star
32

lovelace-markdown-mod

JavaScript
16
star
33

lovelace-gui-sandbox

🔹 Lets you play around with the GUI editors even if you're using YAML mode
JavaScript
16
star
34

lovelace-card-loader

JavaScript
13
star
35

lovelace-color-picker

JavaScript
13
star
36

plejd2mqtt

JavaScript
12
star
37

lovelace-column-card

A columnizing card for lovelace ui for home-assistant.
JavaScript
12
star
38

card-tools

A collection of tools to help develop lovelace cards
JavaScript
11
star
39

os5

My attempts at developing an operating system kernel.
C
11
star
40

lovelace-dummy-entity-row

🔹 An entity row with only icon and name
JavaScript
10
star
41

lovelace-q-card

JavaScript
9
star
42

lovelace-long-press

JavaScript
9
star
43

lovelace-time-input-row

JavaScript
9
star
44

dito

A library and some tools for handling disk image files.
C
8
star
45

nextrevo-mod

How I use the E3D Revo system with Prusa Nextruder
7
star
46

mittsnap

rsnapshot-like tool that leverages btrfs snapshots
Shell
5
star
47

dotfiles

MATLAB
5
star
48

lovelace-color-glance-card

A glance card with a colorized background
JavaScript
3
star
49

lovelace-icon-headers

WIP
JavaScript
2
star
50

lovelace-wbah

Lovelace with bluejays and herons
TypeScript
2
star
51

os4

C
1
star
52

new-hass-config

Python
1
star
53

z80Monitor

Assembly
1
star
54

vim-tstatus

My status line for vim
Vim Script
1
star
55

pyplejd

Python
1
star
56

mittos64-old

C
1
star
57

hass-plant_helper

🔹 Home Assistant Helper for monitoring plant health using MiFlora devices
Python
1
star