Can't set title by value of an entity

Hi lads,

I want to use the entity input_text.p1_strain to set the title of my entities card.

I do not get it how to - working since days now and I can’t find a solution.

type: entities
entities:
  - entity: sensor.plant_sensor_1ef3_temperature
  - entity: sensor.plant_sensor_1ef3_moisture
  - entity: sensor.plant_sensor_1ef3_illuminance
  - entity: sensor.plant_sensor_1ef3_conductivity
title: |
  {{ states('input_text.p1_strain') }}
state_color: true
theme: day_and_night

Any ideas? Sensor is delivering data and available.
input_text.p1_strain does have the value Purple Punch.

thanks

You can’t use templates in an entities card.

image

There are custom cards available. Perhaps try this:

1 Like

so this should, imho, work but I doesn’t

type: entities
entities:
  - type: 'custom:config-template-card'
    variables:
      - states['input_text.p1_strain'].state
    entities:
      - sensor.plant_sensor_1ef3_moisture
      - sensor.plant_sensor_1ef3_temperature
      - sensor.plant_sensor_1ef3_illuminance
      - sensor.plant_sensor_1ef3_conductivity
    row:
      type: section
      title: "${vars[0]}"
  - entity: sensor.plant_sensor_1ef3_moisture
  - entity: sensor.plant_sensor_1ef3_temperature
  - entity: sensor.plant_sensor_1ef3_illuminance
  - entity: sensor.plant_sensor_1ef3_conductivity

Did you install the custom card? What happens with the above config?

already double checked it approx. every 2 hours since days :smiley: cause I doubt by myself

card type has changed and the rest is still the same outcome

You’re really not giving much information here.

Have you got any custom card working to show that the installation works?

What is “the same outcome”? Description or screenshot would be fine.

Ok - sorry for that.


That was the first idea - as you said, it won’t work - It didn’t :smiley:


Just to make sure - there is data in the entity


That’s now the outcome as I said not much difference

I will go for a shower - hope that helps to get brains clear :smiley:

Thanks for your precious time

Have another look at the examples on the page.

variables:
  - states['input_text.p1_strain'].state

with [square brackets] and a .state on the end.

title: '${vars[0]}'

All templates in the examples are quoted. Your last example is the title of the entities card, which is “outside” the scope of the custom template card.

Perhaps try a simpler example template card to make sure the installation of the card is working.

I have no experience with this card: I’m just reading the docs and using logic.

1 Like

Ok - still same issue but… it alters automatically the code after I click safe

There is a special thread for discussing config-template-card.

type: entities
entities:
  - type: custom:config-template-card
    variables:
      - states['sun.sun'].state
    entities:
      - sun.sun
    row:
      type: section
      label: "${vars[0]}"
  - entity: sun.sun
  - entity: sun.sun
  - entity: sun.sun

or even

type: entities
entities:
  - type: custom:config-template-card
    variables:
      - states['sun.sun']
    entities:
      - "${vars[0].entity_id}"
    row:
      type: section
      label: "${vars[0].state}"
  - entity: sun.sun
  - entity: sun.sun
  - entity: sun.sun
2 Likes

Thank you for your precious time - that is easy and works fine

on your screenshot you see the line above the label?
That’s where I want to change data - looks like there is no chance to solve this

You want to change a TITLE then, not a section’s label.

type: custom:config-template-card
variables:
  - states['sun.sun']
entities:
  - sun.sun
  - person.ildar
  - zone.home
card:
  type: entities
  title: "${vars[0].state}"
  entities:
    - type: section
      label: fixed label
    - entity: sun.sun
      secondary_info: last-changed
    - entity: person.ildar
      secondary_info: last-changed
    - entity: zone.home
      secondary_info: last-changed

image

And using CTC (config-template-card) ONLY for changing a card’s title is a bad approach - see how many entities need to be listed in the “entities” option and see how “last-changed” is processed… As I said - more details in the main CTC thread.

1 Like

SOLVED!

Thank you so very much!

But to be honest - I have to work me through this cause I can’t understand the code as originally I was on this way. AI and some questions at the wrong place lead me wrong then.

Thanks so much again!

:heartbeat: :heartbeat: :heartbeat: :heartbeat: :heartbeat: