mistrovly
(Marc-Edouard Louis)
March 2, 2019, 2:56pm
1
Hey guys,
i’ve been fighting with this a little bit now and i can’t seem to find a solution yet. I’m trying to setup this > conditional card in lovelace:
- type: conditional
conditions:
- entity: switch.zone_1
state: on
- entity: switch.zone_2
state: off
card:
type: entities
entities:
- entity: input_number.onkyo_receiver
name: Zone 1 Volume
- entity: input_number.onkyo_receiver_zone_2
name: Zone 2 Volume
And for some reason i kept getting this error:
I also tried to setup a conditional with multiple cards like this:
Multiple
- type: horizontal-stack
cards:
- type: conditional
conditions:
- entity: switch.zone_1
state: on
- entity: switch.zone_2
state: off
cards:
- type: entities
entities:
- entity: input_number.onkyo_receiver
name: Zone 1 Volume
- entity: input_number.onkyo_receiver_zone_2
name: Zone 2 Volume
- type: entities
entities:
- entity: input_number.onkyo_receiver
name: Volume
- type: entities
entities:
- entity: input_number.onkyo_receiver_zone_2
name: Volume
that did not work for me either;
Could you guys be so kind and help me out please.
Always put ‘on’ and ‘off’ in quotes.
As you can see in the error box, HA converts it to true/false.
mistrovly
(Marc-Edouard Louis)
March 2, 2019, 3:15pm
3
thank you for taking the time to reply; but that still did not work for me. I tried single and double quotation( ’ and " )
Both of your errors show ‘cards’, the conditional can only handle one ‘card’.
Your first example should work.
mistrovly
(Marc-Edouard Louis)
March 2, 2019, 3:38pm
5
Hey my man thank you for that. It’s working
smile
September 8, 2019, 3:58pm
6
I’m trying to setup conditional card in lovelace in yaml mode, but can´t working.
- badges: []
cards:
- entity: sensor.real_time_consumption_xxxxxx
max: 6000
min: 0
severity:
green: 700
red: 4500
yellow: 2500
theme: default
type: gauge
- entity: sensor.electricity_price_xxxxxxx
max: 1
min: 0
severity:
green: 0.2
red: 1
yellow: 0.6
theme: default
type: gauge
- cards:
- cards:
- entities:
- entity: sensor.tibber_minpower
name: Min
secondary_info: last-changed
- type: section
- entity: sensor.tibber_averagepower
name: Snitt
- type: section
- entity: sensor.tibber_maxpower
name: Max
secondary_info: last-changed
- type: section
- entity: sensor.tibber_accumulatedconsumption
name: Forbruk
type: entities
- entities:
- entity: sensor.tibber_min
name: Min
- type: section
- entity: sensor.tibber_avg
name: Snitt
- type: section
- entity: sensor.tibber_max
name: Max
- type: section
- entity: sensor.tibber_accumulatedcost
name: Kostnad
type: entities
type: horizontal-stack
- entities:
- sensor.tibber_volt
- sensor.tibber_amp
type: glance
- entities:
- entity: sensor.tibber_nett
icon: 'mdi:fuse'
- entity: sensor.tibber_estimert
- entity: sensor.tibber_time
type: entities
type: vertical-stack
path: ams
title: AMS
- badges: []
cards:
- type: conditional
conditions:
- entity: light.livingroom
state: "off"
- entity: light.livingroom
state: "on"
card:
type: entities
entities:
- entity: light.livingroom
path: test
title: test
maurizio53
(Maurizio Fabiani)
October 1, 2019, 1:05pm
7
So if i need to use more than one conditional card may i put more than one in series?
And more, to show again the hidden cards i must put another conditional with ‘on’ as state or it will be automatical?
crazytok
(Thomas)
October 4, 2019, 6:09pm
8
Is it possible to use conditional card with some sort of timer? Like after 60sec when media_player stops playing it will hide the Card?
ivico
December 6, 2019, 11:31pm
9
No but you can set state with this script
Works fine and I use it to hide some media player
What I’m looking for now is to hide a media player based on the source or a specific attribute. I’m stuck
KoenChiau
(Koen Chiau)
March 10, 2020, 11:31am
10
Friends,
Upgrading from HA 9.93 to current version 1.06.5, I see that the “Group.All_…” is no longer valid. I use this in my conditional card as below:
- type: conditional
conditions:
- entity: group.all_lights
state: "on"
card:
type: horizontal-stack
...
I just want a card to show when any light is switch on.
How do I accomplish this, please ?
KoenChiau
(Koen Chiau)
March 10, 2020, 11:36am
12
Thx. I’ll look into this.
Looks like there is no easy replacement…
KoenChiau
(Koen Chiau)
March 10, 2020, 11:54am
13
@VDRainer ,
I am really sorry. It must be my lack of understanding automations/templates/… but I do not understand how I can fit any of the suggested methods in you post proposed.
The “Conditional” card type takes only “entity” in its “conditions” section.
So how do I create an entity (of the Lights domain) that this card can test to see if any light is on ?
Hoping you can help a novice in this matter.
Well, if you read the first post in the topic to the end, there are three easy steps to get your group.all_lights back.
Python Script Startup Solution
KoenChiau
(Koen Chiau)
March 10, 2020, 1:06pm
15
The Python script worked !
Many thanks for your kind advice !!!
Hello everyone, since yesterday I’m getting this error:
“Custom element doesn’t exist: hui-conditional-card.”
Home Assistant 0.107.1
python_version 3.7.6
I think is a consequence of the new version of Home Assistant, is anyone having the same issue?
Here’s a workaround for this issue:
In preparation for Home Assistant 0.107, I have created the Lovelace Card Preloader:
Add it to your Lovelace resources:
resources:
- type: js
url: /local/path/lovelace-card-preloader.js
and then add something like this to your Lovelace config:
preload:
- markdown
- gauge
This will preload those cards on reload of the page.
This is useful in the following cases:
Custom cards which have not been updated for 0.107
Using the standard cards as rows within an entities card by using…
poldim
March 26, 2020, 4:45am
18
did you ever figure this out?
ivico
March 26, 2020, 6:24pm
19
No.
I still need it.
Workaround involves many duplicate code and is hard to read if you have multiples sources for each media player displayed on the same lovelace tab.
With Tidal & iTunes streaming to 4 Chromecast + 3 CC groups I need 14 lovelace conditional card per state. It’s huge and hard to maintain especially when you also need to include volume or some playlists.
I saw 2 features request that you should vote for.
Both would help me decrease amount of code. Maybe it’s what you have been looking for?
Continuing the discussion from Lovelace - conditional card - only 1 card? :
please allow for multiple cardS to be displayed on 1 (set of) condition:
- type: conditional
conditions:
- entity: light.bed_light
state: "on"
- entity: switch.decorative_lights
state_not: "off"
cards:
- type: entities
entities:
- device_tracker.demo_paulus
- cover.kitchen_window
- type: entities
entities:
- group.kitchen
- lock.kitchen_door
…
The Lovelace Conditional Card is great but I feel it could be made more useful if OR conditions were possible. Perhaps we could have new options in the configuration variables; you could have conditions_and plus conditions_or available. One or the other to be used.
poldim
April 7, 2020, 10:23pm
20
I voted for both of those, hopefully it will get added soon.
In the meantime, I’ve found a workaround to work for my application. I’m using the custom state-switch
card in LL to dynamically display the right mini media player card based on what the receiver source is set to. Note that the vertical-stack
isn’t necessary but I plan on expanding each one with additional cards so I’ve added it already.
- type: custom:state-switch
entity: template
template: "{% if is_state_attr('media_player.rx_v675', 'source', 'ChromeCast') %} ChromeCast {%elif XBOX %} XBOX {%elif HDMI5 %} HDMI5 {%endif%}"
states:
"ChromeCast":
type: vertical-stack
cards:
- type: custom:mini-media-player
entity: media_player.ultra
icon: mdi:google-chrome
hide:
source: true
power: true
"XBOX":
type: vertical-stack
cards:
- type: custom:mini-media-player
entity: media_player.xbox
icon: mdi:xbox
hide:
source: true
"HDMI5":
type: vertical-stack
cards:
- type: custom:mini-media-player
entity: media_player.mibox4
icon: mdi:android-head
hide:
source: true
3 Likes