Nice view of multiple values from specific attribute?

So I have an entity that has an attribute called “leases”.
It shows the currently leased DHCP addresses from my router.

I’m trying to show a nice list with all the leases in a markdown card.

If I use the following code:

{{ state_attr(‘sensor.router’, ‘leased’) }}

I get something that looks like this:
device1 (x.x.x.x), device2 (x.x.x.x), device3 (x.x.x.x)

How do I get it to look something like this:

device1 (x.x.x.x)
device2 (x.x.x.x)
device3 (x.x.x.x)

Is it leases or leased as shown in your posted template?

I’ll assume it’s leases leased.

{{ state_attr('sensor.router', 'leased') | join('\n') }}

EDIT

Correction. It’s leased not leases.

1 Like

My mistake. It’s “leased”.

Your code worked like a charm.
Thank you for the very fast reply.

1 Like