Get a part of an sensor attribute (template)

Hi, Im trying to extract the message part of the attribute from the aftership sensor, but i only get as far as the info from the attribute. i tried split but no luck.

{{ states.sensor.aftership.attributes.trackings[0] }}

Returns:
{‘name’: ‘RU6753827NL’, ‘tracking_number’: ‘RU6753827NL’, ‘slug’: ‘postnl-international’, ‘link’: ‘https://track.aftership.com/postnl-international/RU6753827NL’, ‘last_update’: ‘2020-06-05T13:43:08+00:00’, ‘expected_delivery’: None, ‘status’: ‘InTransit’, ‘last_checkpoint’: {‘slug’: ‘postnl-international’, ‘city’: None, ‘created_at’: ‘2020-06-05T13:43:08+00:00’, ‘location’: None, ‘country_name’: None, ‘message’: ‘The item is at the PostNL sorting center’, ‘country_iso3’: None, ‘tag’: ‘InTransit’, ‘subtag’: ‘InTransit_002’, ‘subtag_message’: ‘Acceptance scan’, ‘checkpoint_time’: ‘2020-06-03T13:30:00’, ‘coordinates’: [], ‘state’: None, ‘zip’: None, ‘raw_tag’: None}}

my goal is to have:
‘name’: ‘RU6753827NL
message’: ‘Acceptance scan’, ‘checkpoint_time’: ‘2020-06-03T13:30:00’,
expected_delivery’: None, 'status

some guidance would be appreciated!

thanks all

name and message is:

{{ state_attr('sensor.aftership', 'trackings')[0]['name'] }}
{{ state_attr('sensor.aftership', 'trackings')[0]['last_checkpoint']['message'] }}

and you should be able to figure the rest of them out

1 Like

Exactly! thanks a lot. :grinning: :+1: