This feature is already in lovelace core. You can use https://www.home-assistant.io/lovelace/entities/#conditional and get the same results.
Show or hide an entity row based on a condition.
This card is available in HACS (Home Assistant Community Store)
-
Download and copy
conditional-entity-row.js
from the latest release into yourconfig/www
directory. -
Add a reference to
conditional-entity-row.js
inside yourui-lovelace.yaml
or through the raw config editor interface.resources: - url: /local/conditional-entity-row.js type: module
Name | Type | Default | Description |
---|---|---|---|
type | string | required | custom:conditional-entity-row |
condition | condition object | required | Condition |
Name | Type | Default | Description |
---|---|---|---|
entity | string | required | The entity_id to use in the condition |
state | string | required | The state to use in the condition. |
When the condition evaluates to "true", the entity will be shown.
- type: entities
show_header_toggle: false
entities:
- input_boolean.example_boolean
- type: entities
show_header_toggle: false
entities:
- entity: light.bed_light
name: 'Bed Light'
type: custom:conditional-entity-row
condition:
entity: input_boolean.example_boolean
state: 'on'
- entity: light.ceiling_lights
- entity: light.kitchen_lights
This project is under the MIT license.