Accessing sub-attributes via templates

I have a sensor with attributes which looks like this:

I now want to access the attribute “delay” via template. I had no luck with

{{ state_attr(‘sensor.name’, ‘delay’) }}

Can someone please help me?

Try:

{{ state_attr('sensor.name', 'departures')[0]['delay'] }}
1 Like