Composite GPS-based Device Tracker?

I ended up creating a custom “composite” device tracker platform. (See this topic.) You might find that interesting.

Regarding your question, can you post your automation or script that is trying to call device_tracker.see? I may be able to spot the problem. For reference, this is what I had done:

  - alias: Composite Tracker
    trigger:
      platform: state
      entity_id:
        - device_tracker.ONE
        - device_tracker.TWO
    action:
      - condition: template
        value_template: >
          {% set old = as_timestamp(state_attr('device_tracker.COMOSITE','last_seen')) %}
          {% set new = as_timestamp(trigger.to_state.attributes.last_seen) %}
          {{ old == none or new > old }}
      - service: device_tracker.see
        data_template:
          dev_id: COMPOSITE
          gps:
            - "{{ trigger.to_state.attributes.latitude }}"
            - "{{ trigger.to_state.attributes.longitude }}"
          gps_accuracy: "{{ trigger.to_state.attributes.gps_accuracy }}"
          battery: >
            {% if 'battery' in trigger.to_state.attributes %}
              {{ trigger.to_state.attributes.battery }}
            {% else %}
              {% set battery = state_attr('device_tracker.COMPOSITE','battery') %}
              {% if battery != none %}
                {{ battery }}
              {% else %}
                0
              {% endif %}
            {% endif %}
          attributes:
            last_seen: >
              {{ as_timestamp(trigger.to_state.attributes.last_seen)|timestamp_local }}
3 Likes