Well, it was a long time ago…
I’m not sure I even remember what the question was!
My templates look like this though which I believe was thanks to @petro
{% if (states.sensor.next_train_to_xxx.attributes.next_trains is defined) and
(states.sensor.next_train_to_xxx.attributes.next_trains | length >= 1) %}
{{ states.sensor.next_train_to_xxx.attributes.next_trains[0].scheduled }}
{% else %}
Not scheduled
{% endif %}
Is that what you wanted to know?