📝 100% Templatable Lovelace Configurations

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 :slight_smile:

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.

Docs just say that templating is supported.
What would be correct then, please?

CTC does not support * for entities.

I could not find what it does support. Docs are very limited for ctc.

List of entity strings that should be watched for updates. Templates can be used here

Used it because it seemed to work for input_datetime
They seem to be working correctly

Again, not supported in the docs for auto-entities.

1 Like

Means - not throwing an error?
The only way to check it is placing entities on the Entities card and then change these entities outside of the card.

Means using the javascript.
Here is more of the card (did not want to clutter the thread). Ad mentioned, using apexcharts-card.

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['sensor.xiaomi_humidity_dining_room'].attributes.friendly_name.replace("Xiaomi
                Humidity", "") }
              yaxis_id: first
              stroke_width: 2
              group_by:
                func: raw
              type: line
              opacity: 1
              curve: smooth
              fill_raw: last
              show:
                extremas: true
                datalabels: false
      card:
        type: custom:apexcharts-card
        card_mod:
          style: |
            ha-card {
              --ha-card-background: rgba(0, 0, 0, 0);
              --ha-card-box-shadow: none;
              --primary-text-color: white;
              --secondary-text-color: white;
            }
        graph_span: >-
          ${
          ((states['input_datetime.end_datetime'].attributes.timestamp-states['input_datetime.start_datetime'].attributes.timestamp)/60/60).toFixed(2)+'h'
          }
        span:
          offset: >-
            ${
            (-(states['sensor.timestamp'].state-states['input_datetime.end_datetime'].attributes.timestamp)/60/60).toFixed(2)+'h'
            }

Working, i.e. I used it in title using states['sensor.xiaomi_humidity_dining_room'].attributes.friendly_name and it showed the correct friendly name.

But stopped working as soon as I replaced the entity_id with this.entity_id

I suggest to replace it by Entities card and see if your variables are working, if templates are working, if entities are monitored.

When I change input_datetime.start_datetime or input_datetime.end_datetime the card immediately updates.
So monitoring is working

This is not about getting a state and attributes from an entity; it is about monitoring it’s changes.

See above your post

That I overlooked, yes. Will change it :slight_smile:

What would be the correct syntax for entity wildcards? Happy to test. But just don’t know what

CTC does not support wildcards - according to docs, it is not mentioned there; of course it may be undocumented hidden feature )))
A simple test:

  1. Entities card with a few input helpers of some kind (like “input_number.test_number_1”).
  2. Place it inside CTC.
  3. Define “input_number.test_number_*” in the “entities” option.
  4. Add the same Entities card on the same view.
  5. Change these entities on the 2nd card - then see if they are synced with the 1st card.

No, does not seem to work :frowning:
So no hidden gem :frowning:

Now this is even more confusing :frowning:

Do you know a workaround to get all sensors that start with a certain string?