#mqtt device_tracker config help

1 messages · Page 1 of 1 (latest)

earnest crescent
#

hello! I am working on a mqtt device_tracker and completely stumped on how to propery set my config to parse out lat/lon to coordiates and keep a few other attributes as attributes

any suggestions?

An example payload is this

 {"latitude" 12.3456,  # bogus data to not dox myself, these are correct coordinates
   "longitude" 78.91011,  # bogus data to not dox myself, these are correct coordinates
   "altitude" 18,  
   "speed" 0.62,  
   "battery" 3.85,  
   "sats" 24}

my current configuration is this

mqtt:
  device_tracker:
    - name: "My Tracker"
      unique_id: "my_tracker"
      state_topic: "devices/12345/rx" # bogus data to not dox myself used in this exampk
      json_attributes_topic: "devices/12345/rx" # bogus data to not dox myself used in this example
      json_attributes_template: >
        {
          "latitude": {{ value_json.latitude }},
          "longitude": {{ value_json.longitude }},
          "altitude": {{ value_json.altitude }},
          "speed": {{ value_json.speed }},
          "battery": {{ value_json.battery }},
          "sats": {{ value_json.sats }},
          "gps_accuracy": 10,
          "source_type": "gps"
        }
      source_type: gps