Show device tracker Attributes

I am using google map device tracker, and i want to create a card with device tracker and device tracker Attributes in same card, such as:

  • State
  • Battery level
  • Battery charging

This is the entity:

1- How to add the Attributes parameters ?
2- Which card to use ? (lovelace)
3- I try to create a sensor using this code: but i get error:

  • platform: template
    sensors:
    phone_battery:
    friendly_name: ‘Phone Battery’
    value_template: ‘{{states.device_tracker.google_maps_000000000000000000000.attributes.battery_level | round}}’
    unit_of_measurement: ‘%’

Hi Danik,

What error do you get?

1 Like

This is the sensor.yaml

this is the error:

Your problem might be in the formatting of your template sensor, I can’t really tell if the formatting is correct by looking at that picture but it should look like this:

- platform: template
  sensors:
    phone_battery:
      friendly_name: Phone Battery
      value_template: '{{states.device_tracker.google_maps_000000000000000000000.attributes.battery_level | round}}'
      unit_of_measurement: '%'

Give that a try.

Still get error:
image

The issue with the error was solved, tnx to @Jardiamj for the help!

the solution:
The block right under “- platform: template” wasn’t indented, the whole block needed to be moved 2 spaces to the right