This card can show and hide a specific card on current device while not affecting other windows. It does not require any integration to run.
- Open HACS
- Go to "Frontend" section
- Click button with "+" icon
- Search for "Local conditional card"
- Install repository in HACS
- Make sure you have added this card to Lovelace resources
url: /hacsfiles/local-conditional-card/local-conditional-card.js type: module
- Refresh your browser
- Download
local-conditional-card.js
file from the latest release - Save downloaded file somewhere in
<ha config>/www/
directory, e.g./config/www/custom_lovelace/local-conditional-card.js
- Add saved file to Lovelace resources
url: /local/custom_lovelace/local-conditional-card.js type: module
- Restart HA if you had to create
www
directory - Refresh your browser
Key | Type | Required | Default | Description |
---|---|---|---|---|
id |
string |
true |
- | Identifier of a card, used in service calls. Must be unique! |
card |
card |
true |
- | Configuration of a nested card |
default |
string |
false |
hide |
Default card behaviour. Possible values: [show , hide ]. |
persist_state |
boolean |
false |
false |
Enables storing card's state in local storage to restore it after page refresh. |
This card utilises fire-dom-event
actions to change its state:
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- id_1
There are 4 available actions
show
- shows specified cardshide
- hides specified cardstoggle
- changes visibility of specified cardsset
- sets visibility of specified cards
Each of these services requires a parameter ids
that should contain a list:
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- id_1
- id_2
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- id_1
- id_2
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- id_1
- id_2
tap_action:
action: fire-dom-event
local_conditional_card:
action: set
ids:
- id_1: show
- id_2: hide
- id_3: toggle
views:
- name: Example
cards:
- type: 'custom:local-conditional-card'
default: show
id: sun1
card:
entities:
- sun.sun
title: Sun 1
type: entities
- type: 'custom:local-conditional-card'
id: sun2
card:
entities:
- sun.sun
title: Sun 2
type: entities
- title: Click test
type: entities
entities:
- action_name: Toggle
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- sun1
type: button
- action_name: Show
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- sun1
type: button
- action_name: Hide
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun1
type: button
- action_name: Hide All
icon: mdi:power
name: Suns
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun1
- sun2
type: button
- action_name: Toggle
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- sun2
type: button
- action_name: Show
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- sun2
type: button
- action_name: Hide
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun2
type: button
If you want to support my work with a donation you can use one of the following platforms:
Platform | Payment methods | Link | Comment |
---|---|---|---|
Ko-fi |
|
|
|
buycoffee.to |
|
||
PayPal |
|
|
|
Revolut |
|
|