Google Maps battery % integration / sensor

Hi!
Noob warning!

I am trying to create something to be able create badge from my daughter phone battery status. Maps integration is working and it tells location + I see battery % in the daughter status…

I am trying to do something with instructions from here

My sensors.yaml is:

- platform: template
  sensors:
    my_phone_battery:
      friendly_name: "N phone battery"
      value_template: "{{ state_attr('device_tracker.google_maps_11xxxxxxxxxx2977', 'battery_level') | round}}"
      unit_of_measurement: '%'
      device_class: battery

Don’t get any errors but this doesn’t help me - don’t see any sensor… Sorry noob… Any ideas / advices?

1 Like

Hey there! This works in my usecase:

"{{ (state_attr('device_tracker.google_maps_11xxxxxxxxxx2977', 'battery_level') | float) | round(0) }}"

If that shouldn’t work, make sure you have the following in configuration.yaml:

sensor: !include sensors.yaml

1 Like

Thx man!! Fast and correct answer… I am on my way to start using HA and there is a lot of things which are still difficult - even trying to find a place to start looking information…

Good to hear! You’re absolutely right, also many things have been changed in the last year. PS: I found this forum to be the best and most current source of information (when searched via google and not the built-in function, somehow just hate it haha)