Tile Card with templated `state_content`

I like the new feature which allows to show any attribute of an entity in the state_content.

It would be great to extend this funtionality to allow also templates to be rendered in the state_content list. This would e.g. allow to use a tile card with the button entity and show the sensor entity (e.g. current power consumption) as state_content.

In addition this would also solve another request here: Tile Card Add String before State

I know there are other approaches using card_mod but they are much harder to get right:

Thank you very much for your efforts.

I found a workaround to achieve this behavior. We can use a template sensor which can use templates to define attributes.

template:
  - binary_sensor:
    - name: boiler_combined
      unique_id: boiler_combined
      icon: mdi:water-boiler
      state: "{{ states('switch.boiler') }}"
      attributes:
        power: "{{ states('sensor.boiler_channel_a_power') | int(default=0) }} W"

This seems to work but involves an addition intermediate entity that will also consume storage space in the database.

So I still think my origin request would improve overall functionality of the tile card

2 Likes

I’d like to have this feature too (and I like your workaround). Regarding space consumption, you may already be aware, but you can exclude certain entities from being recorded, check this link: Recorder - Home Assistant :wink:

Another way to perform this is to use the mushroom cards which are very close to Tile cards.

And use specifically the Mushroom template cards, which gives full control on the icon, its color, the primary information, and the secondary information through JINJA2 template.

And as a bonus a small badge that you can customize in icon and color…

All this with UI available, without needing cardmod, and with the possibility to separate the behaviour for single tap, hold and double tap…
image