Order entites after last updated

Hi,

I have some beacons around the house and uses Geofency after dealing with OwnTracks for a while with no luck.

No I have better controll in my opionon with Geofency.
The problem right now is that I like to order entities after Last Updated and I am now playin around in Template but I just want the entity with highest Time (most recent).

{% set my_beacons = 
  {
    "name": "bath",
    "state": states('device_tracker.beacon_bath'),
    "time": state_attr('device_tracker.beacon_bath', 'date')
  },
  {
    "name": "bedroom",
    "state": states('device_tracker.beacon_bedroom'),
    "time": state_attr('device_tracker.beacon_bedroom', 'date')
  },
  {
    "name": "kitchen",
    "state": states('device_tracker.beacon_kitchen'),
    "time": state_attr('device_tracker.beacon_kitchen', 'date')
  },
  {
    "name": "office",
    "state": states('device_tracker.beacon_office'),
    "time": state_attr('device_tracker.beacon_office', 'date')
  },
  {
    "name": "livingroom",
    "state": states('device_tracker.beacon_livingroom'),
    "time": state_attr('device_tracker.beacon_livingroom', 'date')
  } 

%}

{% for i in my_beacons -%}
 {% if i.state == i.name -%}
  {{i.name}} 
 {%- endif %}
{%- endfor%}

This can right now echo tripple values like: bedroom office kitchen
The entities are triggered by a webhook and shows “not_home” or the entity name if it is “home”.