šŸ“ 100% Templatable Lovelace Configurations

Please do let me know too if you figure this out ^^

Cheers

Iā€™m having some fun with this!

Can anyone tell me why one of these works but not the other?

  - type: 'custom:config-template-card'
    config:
      type: 'custom:hui-entities-card'
      title: London Underground
      show_header_toggle: false
      entities:

        - type: custom:card-modder
          style:
            --primary-text-color: "${states['sensor.bakerloo'].state === 'Good Service' ? 'yellow' : 'red' }"
          card:
            type: custom:hui-sensor-entity-row
            entity: sensor.bakerloo
            secondary_info: last-changed

        - type: custom:card-modder
          style:
            --primary-text-color: "${states['sensor.bakerloo'].state === 'Good Service' ? 'yellow' : 'red' }"
          card:
            type: custom:hui-entities-card
            entities:
              - entity: sensor.bakerloo
                secondary_info: last-changed

image

1 Like

Does anyone have problem with hold_action inside the custom:config-template-card?

The same hold_action works outside of the config-template-card but not inside,
tap_action works in both cases, though.

@iantrich & @thomasloven - Is it possible to combine this with auto-entities and then reference the ā€˜autoā€™ entity ID in the template? That could help save a lot of repetitive configuration.

New release 1.0.3

New configuration item entities allows you to specify a list of entity strings that should cause the card to re-render. If nothing specified, any state change will cause a re-rendering (if youā€™re able to, I would advise setting entities )

@SeLLeRoNe this should resolve your ā€˜blinkingā€™ issue

2 Likes

Are you able to set primary text of a hui-sensor-entity-row when not using the config-template-card?

I do not have any issues with hold_actions. If you still are, file an issue on the repo with as much detail as possible.

I havenā€™t played with auto-entities at all, but looking at the repo for auto-entities, I donā€™t really see how they could work together. @thomasloven any input?

I canā€™t see it eitherā€¦ But Iā€™m not quite sure what youā€™re asking. Perhaps you could give an example on what you mean?

Thanks @iantrich
I tested and is not blinking anymore,but still I cannot show the icon with the same code I was using before.

As entity for the updates I simply used sensor.date so that it changes once a day :wink:

1 Like

Tested also using the temperature sensor as entity for updates and it is not blinking

1 Like

Ok, itā€™s quite odd in my opinion, this is the code:

                      name: "${states['sensor.dark_sky_temperature'].state > 10 ? 'Cozy' : 'Too Hot/Cold'}"
                      icon: "${states['sensor.dark_sky_temperature'].state > 10 ? 'mdi:thermometer-chevron-up' : 'mdi:thermometer-chevron-down'}"

The ā€œnameā€ is working, the ā€œiconā€ it is not

Sure thingā€¦for example, letā€™s say Iā€™m using Auto-Entities to populate an Entities card with sensor entities matching a particular entity_id pattern (i.e. each one contains ā€œkitchenā€). For each of those matching entities, I would like to override its icon using the template card, based upon an attribute of that matching entity.

As I see it, the problem is that I donā€™t have a way to pass the name of that matching entity into my template logic in order to do this. I suppose some sort of variable substitution would need to happen inside the template. @thomasloven, this is somewhat similar to what you solved in the card-tool template engine, where you provided the ability to pass a a data object into the template.

At the end of the day, I guess Iā€™m trying to combine the best of the most powerful cards out there. If there was a way for them to play nice together, that would be awesome!

These icons are too new i think. Also donā€™t work in normal LL.

1 Like

As everyone knows, @thomasloven and I are in a bitter rivalry and are completely unwilling to work together :rofl:

Iā€™ll see what Thomas is currently doing to pass to his templates. :+1:

1 Like

eheheh so the troll was right, youā€™re bad person! ahhahhahhha

1 Like

Thanks for the hint, testing it right now but I did also test the standard one to be fair

Is this in entities?

Sorry, I should have put little more context :smiley:

                  - type: custom:config-template-card
                    entities:
                      - sensor.dark_sky_temperature
                    config:
                      type: custom:mini-graph-card
                      name: "${states['sensor.dark_sky_temperature'].state > 10 ? 'Cozy' : 'Too Hot/Cold'}"
                      icon: "${states['sensor.dark_sky_temperature'].state > 10 ? 'mdi:thermometer-chevron-up' : 'mdi:thermometer-chevron-down'}"

Ok, youā€™re actually right, I didnā€™t think it would have matteredā€¦

I am trying now with the Font Awesome icons that surely I have :slight_smile:
I will update soon