{% for trip in state_attr('sensor.sl_4244_4200_route_sensor_kvarnberget','trips') -%}
{% set t = trip.duration.split(':') %}{% set hrs = t[0]|int % 24 %}{% set mns = t[1]|int %}
{%- if as_timestamp(trip.legs[0].time) > as_timestamp(now() + timedelta(minutes=10)) %}
* Restid {{ '{} timmar och {} minuter'.format(hrs,mns) if hrs > 0 else '{} minuter'.format(mns) }} från {{trip.legs[0].from }} till {{trip.legs[0].to }} med {{trip.legs[0].name}} mot {{trip.legs[0].direction }} som avgår kl {{ as_timestamp(trip.legs[0].time) | timestamp_custom('%H:%M') }}
{% endif -%}
{%- endfor %}