Tile Card - Changing secondary info text using template

I have used card-mod to remove the secondary state text on a tile card as per this post:

Can not create Tile card with empty state on device_tracker?

However, what I now want to do is change the secondary text which i have highlighted below.
tilecard

Anyone know how?

I have had some success putting the text template into the content field as below:

type: tile
entity: light.master_bedroom_lamp
card_mod:
  style:
    ha-tile-info$: |
      .secondary {
         visibility: hidden;
       }
       .secondary:before {
         visibility: visible;
         content: "{{ states(config.entity) | title }}";
       }

This gives me the below card:
image

I do notice that sometimes I have to clear by browser cache after making a new card before it works properly.

1 Like

@doranashburner , do you think that could be possible to do the same to show last changed value?

thank you for this thread.

I have modified so that I can see the state of the gardenshed door and the state of its lock:

            card_mod:
              style:
                ha-tile-info$: |
                  .secondary {
                     visibility: hidden;
                   }
                   .secondary:before {
                     visibility: visible;
                     content: "{{ states('binary_sensor.gartenhaus_tur_intrusion_2') | title + ' & ' + states('lock.gartenhaus_schlos') | title}}";
                   }

However, as a result I get “Off & Locked
So, one thing is that it’s Off instead of Closed and even in the German view it’s not translated.

Any hint would be greatly appreciated.

My Example => Tile Card with two Secondary States

type: tile
entity: sensor.room_temperature
name: Temperature and Humidity
tap_action:
  action: none
icon_tap_action:
  action: none
card_mod:
  style:
    ha-tile-info$: |
      .secondary {
        visibility: hidden;
      }
      .secondary:before {
        visibility: visible;
        content: '{{ states('sensor.room_temperature') | round(1) }} °C - {{ states('sensor.room_humidity') | round(0) }} %'
      }

Note: the preview editor only shows 1 state?
→ Simply click on “OK” in the editor and the second state will appear.

1 Like