TTN Tracker - get location

I try to integrate this tracker:

I’ve successfully deployed the TTN integration and data gets transmitted but the integration does not set the correct data types:

image

The text “location” at the location is only added because I tried to follow this advice:

homeassistant:
  customize: !include customize.yaml
sensor.tracker_01_location:
  unit_of_measurement: location

But this does not work. I found github issue 120320 related to this problem. (For some reason I can only put 2 links in the post … sorry)

How to get the location from the tracker to visualize it and make it usable for geofencing?

First thing first: for geofencing, you want a device_tracker, unit of measurement is irrelevant.

I see a pull request for this: Add thethingsnetwork device_tracker by angelnu · Pull Request #124413 · home-assistant/core · GitHub, but as many PR, it was ignored.

Thinking out loud, but a workaround could be to publish the lat/lon values to MQTT using the mqtt.publish action, then using a MQTT device tracker to read them back as an actual device_tracker…

Unfortunately, there is no template device tracker, which would make the process far easier.

Thanks, I will have a look. I’ve no clue about how to get this rolling :slight_smile:

What came to my mind was NodeRed, as I’m used to use it for TTN to Graphana tasks. It’s pretty easy to get the data. But how to publish it to HA using NodeRed?

An other idea … the PR implies that the issue is that the tracker is not called GPS. The data presented to HA is dependent on the so called TTN payload decoder which could be customized. For my tracker:

Which TTN tracker ist working with HA? It’s payload decoder could be an example how to modify the decoder for TrackerD.

Not sure where you see that…

In the PR: the PR implies that the issue is that the tracker is not called GPS

But … what I want is a map entry and I found this:

Perhaps this solves my problem. I only need to know how to create a sensor and update it, when the TTN device changes location data. According to the post I tried this as a startingpoint:

alias: Tracker JH
description: ""
triggers:
  - entity_id:
      - sensor.tracker_jh_01_latitude
      - sensor.tracker_jh_01_longitude
      - sensor.tracker_jh_01_alarm_status
      - sensor.tracker_jh_01_batv
    trigger: state
actions:
  - data:
      dev_id: owntracks_JH_see
      gps:
        - "{{states('sensor.tracker_jh_01_latitude') }}"
        - "{{states('sensor.tracker_jh_01_longitude') }}"
      battery: "{{states('tracker_jh_01_batv')|int}}"
      gps_accuracy: "1"
    action: device_tracker.see
mode: single

When I got this working next will be evaluating “alarm_status” and indoor BT beacons.

How to create a sensor updated by a automation?

Yep, that would work, I forgot about that.

You don’t have to do it. According to the thread you mention, the device tracker entity is created on-the-fly by your automation