Proximity template dir_of_travel

Hey there I want to export my proximity data to influxdb I could not figure out how to export the proximity attribute for dir_of_travel so I am trying to make a template sensor.

proximity:
  home:
    devices:
      - device_tracker.iphone_hass_app
      - device_tracker.iphone_2
    tolerance: 50
    unit_of_measurement: m

template:
  - sensor:
      - name: proximity_direction
        state: "{{ (state_attr('proximity.home', 'dir_of_travel')) }}"

this is what I have now in my configurations.yaml.
The (state_attr(‘proximity.home’, ‘dir_of_travel’)) shows “arrived” under developer tools/template. So it seems to be correct syntax. But the sensor doesn’t show up in my homeassistant and in the Logs i get this error:

Invalid config for [template]: required key not provided @ data['trigger']. Got None. (See /config/configuration.yaml, line 71). 

line 71 is where the template starts.
Thanks in advance for any help.
I am also open for suggestions how to export in a other way maybe?
I am using homeassistant in docker.

You have to be on 2021.5 to use a template sensor without the trigger key.

Thanks :slight_smile: updating solved my problem