<3 Thank you very much. I appreciate you taking the time to draw out some examples to work off of, and learn from as well.
Hello,
I want to set the max. value of a bar card from an input_number entity and tried to use config-template-card. But it throws an error: “No card type definded”.
My code is:
type: custom:config-template-card
variables:
max_containers: states.['input_number.zahler_dunstabzug_wartungsintervall'].state
entities:
- ${max_containers}
card:
- type: custom:bar-card
name: Reinigung der Filter
icon: 'off'
decimal: 0
min: -100
max: ${max_containers}
entities:
- entity: input_number.zahler_dunstabzug_zeit_bis_wartung
Thank you for any help, I can’t find the failure.
Regards, Eckart
Remove this “-”.
Seems to be very wrong.
Haven’t check other code.
Thank you for the fast answer. I am still a bit awkward with yaml.
With the corrections - if I made them correctly - I don’t see any error message anymore, but also no card.
type: custom:config-template-card
variables:
max_containers: states.['input_number.zahler_dunstabzug_wartungsintervall'].state
entities:
- ${max_containers}
card:
type: custom:bar-card
name: Reinigung der Filter
icon: 'off'
decimal: 0
min: -100
max: ${max_containers}
entities:
- entity: input_number.zahler_dunstabzug_zeit_bis_wartung
The rest of the code is correct. Without CTC, the card works.
Greetings, Eckart
EDIT:
I have found my failure: the line
max_containers: states.['input_number.zahler_dunstabzug_wartungsintervall'].state
contains a wrong dot. It works with:
max_containers: states['input_number.zahler_dunstabzug_wartungsintervall'].state
Thanks again, Eckart
Wrong “entities” option may NOT show an error. You will find out this error only when you start testing the card.
No, it does not))))
Read above.
Check this example, here you may find a solution:
type: vertical-stack
cards:
- type: entities
entities:
- entity: input_boolean.test_boolean
- type: custom:config-template-card
variables:
INPUT_BOOLEAN: states['input_boolean.test_boolean']
entities:
- ${INPUT_BOOLEAN.entity_id}
card:
type: entities
entities:
- entity: ${INPUT_BOOLEAN.entity_id}
name: ${INPUT_BOOLEAN.state}
I’m currently using this card like this
type: custom:config-template-card
variables:
- states['binary_sensor.waze_car_live_url'].attributes.url
entities:
- binary_sensor.wave_car_live_url
card:
type: iframe
url: ${ vars[0] }
Is there any way of making this bigger and resize it ? Currently it’s coming out a bit small dimension wise.
Making bigger what?
The card, i would like it to up more dashboard space, or even an entire page.
So, are you talking about increase a size of the card?
Then this question is not related to config-template-card.
To fill the whole page - use a panel mode of the view.
I am looking for solution where I can use states of different entities depending on a switch state.
type: 'custom:config-template-card'
variables:
SWITCH: states['binary_sensor.switch'].state
VAR1: states['sensor.sensor1'].state
VAR2: states['sensor.sensor2'].state
card:
entities:
- entity: sensor.magazyn_energii
type: custom:bar-card
target: '${ SWITCH === ''on'' ? VAR1 : VAR2 }'
Is it possible to use that construction at all? i did try VAR1
, ${VAR1}
, `${'VAR1}…
Static version
target: '${ SWITCH === ''on'' ? 500 : 1000 }'
does work
The other solution could be templating variables, but
...
variables:
TARGET: >
{% if is_state('binary_sensor.switch', 'on') %}
states('sensor.sensor1')
{% else %}
states('sensor.sensor2')
{% endif %}
...
target: '${TARGET}'
Even with quotes for {...}
Do not work as well.
What am I doing wrong?
Can’t be since the card’d code is wrong.
Type of the card not specified.
No monitored entities specified.
Ok, that was a shortened example version to show only the most important parts, additionally with simplified names. To make the code more clear.
If the rest of structure will be ok this line should work?:
target: '${ SWITCH === ''on'' ? VAR1 : VAR2 }'
Let say this is the full code (still with simplified names):
type: 'custom:config-template-card'
variables:
SWITCH: states['binary_sensor.switch'].state
VAR1: states['sensor.sensor1'].attribute.attr1
VAR2: 1000
entities:
- binary_sensor.switch
- sensor.sensor1
- sensor.sensor_main
card:
type: entities
entities:
- entity: sensor.sensor_main
type: custom:bar-card
target: '${ SWITCH === ''on'' ? VAR1 : VAR2 }'
The code seems OK
Great. But is not working. At least is not working as expected. The only visible effect is that card become not visible at all.
Then probably there is smth else in the code which was not posted
And You were right. One letter too much.
Thank You, Your answer gave me necessary motivation for looking for the bug
on the config-template-card, I d like to use the following title:
header:
show: true
title: Prijzen voor de komende ${span_hours} in (€/kwh)
where the span_hours is 24h or 48h. This doesnt work however, (the whole card is not showing), while
header:
show: true
title: ${span_hours}
works just fine. Is there some setting I am missing?
- type: entities
entities:
- type: custom:config-template-card
entities:
- input_select.apex_span_hours
variables:
span_hours: states['input_select.apex_span_hours'].state
card:
type: custom:apexcharts-card
card_mod:
style: |
ha-card {
box-shadow: none;
margin: -8px -16px -16px -16px;
padding: 0;
}
graph_span: ${span_hours}
span:
start: day
now:
show: true
label: Now
header:
show: true
title: ${span_hours} # this works ok, the longer text doesnt
experimental:
color_threshold: true
header:
show: true
title: Prijzen voor de komende ${span_hours} in (€/kwh)
On phone so not tested but the whole line needs to be the template… Something like…
header:
show: true
title: ${"Prijzen voor de komende " + span_hours + " in (€/kwh)"}
Would someone please help me out?
I am trying to define the name per series and the series is created using auto-entities.
But I think this is a config-template-card issue.
type: custom:config-template-card
entities:
- input_datetime.*
- sensor.xiaomi_humidity*
card:
type: vertical-stack
cards:
- type: custom:auto-entities
sort:
method: friendly_name
filter:
include:
- entity_id: sensor.xiaomi_humidity_*
options:
name: ${ states['this.entity_id'].attributes.friendly_name }
(The two entities I am defining in the beginning are being used later in the card.)
You should do only things specified in the docs.
And you have not defined a card for auto-entities.