Device tracker for F-droid app

The minimal companion app does not have a working device_tracker, so i made a “virtual device tracker”, that uses the GPS data from the geocoded location. A slight limitation is that the created sensor is missing unique_id, so it is hard to manage in the UI.

Blueprint can be found here:

Here is an automation that does the same thing, a new device_tracker called “sm_a155f_virtual” will be created when the automation is first run:

description: "Device tracker from sm_a155f geocoded location"
mode: single
triggers:
  - trigger: state
    entity_id:
      - sensor.sm_a155f_geocoded_location
conditions:
  - condition: template
    value_template: >-
      {{ state_attr('sensor.sm_a155f_geocoded_location', 'location') is not none
      }}
actions:
  - action: device_tracker.see
    metadata: {}
    data:
      dev_id: sm_a155f_virtual
      gps: "{{ state_attr('sensor.sm_a155f_geocoded_location', 'location') }}"

We could also read the data from the trigger, so we only need to define sensor once. But this will fail if run manually:

# Inststead of this:
{{ state_attr('sensor.sm_a155f_geocoded_location', 'location') }}
# Do this:
{{ state_attr(trigger.entity_id, 'location') }}